Skip to content
Browse files

change template prefix to curly brackets

Closes #209
  • Loading branch information...
1 parent 613c063 commit 412e5c651b51615e2597047b7aeec27c1377d9b5 @b-laporte b-laporte committed with PK1A Jun 19, 2014
Showing with 728 additions and 689 deletions.
  1. +19 −19 docs/api/index.md
  2. +6 −6 docs/playground/layout.hsp
  3. +2 −2 docs/playground/splitter.hsp
  4. +2 −2 docs/samples/clickhandler/clickhandler.hsp
  5. +4 −4 docs/samples/clock/clock.hsp
  6. +4 −4 docs/samples/component1/timer.hsp
  7. +4 −4 docs/samples/component2/nbrfield.hsp
  8. +4 −4 docs/samples/component3/pagination.hsp
  9. +2 −2 docs/samples/conditions/conditions.hsp
  10. +2 −2 docs/samples/cssclass/cssclass.hsp
  11. +2 −2 docs/samples/dynpath/dynpath.hsp
  12. +6 −6 docs/samples/dyntemplates/dyntemplates.hsp
  13. +2 −2 docs/samples/gestures/gestures.hsp
  14. +4 −4 docs/samples/global/global.hsp
  15. +2 −3 docs/samples/helloworld/hello.hsp
  16. +2 −2 docs/samples/inputsample/inputsample.hsp
  17. +2 −2 docs/samples/let/let.hsp
  18. +4 −4 docs/samples/list1/list.hsp
  19. +4 −4 docs/samples/list2/list.hsp
  20. +2 −2 docs/samples/listupdate/list.hsp
  21. +2 −2 docs/samples/logs/logs.hsp
  22. +2 −2 docs/samples/modifiers/modifiers.hsp
  23. +4 −4 docs/samples/panel/panel.hsp
  24. +2 −2 docs/samples/simplelist/simplelist.hsp
  25. +6 −6 docs/samples/subtemplates/subtemplates.hsp
  26. +4 −4 docs/samples/tabbar/tabbar.hsp
  27. +2 −2 docs/samples/textarea/textarea.hsp
  28. +4 −4 docs/samples/thirdpartycpts/chart.hsp
  29. +3 −3 docs/samples/timer/timer.hsp
  30. +3 −3 docs/samples/todolist/todolist.hsp
  31. +6 −6 docs/todomvc/todo.hsp
  32. +4 −4 hsp/compiler/README.md
  33. +2 −2 hsp/compiler/parser/README.md
  34. +19 −7 hsp/compiler/parser/hspblocks.pegjs
  35. +2 −2 test/compiler/errsamples/block.txt
  36. +2 −2 test/compiler/errsamples/component1.txt
  37. +2 −2 test/compiler/errsamples/component2.txt
  38. +2 −2 test/compiler/errsamples/component3.txt
  39. +2 −2 test/compiler/errsamples/element1.txt
  40. +2 −2 test/compiler/errsamples/element2.txt
  41. +2 −2 test/compiler/errsamples/element3.txt
  42. +2 −2 test/compiler/errsamples/element4.txt
  43. +2 −2 test/compiler/errsamples/element5.txt
  44. +2 −2 test/compiler/errsamples/element6.txt
  45. +2 −2 test/compiler/errsamples/element7.txt
  46. +2 −2 test/compiler/errsamples/element8.txt
  47. +2 −2 test/compiler/errsamples/foreach1.txt
  48. +2 −2 test/compiler/errsamples/foreach2.txt
  49. +2 −2 test/compiler/errsamples/foreach3.txt
  50. +2 −2 test/compiler/errsamples/htmlEntities.txt
  51. +2 −2 test/compiler/errsamples/if1.txt
  52. +2 −2 test/compiler/errsamples/if2.txt
  53. +2 −2 test/compiler/errsamples/if3.txt
  54. +2 −2 test/compiler/errsamples/if4.txt
  55. +2 −2 test/compiler/errsamples/if5.txt
  56. +2 −2 test/compiler/errsamples/if6.txt
  57. +2 −2 test/compiler/errsamples/if7.txt
  58. +2 −2 test/compiler/errsamples/insert.txt
  59. +2 −2 test/compiler/errsamples/jsexpression1.txt
  60. +2 −2 test/compiler/errsamples/jsexpression2.txt
  61. +2 −2 test/compiler/errsamples/jsexpression3.txt
  62. +2 −2 test/compiler/errsamples/jsexpression4.txt
  63. +2 −2 test/compiler/errsamples/let1.txt
  64. +2 −2 test/compiler/errsamples/let2.txt
  65. +2 −2 test/compiler/errsamples/let3.txt
  66. +2 −2 test/compiler/errsamples/mixed1.txt
  67. +2 −2 test/compiler/errsamples/mixed2.txt
  68. +2 −2 test/compiler/errsamples/mixed3.txt
  69. +4 −4 test/compiler/errsamples/mixed4.txt
  70. +3 −3 test/compiler/errsamples/template1.txt
  71. +1 −1 test/compiler/errsamples/template2.txt
  72. +1 −1 test/compiler/errsamples/template3.txt
  73. +2 −2 test/compiler/errsamples/template5.txt
  74. +2 −2 test/compiler/errsamples/template6.txt
  75. +3 −3 test/compiler/errsamples/template7.txt
  76. +14 −0 test/compiler/errsamples/template8.txt
  77. +14 −0 test/compiler/errsamples/template9.txt
  78. +2 −2 test/compiler/errsamples/text1.txt
  79. +2 −2 test/compiler/errsamples/text2.txt
  80. +2 −2 test/compiler/errsamples/text3.txt
  81. +2 −2 test/compiler/errsamples/voidelement.txt
  82. +2 −2 test/compiler/samples/class1.txt
  83. +2 −2 test/compiler/samples/class2.txt
  84. +2 −2 test/compiler/samples/class3.txt
  85. +2 −2 test/compiler/samples/class4.txt
  86. +2 −2 test/compiler/samples/class5.txt
  87. +4 −4 test/compiler/samples/comment.txt
  88. +2 −2 test/compiler/samples/component1.txt
  89. +2 −2 test/compiler/samples/component2.txt
  90. +2 −2 test/compiler/samples/component3.txt
  91. +2 −2 test/compiler/samples/component4.txt
  92. +2 −2 test/compiler/samples/component5.txt
  93. +2 −2 test/compiler/samples/component6.txt
  94. +2 −2 test/compiler/samples/component7.txt
  95. +2 −2 test/compiler/samples/component8.txt
  96. +2 −2 test/compiler/samples/element1.txt
  97. +2 −2 test/compiler/samples/element2.txt
  98. +2 −2 test/compiler/samples/element3.txt
  99. +2 −2 test/compiler/samples/element4.txt
  100. +2 −2 test/compiler/samples/element5.txt
  101. +2 −2 test/compiler/samples/evthandler1.txt
  102. +2 −2 test/compiler/samples/evthandler2.txt
  103. +2 −2 test/compiler/samples/evthandler3.txt
  104. +2 −2 test/compiler/samples/foreach1.txt
  105. +2 −2 test/compiler/samples/foreach2.txt
  106. +2 −2 test/compiler/samples/foreach3.txt
  107. +2 −2 test/compiler/samples/foreach4.txt
  108. +2 −2 test/compiler/samples/htmlEntities.txt
  109. +2 −2 test/compiler/samples/if1.txt
  110. +2 −2 test/compiler/samples/if2.txt
  111. +2 −2 test/compiler/samples/if3.txt
  112. +2 −2 test/compiler/samples/if4.txt
  113. +2 −2 test/compiler/samples/jsexpression1.txt
  114. +2 −2 test/compiler/samples/jsexpression10.txt
  115. +2 −2 test/compiler/samples/jsexpression11.txt
  116. +2 −2 test/compiler/samples/jsexpression12.txt
  117. +2 −2 test/compiler/samples/jsexpression13.txt
  118. +2 −2 test/compiler/samples/jsexpression14.txt
  119. +2 −2 test/compiler/samples/jsexpression15.txt
  120. +2 −2 test/compiler/samples/jsexpression16.txt
  121. +2 −2 test/compiler/samples/jsexpression17.txt
  122. +2 −2 test/compiler/samples/jsexpression18.txt
  123. +2 −2 test/compiler/samples/jsexpression19.txt
  124. +2 −2 test/compiler/samples/jsexpression2.txt
  125. +2 −2 test/compiler/samples/jsexpression3.txt
  126. +2 −2 test/compiler/samples/jsexpression4.txt
  127. +2 −2 test/compiler/samples/jsexpression5.txt
  128. +2 −2 test/compiler/samples/jsexpression6.txt
  129. +2 −2 test/compiler/samples/jsexpression7.txt
  130. +2 −2 test/compiler/samples/jsexpression8.txt
  131. +2 −2 test/compiler/samples/jsexpression9.txt
  132. +2 −2 test/compiler/samples/let1.txt
  133. +2 −2 test/compiler/samples/let2.txt
  134. +2 −2 test/compiler/samples/let3.txt
  135. +2 −2 test/compiler/samples/let4.txt
  136. +2 −2 test/compiler/samples/log1.txt
  137. +2 −2 test/compiler/samples/log2.txt
  138. +4 −4 test/compiler/samples/template1.txt
  139. +2 −2 test/compiler/samples/template2.txt
  140. +2 −2 test/compiler/samples/text1.txt
  141. +2 −2 test/compiler/samples/text2.txt
  142. +2 −2 test/compiler/samples/text3.txt
  143. +2 −2 test/compiler/samples/text4.txt
  144. +2 −2 test/compiler/samples/text5.txt
  145. +2 −2 test/compiler/samples/text6.txt
  146. +2 −2 test/compiler/samples/text7.txt
  147. +2 −2 test/compiler/samples/text8.txt
  148. +2 −2 test/compiler/samples/voidelement.txt
  149. +13 −13 test/compiler/tests.js
  150. +2 −2 test/compiler/utils/testutils.js
  151. +2 −2 test/gestures/doubleTap.spec.hsp
  152. +2 −2 test/gestures/drag.spec.hsp
  153. +2 −2 test/gestures/longPress.spec.hsp
  154. +2 −2 test/gestures/pinch.spec.hsp
  155. +2 −2 test/gestures/singleTap.spec.hsp
  156. +2 −2 test/gestures/swipe.spec.hsp
  157. +2 −2 test/gestures/tap.spec.hsp
  158. +1 −1 test/lib/utils.js
  159. +2 −2 test/rt/booleanAttributes.spec.hsp
  160. +24 −24 test/rt/cptattelements1.spec.hsp
  161. +4 −4 test/rt/cptattelements2.spec.hsp
  162. +10 −10 test/rt/cptattelements3.spec.hsp
  163. +12 −12 test/rt/cptattelements4.spec.hsp
  164. +6 −6 test/rt/cptattelements5.spec.hsp
  165. +10 −10 test/rt/cptbinding.spec.hsp
  166. +12 −12 test/rt/cptinit.spec.hsp
  167. +6 −6 test/rt/cptintegration.spec.hsp
  168. +4 −4 test/rt/cptrefresh.spec.hsp
  169. +6 −6 test/rt/cptwrapper.spec.hsp
  170. +14 −14 test/rt/dynexpressions.spec.hsp
  171. +10 −10 test/rt/elt.spec.hsp
  172. +8 −8 test/rt/evthandler.spec.hsp
  173. +10 −10 test/rt/exprbinding.spec.hsp
  174. +12 −12 test/rt/fnexpressions.spec.hsp
  175. +18 −18 test/rt/foreach.spec.hsp
  176. +14 −14 test/rt/global.spec.hsp
  177. +12 −12 test/rt/if.spec.hsp
  178. +6 −6 test/rt/input.spec.hsp
  179. +8 −8 test/rt/let.spec.hsp
  180. +6 −6 test/rt/log.spec.hsp
  181. +24 −24 test/rt/subtemplates1.spec.hsp
  182. +20 −20 test/rt/subtemplates2.spec.hsp
  183. +14 −14 test/rt/subtemplates3.spec.hsp
  184. +2 −2 test/rt/svg.spec.hsp
  185. +18 −18 test/rt/text.spec.hsp
  186. +2 −2 test/rt/textarea.spec.hsp
  187. +2 −2 test/utils/eventgenerator.spec.hsp
  188. +2 −2 test/utils/hashtester.spec.hsp
View
38 docs/api/index.md
@@ -40,13 +40,13 @@ TBD
#### Template definition
-Inside an `.hsp` file, you can define a template using `#template` statement. A single `.hsp` can define multiple templates.
+Inside an `.hsp` file, you can define a template using `{template}` statement. A single `.hsp` can define multiple templates.
```cs
-#template tplname(arg1, arg2)
+{template tplname(arg1, arg2)}
//your template code goes here
<div>Hello world</div>
-#/template
+{/template}
```
A template has the following properties:
@@ -75,7 +75,7 @@ This statement is a block statement.
Note that as a kind of alternative, in some cases a ternary expression can be used instead of the statement.
```cs
-# template example(context)
+{template example(context)}
Number is:
{if context.number < 0}
negative
@@ -85,7 +85,7 @@ Note that as a kind of alternative, in some cases a ternary expression can be us
null
{/if}
&nbsp;({context.number === 0 ? 'null' : context.number}).
-# /template
+{/template}
```
---
@@ -99,13 +99,13 @@ This statement is a block statement.
Note that the statement creates its own local environment containing the reference to the current value and possibly the one to the current index.
```cs
-# template example(array)
+{template example(array)}
<ul>
{foreach index, value in array}
<li onclick="{process(value)}">{index}: {value}</li>
{/foreach}
</ul>
-# /template
+{/template}
```
---
@@ -156,9 +156,9 @@ It will forward all the given parameters, and add its own metadata with the foll
* `column`: the column number in which the statement appears on the line
```cs
-# template example()
+{template example()}
{log scope}
-# /template
+{/template}
```
---
@@ -181,7 +181,7 @@ The scope of the created variable is the container block in which the statement
`{let}` statements __MUST__ appear at the beginning of the blocks in which they are used!
```hashspace
-# template example()
+{template example()}
{let tpl = "Variable in template environment"}
<div>
@@ -199,12 +199,12 @@ The scope of the created variable is the container block in which the statement
{foreach value in container}
{let foreach_ = "Variable in foreach environment"}
{/foreach}
-# /template
+{/template}
```
---
-#### Component template definitions `#template mycpt using ctrl:MyController`
+#### Component template definitions `{template mycpt using ctrl:MyController}`
Defines a component, that is a template tied to a specific _class_ to be used as controller.
@@ -225,7 +225,7 @@ The above means mainly two important things:
* parameters of the template (equivalent of element attributes) are __passed by name__, not by position
* it not only instantiates the template but also renders it automatically in a DOM element inserted exactly where the statement is used
-There is also an additional subtlety regarding the passing of the parameters. As said, they are passed by name, so if you use `<tplref arg1="..." />` for a template defined like this `# template(whatever, arg1)`, `arg1` will be properly passed, wherever it is defined in the parameters list. However the actual subtlety resides in the __first__ parameter of the function: if it doesn't match any attribute name, it is not left `undefined` as one could think. Instead, it refers to an object built from the attribute/value pairs. In our little example, `whatever` would refer to an object like this: `{arg1: "..."}`. This is implicitely due to the internal way hashspace is managing components instantiation (components are discussed later in this documentation).
+There is also an additional subtlety regarding the passing of the parameters. As said, they are passed by name, so if you use `<tplref arg1="..." />` for a template defined like this `{template(whatever, arg1)}`, `arg1` will be properly passed, wherever it is defined in the parameters list. However the actual subtlety resides in the __first__ parameter of the function: if it doesn't match any attribute name, it is not left `undefined` as one could think. Instead, it refers to an object built from the attribute/value pairs. In our little example, `whatever` would refer to an object like this: `{arg1: "..."}`. This is implicitely due to the internal way hashspace is managing components instantiation (components are discussed later in this documentation).
__Reference__:
@@ -338,9 +338,9 @@ This means that instead of giving a piece of JavaScript code to be executed in t
Event handlers have a particularity though: in your function call, you can pass the `event` object to your handler function. This `event` object is implicitly available in the context of your expression, but it is not automatically passed, so you need to explicitly pass it if you want to have it available in your function.
```cs
-# template example()
+{template example()}
<span onclick="{handler(event)}">Click me</span>
-# /template
+{/template}
function handler(event) {
// ...
@@ -517,14 +517,14 @@ Hashspace natively supports different types of attributes:
```
```cs
- #template mycpt using ctrl:MyCpt
+ {template mycpt using ctrl:MyCpt}
<header>
<#ctrl.header />
</header>
<section>
<#ctrl.body />
</section>
- #/template
+ {/template}
```
In terms of usage, it would be done with several different syntaxes:
@@ -673,13 +673,13 @@ var Controller = klass({
}
});
-# template example using controller:Controller
+{template example using controller:Controller}
<div>
<span></span>
</div>
Ignored text
<hr />
-# /template
+{/template}
```
---
View
12 docs/playground/layout.hsp
@@ -1,7 +1,7 @@
var splitter = require("./splitter.hsp");
-# export template mainLayout(data, playground)
+{export template mainLayout(data, playground)}
<#sampleList data="{data}" playground="{playground}"/>
<div class="{'hsp-sample', 'hsp-sample-full': data.navCollapsed}" onclick="{hideNavHover(event, data)}">
@@ -22,7 +22,7 @@ var splitter = require("./splitter.hsp");
</div>
</div>
</div>
-# /template
+{/template}
function splitterReleased(position, data, playground) {
data.splitterPos = position + "px";
@@ -56,7 +56,7 @@ function hideNavHover(event, data) {
}
}
-# template sampleList(data, playground)
+{template sampleList(data, playground)}
<div class="{'samples-list', 'samples-list-collapsed': data.navCollapsed}"
onclick="{hideNavHover(event, data)}">
<a href="" class="collapse" title="{data.navCollapsed ? 'Expand sidebar' : 'Collapse sidebar'}" onclick="{collapseNav(event, data, playground)}"><span class="icon"></span></a>
@@ -79,9 +79,9 @@ function hideNavHover(event, data) {
{/foreach}
</div>
</div>
-# /template
+{/template}
-# export template errorList(errors)
+{export template errorList(errors)}
{if errors && errors.length}
<div class="errorlist">
<ul>
@@ -104,4 +104,4 @@ function hideNavHover(event, data) {
</ul>
</div>
{/if}
-# /template
+{/template}
View
4 docs/playground/splitter.hsp
@@ -71,9 +71,9 @@ var SplitterCtrl = Class({
});
-#template splitter using ctrl:SplitterCtrl
+{template splitter using ctrl:SplitterCtrl}
<div class="splitter" onmousedown="{ctrl.onMouseDown(event)}"></div>
<div class="{'splitter-proxy', 'splitter-proxy-hidden': !ctrl.active}"></div>
-#/template
+{/template}
module.exports = splitter;
View
4 docs/samples/clickhandler/clickhandler.hsp
@@ -1,11 +1,11 @@
var msg={text:""}, count=-1;
-# template message(msg)
+{template message(msg)}
<div title="click me!" onclick="{changeMessage()}" onselectstart="return false">
{if msg.isWarning}<div class="warning">WARNING:&nbsp;</div>{/if}
{msg.text}
</div>
-# /template
+{/template}
function changeMessage() {
count++;
View
8 docs/samples/clock/clock.hsp
@@ -42,7 +42,7 @@ var ClockController=klass({
}
});
-# template clock using c:ClockController
+{template clock using c:ClockController}
// example from http://www.ractivejs.org/examples/clock/
<div class="square">
<svg viewBox="0 0 100 100">
@@ -67,13 +67,13 @@ var ClockController=klass({
</svg>
<div class="city">{c.cityName}</div>
</div>
-# /template
+{/template}
-# template demo
+{template demo}
<#clock city="SFO"/>
<#clock city="PAR"/>
<#clock city="TYO"/>
-# /template
+{/template}
// display the template in the #output div
demo().render("output");
View
8 docs/samples/component1/timer.hsp
@@ -18,15 +18,15 @@ var Timer=klass({
}
});
-# template timer using t:Timer
+{template timer using t:Timer}
Elapsed time: {t.secondsElapsed}s
-# /template
+{/template}
-# template test
+{template test}
Sample showing two timer instances with different init values:<br/>
<#timer/> <br/>
<#timer initvalue="10"/>
-# /template
+{/template}
// display the test template in the #output div
test().render("output");
View
8 docs/samples/component2/nbrfield.hsp
@@ -70,23 +70,23 @@ function getNumber(s) {
}
// component template associated with the NbrField controller
-# export template nbrfield using c:NbrField
+{export template nbrfield using c:NbrField}
<span class="nbrfield">
<input type="text" model="{c.internalValue}"
class="{'nbrfield', 'error': !c.isValid}"/>
<button onclick="{c.resetField()}">reset</button>
</span>
-# /template
+{/template}
// component usage
-# template test(d)
+{template test(d)}
Component #1: <#nbrfield value="{d.value1}" min="-10" max="1000"/><br/>
Value in the data model: <span class="textValue">{d.value1}</span>
(min:-10 / max:1000 / default:0)
<hr/>
Component #2: <#nbrfield value="{d.value2}"/><br/>
Value in the data model: <span class="textValue">{d.value2}</span>
-# /template
+{/template}
// display the template in the #output div
test({value1:123}).render("output");
View
8 docs/samples/component3/pagination.hsp
@@ -43,7 +43,7 @@ var Pagination=klass({
}
});
-# template pagination using p:Pagination
+{template pagination using p:Pagination}
<ul class="pagination">
<li class="{'disabled':p.activepage===0}">
<a onclick="{p.selectPage(p.activepage-1)}">Previous</a>
@@ -57,9 +57,9 @@ var Pagination=klass({
<a onclick="{p.selectPage(p.activepage+1)}">Next</a>
</li>
</ul>
-# /template
+{/template}
-# template paginationTest(model)
+{template paginationTest(model)}
<div class="section3">
<label class="fieldlabel">Active page: </label><input type="number" model="{model.active}"/><br/>
<label class="fieldlabel">Collection size: </label><input type="number" model="{model.collectionSize}"/><br/>
@@ -69,7 +69,7 @@ var Pagination=klass({
<#pagination activepage="{model.active}" collectionsize="{model.collectionSize}"
pagesize="{model.pageSize}" onpageselect="{updateSelection(event.pageNumber)}"/>
-# /template
+{/template}
var model = {
active: 4,
View
4 docs/samples/conditions/conditions.hsp
@@ -1,7 +1,7 @@
var klass=require("hsp/klass");
// nt is an instance of NumberTester
-# template test(nt)
+{template test(nt)}
<div>
Number: <span class="textvalue">{nt.number}</span> &nbsp;
{if nt.number==0}
@@ -21,7 +21,7 @@ var klass=require("hsp/klass");
<a onclick="{nt.increment(1)}">Increment Number</a> -
<a onclick="{nt.increment(-1)}">Decrement Number</a>
</div>
-# /template
+{/template}
// klass is a little utility to create a JS object constructor
// from a simple JSON structure - main goals are to
View
4 docs/samples/cssclass/cssclass.hsp
@@ -1,4 +1,4 @@
-# template message(msg)
+{template message(msg)}
// onselectstart: prevent double-click selection on a elements
<div onselectstart="return false">
<a onclick="{toggleUrgency()}">Change Urgency</a> -
@@ -11,7 +11,7 @@
Class value: "{'msg', 'urgent':msg.urgency, msg.category}"
</div>
</div>
-# /template
+{/template}
var msg={
text:"Hello World",
View
4 docs/samples/dynpath/dynpath.hsp
@@ -1,4 +1,4 @@
-# template grid(data)
+{template grid(data)}
<div>
{foreach idx in data.rows}
<div>
@@ -16,7 +16,7 @@
<a onclick="{update()}">Update columns B&C</a>
&nbsp;-&nbsp;
<a onclick="{swapC()}">Show/Hide columns C</a>
-# /template
+{/template}
// create dummy data
var list=[], count=5;
View
12 docs/samples/dyntemplates/dyntemplates.hsp
@@ -1,19 +1,19 @@
-# template test(ctxt)
+{template test(ctxt)}
<div><a onclick="{swapTemplate()}">Change template</a></div>
<#ctxt.view ctxt="{ctxt}"/>
-# /template
+{/template}
-# template tplA(ctxt)
+{template tplA(ctxt)}
<div class="msg">
A: {ctxt.msg}
</div>
-# /template
+{/template}
-# template tplB(ctxt)
+{template tplB(ctxt)}
<div class="msg">
B: {ctxt.msg2}
</div>
-# /template
+{/template}
var model={
view: tplA,
View
4 docs/samples/gestures/gestures.hsp
@@ -1,4 +1,4 @@
-# template gestures(msgList)
+{template gestures(msgList)}
<div class="touchboard" style="height:200px; background: #27AAFC;text-align:center;"
ontap="{addMsg(event)}" ontapstart="{addMsg(event)}" ontapcancel="{addMsg(event)}"
onlongpress="{addMsg(event)}" onlongpressstart="{addMsg(event)}" onlongpresscancel="{addMsg(event)}"
@@ -15,7 +15,7 @@
<div>{msg}</div>
{/foreach}
</div>
-# /template
+{/template}
var eventLog = [];
View
8 docs/samples/global/global.hsp
@@ -1,23 +1,23 @@
var hsp=require("hsp/rt");
-# template item(text,value)
+{template item(text,value)}
{if value}
<div>
<div class="label">{text}</div>
<div class="value">{value}</div>
</div>
{/if}
-# /template
+{/template}
hsp.global.label=item;
hsp.global.ln={personDetails:"Person details"};
-# template test(person)
+{template test(person)}
<div class="global" title="{ln.personDetails}">
<#label text="First Name: " value="{person.firstName}"/>
<#label text="Last Name: " value="{person.lastName}"/>
</div>
-# /template
+{/template}
// render template in the #output div
test({firstName:"Homer",lastName:"Simpson"}).render("output");
View
5 docs/samples/helloworld/hello.hsp
@@ -1,10 +1,9 @@
-
// edit me!
-# template hello(name)
+{template hello(name)}
<div class="msg">
Hello {name}!
</div>
-# /template
+{/template}
// display the template in the #output div
hello("World").render("output");
View
4 docs/samples/inputsample/inputsample.hsp
@@ -1,4 +1,4 @@
-# template inputSample(data)
+{template inputSample(data)}
<div class="info2">All the following inputs are synchronized:</div>
<div class="section">
Comment #1: <input type="text" value="{data.comment}"/><br/>
@@ -29,7 +29,7 @@
<input type="{data.dtype}" value="{data.comment}" style="width:100px"/> -
change type: <input type="text" value="{data.dtype}" style="width:100px"/>
</div>
-# /template
+{/template}
var d={comment:"edit me!", isChecked:false, selection:"B", dtype:"text"}
View
4 docs/samples/let/let.hsp
@@ -1,4 +1,4 @@
-# template test(m)
+{template test(m)}
{let p1=m.part1, m21=m.part2.part21.msg+"!"}
<div>
{let p11=p1.part11}
@@ -11,7 +11,7 @@
{/if}
</div>
<a onclick="{updateModel()}">Change Model</a>
-# /template
+{/template}
var model={
part1:{
View
8 docs/samples/list1/list.hsp
@@ -14,7 +14,7 @@ var ListController = klass({
});
// simple list template
-# template list using lc:ListController
+{template list using lc:ListController}
// content is the list of attribute sub-elements
<div class="list {lc.class}">
{if lc.head}
@@ -34,10 +34,10 @@ var ListController = klass({
</ul>
{/if}
</div>
-# /template
+{/template}
// test template
-# template test(d)
+{template test(d)}
<#list head="Static list" class="listcpt">
<@option>First {d.itemName}</@option>
<@option>Second {d.itemName}</@option>
@@ -58,7 +58,7 @@ var ListController = klass({
<@option>{idx+1}. {itm}</@option>
{/foreach}
</#list>
-# /template
+{/template}
var count=0, model={
itemName: "item",
View
8 docs/samples/list2/list.hsp
@@ -36,7 +36,7 @@ var ListCtrl = klass({
});
// simple list template
-# template list using lc:ListCtrl
+{template list using lc:ListCtrl}
// content is the list of attribute sub-elements
<div class="list {lc.class}">
{if lc.head}
@@ -58,10 +58,10 @@ var ListCtrl = klass({
</ul>
{/if}
</div>
-# /template
+{/template}
// test template
-# template test(d)
+{template test(d)}
Click on an item to select it:
<#list head="Static list" class="listcpt" onselect="{showSelection(event.value)}">
@@ -81,7 +81,7 @@ var ListCtrl = klass({
</#list>
{if d.selectedItem!==null}Last selected value: {d.selectedItem}{/if}
-# /template
+{/template}
var count=0, model={
itemName: "item",
View
4 docs/samples/listupdate/list.hsp
@@ -1,4 +1,4 @@
-# template list(persons)
+{template list(persons)}
// onselectstart: prevent double-click selection on a elements
<div onselectstart="return false">
<div class="msg">
@@ -19,7 +19,7 @@
<div class="msg">
Number of people in the list: {persons.length}
</div>
-# /template
+{/template}
var persons=[
{firstName:"Homer",lastName:"Simpsons"},
View
4 docs/samples/logs/logs.hsp
@@ -1,6 +1,6 @@
var log=require("hsp/rt/log");
-# template test(cities, logs)
+{template test(cities, logs)}
{log "top-level:",scope}
<a onclick="{increaseList()}">Increase list</a> -
<a onclick="{decreaseList()}">Decrease list</a> -
@@ -22,7 +22,7 @@ var log=require("hsp/rt/log");
{/foreach}
</ul>
</div>
-# /template
+{/template}
// register new logger
var logs=[];
View
4 docs/samples/modifiers/modifiers.hsp
@@ -37,7 +37,7 @@ var Sorter=klass({
}
})
-# template sample(d)
+{template sample(d)}
<div class="section2">
Message in capital letters:
<span class="textvalue">{d.msg|changeCase:"upper"}</span><br/>
@@ -58,7 +58,7 @@ var Sorter=klass({
Toggle sort order (current: {fnSorter.ascending? "ascending" : "descending"})
</a>
</div>
-# /template
+{/template}
var data={
msg:"Hello Simpsons!",
View
8 docs/samples/panel/panel.hsp
@@ -8,7 +8,7 @@ var PanelController = klass({
});
// sample panel template
-# template panel using c:PanelController
+{template panel using c:PanelController}
<div class="panel">
{if c.head}
<div class="head"> <#c.head/> </div>
@@ -17,9 +17,9 @@ var PanelController = klass({
<#c.body/>
</div>
</div>
-# /template
+{/template}
-# template test(m)
+{template test(m)}
<#panel body="Panel A (headless): {m.text}"/>
<#panel head="Panel B ({m.text}!)">
@@ -30,7 +30,7 @@ var PanelController = klass({
<@head>Panel C: <a onclick="{update(10)}">Update model</a></@head>
<@body>{m.text}! <a onclick="{update(100)}">Update model</a></@body>
</#panel>
-# /template
+{/template}
var model={text:"Hello World"}, count=0;
View
4 docs/samples/simplelist/simplelist.hsp
@@ -1,4 +1,4 @@
-# template people(d)
+{template people(d)}
<div class="msg">Click on a person to see more details:</div>
<ul>
{foreach p in d.people}
@@ -12,7 +12,7 @@
<div class="msg">
Number of people in the list: {d.people.length}
</div>
-# /template
+{/template}
function toggleDetails(person) {
person.showdetails = !person.showdetails;
View
12 docs/samples/subtemplates/subtemplates.hsp
@@ -1,29 +1,29 @@
-# export template personList(persons)
+{export template personList(persons)}
<div class="subtemplates">
{foreach p in persons}
<#personDescription person="{p}"/>
// add a separator between each person
{if !p_islast} <hr/> {/if}
{/foreach}
</div>
-# /template
+{/template}
-# export template personDescription(person)
+{export template personDescription(person)}
<div class="person">
<#item label="First Name: " value="{person.firstName}"/>
<#item label="Last Name: " value="{person.lastName}"/>
</div>
-# /template
+{/template}
-# template item(label,value)
+{template item(label,value)}
{if value}
<div>
<div class="label">{label}</div>
<div class="value">{value}</div>
</div>
{/if}
-# /template
+{/template}
var persons=[
{firstName:"Homer",lastName:"Simpsons"},
View
8 docs/samples/tabbar/tabbar.hsp
@@ -43,7 +43,7 @@ var TabBarCtrl = klass({
}
});
-#template tabbar using ctrl:TabBarCtrl
+{template tabbar using ctrl:TabBarCtrl}
<div class="x-tabbar">
<nav class="x-tabs">
{foreach idx, tab in ctrl.content}
@@ -65,9 +65,9 @@ var TabBarCtrl = klass({
<#ctrl.selectedTab.body />
</div>
</div>
-#/template
+{/template}
-# template test
+{template test}
{let showSubTabs=false, selection1=0, selection2=0}
<#tabbar selection="{selection1}">
<@tab label="Tab A">
@@ -87,7 +87,7 @@ var TabBarCtrl = klass({
<input id="cb1" type="checkbox" model="{showSubTabs}"/>
Show nested tabs in tab A
</label>
-# /template
+{/template}
test().render("output");
View
4 docs/samples/textarea/textarea.hsp
@@ -1,4 +1,4 @@
-# template sample(data)
+{template sample(data)}
<div class="info2">The following textarea elements are synchronized:</div>
<div class="section">
<div>Text #1:</div>
@@ -9,7 +9,7 @@
<textarea rows="4" cols="40" model="{data.text}"/>
</div>
<a onclick="{changeText(data)}">Change text</a>
-# /template
+{/template}
var d={
// Frog by Donna Shepherd
View
8 docs/samples/thirdpartycpts/chart.hsp
@@ -36,11 +36,11 @@ var ChartCpt=klass({
}
});
-# template chart using c:ChartCpt
+{template chart using c:ChartCpt}
<canvas width="{c.width}" height="{c.height}"></canvas>
-# /template
+{/template}
-# template test(data)
+{template test(data)}
{let datasets=(data.ds=="d1")? d1 : d2}
<#chart width="380" height="220" type="{data.type}" labels="{labels}" datasets="{datasets}"/>
<div style="padding:15 0 0 30">
@@ -53,7 +53,7 @@ var ChartCpt=klass({
<label for="rb3"><input id="rb3" type="radio" model="{data.ds}" value="d1"/> d1</label>&nbsp;
<label for="rb4"><input id="rb4" type="radio" model="{data.ds}" value="d2"/> d2</label>
</div>
-# /template
+{/template}
// display the template in the #output div
test({type:"line",ds:"d1"}).render("output");
View
6 docs/samples/timer/timer.hsp
@@ -1,8 +1,8 @@
var klass=require("hsp/klass");
-# template elapsedTime(timer)
+{template elapsedTime(timer)}
Seconds Elapsed: {timer.secondsElapsed}
-# /template
+{/template}
// klass is a little utility to create a JS object constructor
// from a simple JSON structure - main goals are to
@@ -13,7 +13,7 @@ var Timer=klass({
this._iid=setInterval(this.tick.bind(this),1000);
},
$dispose:function() {
- clearInterval(this._iid);
+ clearInterval(this._iid);
},
tick:function() {
this.secondsElapsed++;
View
6 docs/samples/todolist/todolist.hsp
@@ -1,6 +1,6 @@
var klass=require("hsp/klass");
-# template todolist(todo)
+{template todolist(todo)}
<div>
<h3>TODO...</h3>
<ul>
@@ -13,7 +13,7 @@ var klass=require("hsp/klass");
<button>{'Add #' + (todo.data.items.length + 1)}</button>
</form>
</div>
-# /template
+{/template}
// todo controller
var TodoCtl=klass({
@@ -26,7 +26,7 @@ var TodoCtl=klass({
addItem:function() {
var d=this.data, items=d.items;
// add new item to the todo list
- items.splice(items.length,0,d.newTodoItem);
+ items.push(d.newTodoItem);
// empty new todo field value
d.newTodoItem = "";
// return false to prevent default behaviour
View
12 docs/todomvc/todo.hsp
@@ -19,7 +19,7 @@ var TodoUICtrl=require("./todoctrl").TodoUICtrl;
/**
* Main TODO template
*/
-# export template todos using c:TodoUICtrl
+{export template todos using c:TodoUICtrl}
<section id="todoapp" onselectstart="return false;">
<header id="header">
<h1>todos</h1>
@@ -65,15 +65,15 @@ var TodoUICtrl=require("./todoctrl").TodoUICtrl;
</p>
<p>Should be soon part of <a href="http://todomvc.com">TodoMVC</a></p>
</footer>
-# /template
+{/template}
/**
* template displaying the todo element
* @param todo the todo data model
* @param c the general controller
*/
-# template todoItem(todo, c)
+{template todoItem(todo, c)}
<li class="{'completed':todo.completed, 'editing':todo.editMode}">
{if todo.editMode}
<form onsubmit="{c.doneEditing(todo)}" class="editform">
@@ -88,7 +88,7 @@ var TodoUICtrl=require("./todoctrl").TodoUICtrl;
</div>
{/if}
</li>
-# /template
+{/template}
/**
@@ -97,10 +97,10 @@ var TodoUICtrl=require("./todoctrl").TodoUICtrl;
* @param {String} filter the corresponding filter code used in the data model - e.g. "all"
* @param c the general controller
*/
-# template filterLink(label, filter, c)
+{template filterLink(label, filter, c)}
<li>
<a onclick="{c.selectFilter(filter)}" title="{label}" class="{label} {'selected':c.filter===filter}">
{label}
</a>
</li>
-# /template
+{/template}
View
8 hsp/compiler/README.md
@@ -5,9 +5,9 @@
In hashspace, compiling means transforming a template from the specific syntax into a javascript string.
For example, this template
```
-# template hello(person)
+{template hello(person)}
Hello {person.name}!
-# /template
+{/template}
```
becomes `n.$text({e1:[1,2,"person","name"]},["Hello ",1,"!"])`
@@ -21,9 +21,9 @@ The compilation is in fact a 3 steps process:
### Sample ###
Initial template:
```
-# template hello(person)
+{template hello(person)}
Hello {person.name}!
-# /template
+{/template}
```
Parser output:
View
4 hsp/compiler/parser/README.md
@@ -9,11 +9,11 @@ The grammar is stored in the `hspblocks.pegjs` file, which is itself compiled in
## Input ##
The hashspace template source code, e.g.:
```
-# template test(person)
+{template test(person)}
<div title="Some text" id="{person.id}" class="{person.gender} {person.category}">
Hello {person.name}!
</div>
-# /template
+{/template}
```
## Output ##
View
26 hsp/compiler/parser/hspblocks.pegjs
@@ -13,7 +13,7 @@ TemplateFile
{return blocks;}
TextBlock
- = lines:(!(_ "#" _ "template") !(_ "#" _ [a-zA-Z0-9]+ _ "template") !("#" _ "require") chars:[^\n\r]* eol:EOL {return chars.join("")+eol})+
+ = lines:(!(_ ("#" / "{") _ "template") !(_ ("#" / "{") _ [a-zA-Z0-9]+ _ "template") !("#" _ "require") chars:[^\n\r]* eol:EOL {return chars.join("")+eol})+
{return {type:"plaintext", value:lines.join('')}}
TemplateBlock "template block"
@@ -25,8 +25,8 @@ TemplateBlock "template block"
}
TemplateStart "template statement"
- = _ "#" _ m:(("template") / (c:[a-zA-Z0-9]+ _ "template") {return c.join('')})
- S+ name:Identifier args:(TemplateController / ArgumentsDefinition / invarg:InvalidTplArgs)? _ EOL
+ = _ d1:("#" / "{") p:_ m:(("template") / (c:[a-zA-Z0-9]+ _ "template") {return c.join('')})
+ S+ name:Identifier args:(TemplateController / ArgumentsDefinition / invarg:InvalidTplArgs)? _ d2:("}")? EOL
{
var mod=""; // modifier (e.g. "export")
if (m!=="template") {
@@ -36,8 +36,13 @@ TemplateStart "template statement"
if (mod) {
mod+=" ";
}
- return {type:"invalidtemplate", line:line, column:column, code: "# "+mod+"template "+name+" "+args.invalidTplArg}
+ return {type:"invalidtemplate", line:line, column:column, code: d1+p+mod+"template "+name+" "+args.invalidTplArg+d2}
} else {
+ if ((d1 === "{" && d2 !=="}") || (d1 === "#" && d2!=="")) {
+ // inconsistant delimiters
+ return {type:"invalidtemplate", line:line, column:column, code: d1+p+mod+"template "+name+" "+args.invalidTplArg+d2}
+ }
+
if (args && args.ctl && args.constructor!==Array) {
// this template uses a controller
return {type:"template", name:name, mod:mod, controller:args.ctl, controllerRef: args.ctlref, line:line, column:column}
@@ -55,10 +60,17 @@ ArgumentsDefinition "arguments"
{var args = first ? [first] : []; if (others && others.length) args=args.concat(others);return args;}
InvalidTplArgs
- = _ chars:[^\n\r]+ &EOL
+ = _ !"}" chars:[^\n\r]+ &EOL
{return {invalidTplArg:chars.join('')}}
TemplateEnd "template end statement"
+ = TemplateEnd1 / TemplateEnd2
+
+TemplateEnd1
+ = _"{/template" _ "}" _ (EOL / EOF)
+ {return {type:"/template",line:line,column:column}}
+
+TemplateEnd2
= _"#" _ "/template" _ (EOL / EOF)
{return {type:"/template",line:line,column:column}}
@@ -95,7 +107,7 @@ TplTextChar "text character"
/ [^{#/<]
InvalidBlock
- = "{" chars:[^{}#]* "}"
+ = "{" !(_ "/template" _ "}") chars:[^{}#]* "}"
{return {type:"invalidblock", code:chars.join(''), line:line, column:column}}
IfBlock "if statement"
@@ -325,7 +337,7 @@ HExpressionCssClassElt
{return {type:"CssClassElement", left:head, right:tail};}
InvalidExpressionValue
- = chars:[^}]+
+ = !("/template" _) chars:[^}]+
{return {type:"invalidexpression", code:chars.join(''), line:line, column:column}}
// White spaces
View
4 test/compiler/errsamples/block.txt
@@ -1,7 +1,7 @@
##### Template:
-# template hello(person)
+{template hello(person)}
{foo bar} Hello World!
-# /template
+{/template}
##### Errors:
[
View
4 test/compiler/errsamples/component1.txt
@@ -1,9 +1,9 @@
##### Template:
-# template test(person)
+{template test(person)}
<#lib.panel title="Some text">
foo bar
</#lib.pan>
-# /template
+{/template}
##### Errors:
[
View
4 test/compiler/errsamples/component2.txt
@@ -1,11 +1,11 @@
##### Template:
-# template test(person)
+{template test(person)}
<#lib.panel title="Some text">
<@lib.head>
foo
</@lib.head>
</#lib.panel>
-# /template
+{/template}
##### Errors:
[
View
4 test/compiler/errsamples/component3.txt
@@ -1,7 +1,7 @@
##### Template:
-# template eat()
+{template eat()}
<#fruit>Banana</fruit>
-# /template
+{/template}
##### Errors:
[
View
4 test/compiler/errsamples/element1.txt
@@ -1,9 +1,9 @@
##### Template:
-# template test(person)
+{template test(person)}
<div title="Some text" id="{person.id}" class="{person.gender} {person.category}">
<span>Hello {person.name}!
</div>
-# /template
+{/template}
##### Errors:
[
View
4 test/compiler/errsamples/element2.txt
@@ -1,8 +1,8 @@
##### Template:
-# template test(person)
+{template test(person)}
<div title="Some text" id="{person.id}" class="{person.gender} {person.category}">
<span>Hello {person.name}!</span>
-# /template
+{/template}
##### Errors:
[
View
4 test/compiler/errsamples/element3.txt
@@ -1,9 +1,9 @@
##### Template:
-# template test(person)
+{template test(person)}
<div title="Some text">
foo bar
</di>
-# /template
+{/template}
##### Errors:
[
View
4 test/compiler/errsamples/element4.txt
@@ -1,9 +1,9 @@
##### Template:
-# template test(person)
+{template test(person)}
<div title="Some text class="foo">
foo bar
</div>
-# /template
+{/template}
##### Errors:
[
View
4 test/compiler/errsamples/element5.txt
@@ -1,9 +1,9 @@
##### Template:
-# template test(person)
+{template test(person)}
<div title="blah"
foo bar
</div>
-# /template
+{/template}
##### Errors:
[
View
4 test/compiler/errsamples/element6.txt
@@ -1,7 +1,7 @@
##### Template:
-# template test(person)
+{template test(person)}
<img onclick="{doClick('blah',event,)}"/>
-# /template
+{/template}
##### Errors:
[
View
4 test/compiler/errsamples/element7.txt
@@ -1,7 +1,7 @@
##### Template:
-# template test(person)
+{template test(person)}
<img onclick="foo{doClick('blah',event,)}bar"/>
-# /template
+{/template}
##### Errors:
[
View
4 test/compiler/errsamples/element8.txt
@@ -1,7 +1,7 @@
##### Template:
-# template test(person)
+{template test(person)}
<img onclick="{123}"/>
-# /template
+{/template}
##### Errors:
[
View
4 test/compiler/errsamples/foreach1.txt
@@ -1,8 +1,8 @@
##### Template:
-# template test(things)
+{template test(things)}
Foreach test:
{foreach (thing inm things)} - {thing} - {/foreach}
-# /template
+{/template}
##### Errors:
[
View
4 test/compiler/errsamples/foreach2.txt
@@ -1,8 +1,8 @@
##### Template:
-# template test(things)
+{template test(things)}
Foreach test:
{foreach (thing in things)} - {thing} - {/forach}
-# /template
+{/template}
##### Errors:
[
View
4 test/compiler/errsamples/foreach3.txt
@@ -1,8 +1,8 @@
##### Template:
-# template test(things)
+{template test(things)}
Foreach test:
{thing} - {/foreach}
-# /template
+{/template}
##### Errors:
[
View
4 test/compiler/errsamples/htmlEntities.txt
@@ -1,7 +1,7 @@
##### Template:
-# template test()
+{template test()}
&invalid;
-# /template
+{/template}
##### Errors:
[
View
4 test/compiler/errsamples/if1.txt
@@ -1,9 +1,9 @@
##### Template:
-# template hello(person)
+{template hello(person)}
{if (person.isAdult}
Hello
{/if}
-# /template
+{/template}
##### Error:
[
View
4 test/compiler/errsamples/if2.txt
@@ -1,8 +1,8 @@
##### Template:
-# template hello(person)
+{template hello(person)}
{if person.isAdult}
Hello
-# /template
+{/template}
##### Error:
[
View
4 test/compiler/errsamples/if3.txt
@@ -1,9 +1,9 @@
##### Template:
-# template hello(person)
+{template hello(person)}
{if person.isAdult}
Hello
{else}
-# /template
+{/template}
##### Error:
[
View
4 test/compiler/errsamples/if4.txt
@@ -1,11 +1,11 @@
##### Template:
-# template hello(person)
+{template hello(person)}
{if person.isAdult}
blah
{else if person.isMinor/}
blah
{/if}
-# /template
+{/template}
##### Error:
[
View
4 test/compiler/errsamples/if5.txt
@@ -1,8 +1,8 @@
##### Template:
-# template hello(person)
+{template hello(person)}
blah
{/if}
-# /template
+{/template}
##### Error:
[
View
4 test/compiler/errsamples/if6.txt
@@ -1,10 +1,10 @@
##### Template:
-# template hello(person)
+{template hello(person)}
blah
{else}
blah
{/if}
-# /template
+{/template}
##### Error:
[
View
4 test/compiler/errsamples/if7.txt
@@ -1,10 +1,10 @@
##### Template:
-# template hello(person)
+{template hello(person)}
blah
{else if foo}
blah
{/if}
-# /template
+{/template}
##### Error:
[
View
4 test/compiler/errsamples/insert.txt
@@ -1,9 +1,9 @@
##### Template:
-# template test(person)
+{template test(person)}
foo
{content("First Name", person.firstName}
bar
-# /template
+{/template}
##### Errors:
[
View
4 test/compiler/errsamples/jsexpression1.txt
@@ -1,9 +1,9 @@
##### Template:
-# template test(value)
+{template test(value)}
{if !(++value)}
Hello
{/if}
-# /template
+{/template}
##### Error:
[
View
4 test/compiler/errsamples/jsexpression2.txt
@@ -1,9 +1,9 @@
##### Template:
-# template test(x,y)
+{template test(x,y)}
{if !(x++ && y--)}
Hello
{/if}
-# /template
+{/template}
##### Error:
[
View
4 test/compiler/errsamples/jsexpression3.txt
@@ -1,7 +1,7 @@
##### Template:
-# template test(person)
+{template test(person)}
{person.name|foo:}
-# /template
+{/template}
##### Error:
[
View
4 test/compiler/errsamples/jsexpression4.txt
@@ -1,7 +1,7 @@
##### Template:
-# template test(person)
+{template test(person)}
{person.name|}
-# /template
+{/template}
##### Error:
[
View
4 test/compiler/errsamples/let1.txt
@@ -1,12 +1,12 @@
##### Template:
-# template hello(person)
+{template hello(person)}
// This is OK
{let p=person}
<div class="foo">
This is KO
{let p2=person}
</div>
-# /template
+{/template}
##### Error:
[
View
4 test/compiler/errsamples/let2.txt
@@ -1,5 +1,5 @@
##### Template:
-# template hello(person)
+{template hello(person)}
<div class="foo">
{let p=person} // OK
<span>
@@ -15,7 +15,7 @@
</span>
</div>
{let p=person} // KO
-# /template
+{/template}
##### Error:
[
View
4 test/compiler/errsamples/let3.txt
@@ -1,5 +1,5 @@
##### Template:
-# template hello(person)
+{template hello(person)}
<#x.mycpt class="foo">
{let p=person} // OK
{foreach n in p.names}
@@ -16,7 +16,7 @@
{let p=person} // KO
</@body>
</#x.cpt2>
-# /template
+{/template}
##### Error:
[
View
4 test/compiler/errsamples/mixed1.txt
@@ -4,11 +4,11 @@ function foo() {
return x;
}
-# template test(person)
+{template test(person)}
<div title="Some text" id="{person.id}" class="{person.gender} {person.category}">
<span>Hello {person.name}!</span>
</div>
-# /template
+{/template}
function bar() {
foo({blah:"hello",});
View
4 test/compiler/errsamples/mixed2.txt
@@ -4,10 +4,10 @@ function foo() {
return x;
}
-# template test(person)
+{template test(person)}
<div title="Some text" id="{person.id}" class="{person.gender} {person.category}">
<span>Hello {person.name}!</span>
</div>
-# /template
+{/template}
##### Errors:
View
4 test/compiler/errsamples/mixed3.txt
@@ -1,10 +1,10 @@
##### Template:
// line 1
-# template test(person)
+{template test(person)}
<div title="Some text" id="{person.id}" class="{person.gender} {person.category}">
<span>Hello {person.name}!</span>
</div>
-# /template
+{/template}
// line 7
.var foo=42;
View
8 test/compiler/errsamples/mixed4.txt
@@ -1,15 +1,15 @@
##### Template:
// line 1
-# template test(person)
+{template test(person)}
<div title="Some text" id="{person.id}" class="{person.gender} {person.category}">
<span>Hello {person.name}!</span>
</div>
-# /template
+{/template}
// line 7
var foo=42;
-# template bar
+{template bar}
Hello
-# /template
+{/template}
// line 12
.
View
6 test/compiler/errsamples/template1.txt
@@ -1,14 +1,14 @@
##### Template:
-# template hello foo
+{template hello foo}
{foo.bar} Hello World!
-# /template
+{/template}
##### Errors:
[
{
"description": "Invalid template declaration",
"line": 1,
"column": 1,
- "code": "# template hello foo"
+ "code": "{template hello foo}"
}
]
View
2 test/compiler/errsamples/template2.txt
@@ -1,5 +1,5 @@
##### Template:
-# template hello(foo)
+{template hello(foo)}
{foo.bar} Hello World!
##### Errors:
View
2 test/compiler/errsamples/template3.txt
@@ -1,5 +1,5 @@
##### Template:
-# template hello(foo)
+{template hello(foo)}
{foo.bar} Hello World!
# blahblah foo
View
4 test/compiler/errsamples/template5.txt
@@ -1,7 +1,7 @@
##### Template:
-# template test(event)
+{template test(event)}
Hello World!
-# /template
+{/template}
##### Errors: