File: prism-pug.html

package info (click to toggle)
node-prismjs 1.30.0%2Bdfsg%2B~1.26.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,220 kB
  • sloc: javascript: 27,628; makefile: 9; sh: 7; awk: 4
file content (85 lines) | stat: -rw-r--r-- 1,711 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<h2>Comments</h2>
<pre><code>// Some
  multiline
  comment !

// This is a comment
But this is not</code></pre>

<h2>Doctype</h2>
<pre><code>doctype html
doctype 1.1
doctype html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN"</code></pre>

<h2>Tags</h2>
<pre><code>ul
  li Item A
  li Item B
  li Item C
foo(bar='baz')/
input(type='checkbox', checked=true.toString())
#content
div#foo(data-bar="foo")&attributes({'data-foo': 'bar'})</code></pre>

<h2>Markup</h2>
<pre><code>&lt;div class="foo bar">&lt;/div></code></pre>

<h2>Control flow</h2>
<pre><code>#user
  if user.description
    p.description= user.description
  else if authorised
    p.description.
      User has no description,
      why not add one...
  else
    p.description User has no description
ul
  each val in [1, 2, 3, 4, 5]
    li= val
case friends
  when 0
    p you have no friends
  when 1
    p you have a friend
  default
    p you have #{friends} friends
</code></pre>

<h2>Inline JavaScript</h2>
<pre><code>script alert('test');
script(type="text/javascript").
  alert('foo');
  alert('bar');
- var classes = ['foo', 'bar', 'baz']
- for (var x = 0; x &lt; 3; x++)
  li item
</code></pre>

<h2>Keywords</h2>
<pre><code>include ./includes/head.pug
extends ./layout.pug
block content
append head</code></pre>

<h2>Mixins</h2>
<pre><code>mixin list
  ul
    li foo
    li bar
    li baz
+list
mixin pet(name)
  li.pet= name
ul
  +pet('cat')
  +pet('dog')
</code></pre>

<h2>Filters</h2>
<p>Filters require the desired language to be loaded.
On this page, check CoffeeScript <strong>before</strong> checking Pug should make
the example below work properly.</p>
<pre><code>script
  :coffee
    console.log 'This is coffee script'</code></pre>