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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
| doctype head meta(charset="utf-8") title jade study body h2 文档声明和头尾标签 h2 标签语法 section div div ul p h2 元素标签 #id.class1(class='class2') div#id.class1.class2 a(href="http://imooc.com", target="_black") link h2 注释 h3 单行注释 //h3.title(id="title", class="title3") imooc h3 非缓冲注释 //- #id.classname h3 块注释 //- p a(href="#", data-uid="100") input(name="course", type="text", value="jade") h3 混排的大段文本(两种: 1. | 竖线加空格,2. 标签后加点) p | 1.aa strong 11 | 2.bb span 12 style. body{color: #fff} script. var i = "abc"; - var course = "jade"//变量,全局访问 div #{course.toUpperCase()} - var data = "text" - var htmldata = "<script>xxxxx</script>" p #{data} p #{htmldata} // 安全转义 p !{htmldata} // 非转义 p= data //等同P!{xxx} 非转义 p \#{} //输出本身 p \!{} //输出本身
input (value=#{xxxx}) //没有值会输出undefined ==> 写成input (value=xxxx)
遍历循环 - for (var k in json) p= json[k]
each value, key in json p #{key}: #{value}
嵌套循环 - var sections = [{id:1, items: ["a", "b"]},{id:2, items: ["c", "d"]}] dl each section insections dt= section.id each item in section.items dd= item
-var n = 0 ul while n <4 li= n++
h3 if else h3 unless 和if倒着来 h3 case
case name when "java": p hi default "node": p hi node
mixin student p no content
mixin student(xxx) p xxxxxx
+mixin(xxx)
内联mixin mixin() if block block else p no team
+mixin() p content
extend ....
block
include
|