Change widget syntax to `$` instead of underscore

eg `<$list>`
This commit is contained in:
Jeremy Ruston 2012-12-30 13:55:19 +00:00
parent dbd123675a
commit 300b6cc485
11 changed files with 26 additions and 26 deletions

View File

@ -10,9 +10,9 @@ Wiki rule for HTML elements and widgets. For example:
This is an HTML5 aside element This is an HTML5 aside element
</aside> </aside>
<_slider target="MyTiddler"> <$slider target="MyTiddler">
This is a widget invocation This is a widget invocation
</_slider> </$slider>
}}} }}}
@ -31,7 +31,7 @@ var voidElements = "area,base,br,col,command,embed,hr,img,input,keygen,link,meta
exports.init = function(parser) { exports.init = function(parser) {
this.parser = parser; this.parser = parser;
// Regexp to match // Regexp to match
this.matchRegExp = /<(_)?([A-Za-z]+)(\s*[^>]*?)(\/)?>/mg; this.matchRegExp = /<(\$)?([A-Za-z]+)(\s*[^>]*?)(\/)?>/mg;
}; };
/* /*
@ -78,7 +78,7 @@ exports.parse = function() {
isBlock = false; isBlock = false;
} }
if(!isSelfClosing && (isWidget || voidElements.indexOf(tagName) === -1)) { if(!isSelfClosing && (isWidget || voidElements.indexOf(tagName) === -1)) {
var reEndString = "(</" + (isWidget ? "_" : "") + tagName + ">)", var reEndString = "(</" + (isWidget ? "\\$" : "") + tagName + ">)",
reEnd = new RegExp(reEndString,"mg"), reEnd = new RegExp(reEndString,"mg"),
content; content;
if(isBlock) { if(isBlock) {

View File

@ -1,7 +1,7 @@
title: $:/templates/PageTemplate title: $:/templates/PageTemplate
<!-- The navigator catches navigation events and updates the story and history tiddlers --> <!-- The navigator catches navigation events and updates the story and history tiddlers -->
<_navigator story="$:/StoryList" history="$:/HistoryList"> <$navigator story="$:/StoryList" history="$:/HistoryList">
<!-- The top navigation bar --> <!-- The top navigation bar -->
<div class="navbar navbar-fixed-top"> <div class="navbar navbar-fixed-top">
@ -23,15 +23,15 @@ title: $:/templates/PageTemplate
<div class="span2"> <div class="span2">
<div style="position:fixed;"> <div style="position:fixed;">
<!-- The navigation menu --> <!-- The navigation menu -->
<_list filter="[list[$:/StoryList]]" history="$:/HistoryList" editTemplate="$:/templates/EditTemplate" listview=classic itemClass="tw-menu-list-item"/> <$list filter="[list[$:/StoryList]]" history="$:/HistoryList" editTemplate="$:/templates/EditTemplate" listview=classic itemClass="tw-menu-list-item"/>
</div> </div>
</div> </div>
<div class="span10"> <div class="span10">
<!-- The main display --> <!-- The main display -->
<_list filter="[list[$:/StoryList]]" history="$:/HistoryList" template="$:/templates/ViewTemplate" editTemplate="$:/templates/EditTemplate" listview=classic itemClass="tw-tiddler-frame"/> <$list filter="[list[$:/StoryList]]" history="$:/HistoryList" template="$:/templates/ViewTemplate" editTemplate="$:/templates/EditTemplate" listview=classic itemClass="tw-tiddler-frame"/>
</div> </div>
</div> </div>
</div> </div>
</_navigator> </$navigator>

View File

@ -2,6 +2,6 @@ title: $:/templates/StaticContent
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
<!-- For Google, and people without JavaScript--> <!-- For Google, and people without JavaScript-->
<_list filter="[!is[shadow]sort[title]]" > <$list filter="[!is[shadow]sort[title]]" >
<_view field="title" format="text"></_view> <$view field="title" format="text"></$view>
</_list> </$list>

View File

@ -1,5 +1,5 @@
title: $:/templates/TagTemplate title: $:/templates/TagTemplate
@@.label @@.label
<_view field="title" format="text" /> <$view field="title" format="text" />
@@ @@

View File

@ -2,18 +2,18 @@ title: $:/templates/ViewTemplate
modifier: JeremyRuston modifier: JeremyRuston
<span class="title"> <span class="title">
<_view field="title"/> <$view field="title"/>
<_button message="tw-close">close</_button> <$button message="tw-close">close</$button>
</span> </span>
<div class="small"> <div class="small">
<_view field="modifier" format="link"/> <$view field="modifier" format="link"/>
<_view field="modified" format="date"/> <$view field="modified" format="date"/>
</div> </div>
@@.tw-tags-wrapper <_list filter="[is[current]tags[]]" template="$:/templates/TagTemplate" />@@ @@.tw-tags-wrapper <$list filter="[is[current]tags[]]" template="$:/templates/TagTemplate" />@@
<div class="body"> <div class="body">
<_view field="text" format="wikified"> <$view field="text" format="wikified">
</_view> </$view>
</div> </div>

View File

@ -4,4 +4,4 @@ title: $:/core/templates/css-tiddler
This template is used for saving CSS tiddlers as a style tag with data attributes representing the tiddler fields. This template is used for saving CSS tiddlers as a style tag with data attributes representing the tiddler fields.
-->`<style`<_fields template=' data-tiddler-$name$="$encoded_value$"'></_fields>` type="text/css">`<_view field="text" format="text" />`</style>` -->`<style`<$fields template=' data-tiddler-$name$="$encoded_value$"'></$fields>` type="text/css">`<$view field="text" format="text" />`</style>`

View File

@ -4,6 +4,6 @@ title: $:/core/templates/html-div-tiddler
This template is used for saving tiddlers as an HTML DIV tag with attributes representing the tiddler fields. This template is used for saving tiddlers as an HTML DIV tag with attributes representing the tiddler fields.
-->`<div`<_fields template=' $name$="$encoded_value$"'></_fields>`> -->`<div`<$fields template=' $name$="$encoded_value$"'></$fields>`>
<pre>`<_view field="text" format="htmlencoded" />`</pre> <pre>`<$view field="text" format="htmlencoded" />`</pre>
</div>` </div>`

View File

@ -4,4 +4,4 @@ title: $:/core/templates/html-tiddler
This template is used for saving tiddlers as raw HTML This template is used for saving tiddlers as raw HTML
--><_view field="text" format="htmlwikified" /> --><$view field="text" format="htmlwikified" />

View File

@ -4,4 +4,4 @@ title: $:/core/templates/javascript-tiddler
This template is used for saving JavaScript tiddlers as a script tag with data attributes representing the tiddler fields. This template is used for saving JavaScript tiddlers as a script tag with data attributes representing the tiddler fields.
-->`<script`<_fields template=' data-tiddler-$name$="$encoded_value$"'></_fields>` type="text/javascript">`<_view field="text" format="text" />`</script>` -->`<script`<$fields template=' data-tiddler-$name$="$encoded_value$"'></$fields>` type="text/javascript">`<$view field="text" format="text" />`</script>`

View File

@ -4,5 +4,5 @@ title: $:/core/templates/module-tiddler
This template is used for saving JavaScript tiddlers as a script tag with data attributes representing the tiddler fields. The body of the tiddler is wrapped in a call to the `$tw.modules.define` function in order to define the body of the tiddler as a module This template is used for saving JavaScript tiddlers as a script tag with data attributes representing the tiddler fields. The body of the tiddler is wrapped in a call to the `$tw.modules.define` function in order to define the body of the tiddler as a module
-->`<script`<_fields template=' data-tiddler-$name$="$encoded_value$"'></_fields>` type="text/javascript" data-module="yes">$tw.modules.define("`<_view field="title" format="jsencoded" />`","`<_view field="module-type" format="jsencoded" />`",function(module,exports,require) {`<_view field="text" format="text" />`}); -->`<script`<$fields template=' data-tiddler-$name$="$encoded_value$"'></$fields>` type="text/javascript" data-module="yes">$tw.modules.define("`<$view field="title" format="jsencoded" />`","`<$view field="module-type" format="jsencoded" />`",function(module,exports,require) {`<$view field="text" format="text" />`});
</script>` </script>`

View File

@ -1,3 +1,3 @@
title: $:/core/templates/plain-text-tiddler title: $:/core/templates/plain-text-tiddler
<_view field="text" format="text" /> <$view field="text" format="text" />