mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-08 23:03:50 +00:00
Added parser rule for HTML format comments
And try it out in the PageTemplate, which is getting pretty unintelligable
This commit is contained in:
parent
1f64a9e758
commit
1f52b40cb6
33
core/modules/parsers/newwikitextparser/rules/comment.js
Normal file
33
core/modules/parsers/newwikitextparser/rules/comment.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/parsers/newwikitextparser/rules/comment.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: wikitextrule
|
||||||
|
|
||||||
|
Wiki text run rule for HTML comments. For example:
|
||||||
|
|
||||||
|
{{{
|
||||||
|
<!-- This is a comment -->
|
||||||
|
}}}
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports.name = "comment";
|
||||||
|
|
||||||
|
exports.blockParser = true;
|
||||||
|
exports.runParser = true;
|
||||||
|
|
||||||
|
// Regexp by Stephen Ostermiller, http://ostermiller.org/findhtmlcomment.html
|
||||||
|
|
||||||
|
exports.regExpString = "\\<![ \\r\\n\\t]*(?:--(?:[^\\-]|[\\r\\n]|-[^\\-])*--[ \\r\\n\\t]*)\\>";
|
||||||
|
|
||||||
|
exports.parse = function(match,isBlock) {
|
||||||
|
this.pos = match.index + match[0].length;
|
||||||
|
return this.parseBlock();
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
@ -1,31 +1,39 @@
|
|||||||
title: $:/templates/PageTemplate
|
title: $:/templates/PageTemplate
|
||||||
|
|
||||||
|
<!-- The navigator catches navigation events and updates the story and history tiddlers -->
|
||||||
<<navigator story:"$:/StoryTiddlers" history:"$:/History" ><
|
<<navigator story:"$:/StoryTiddlers" history:"$:/History" ><
|
||||||
|
|
||||||
|
<!-- Zooming chooser -->
|
||||||
{{navigation-panel{
|
{{navigation-panel{
|
||||||
<<chooser><
|
<<chooser><
|
||||||
<<list all>>
|
<<list all>>
|
||||||
>>
|
>>
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
|
<!-- Zooming navigator -->
|
||||||
<<zoomer>>
|
<<zoomer>>
|
||||||
|
|
||||||
|
<!-- The top navigation bar -->
|
||||||
<div class="navbar navbar-fixed-top">
|
<div class="navbar navbar-fixed-top">
|
||||||
<div class="navbar-inner">
|
<div class="navbar-inner">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{{nav{
|
{{nav{
|
||||||
|
|
||||||
|
<!-- Navigation menu -->
|
||||||
* HelloThere
|
* HelloThere
|
||||||
* [[Docs]]
|
* [[Docs]]
|
||||||
*{{divider-vertical}}
|
*{{divider-vertical}}
|
||||||
|
|
||||||
|
<!-- View button -->
|
||||||
<<button popup:ViewDropDownState class:"btn btn-danger"><View <span class="caret"></span>>>
|
<<button popup:ViewDropDownState class:"btn btn-danger"><View <span class="caret"></span>>>
|
||||||
|
|
||||||
|
<!-- View dropdown -->
|
||||||
{{pull-right{
|
{{pull-right{
|
||||||
<<reveal state:[[$:/EditMode]] type:nomatch text:yes><
|
<<reveal state:[[$:/EditMode]] type:nomatch text:yes><
|
||||||
<<button modal param:[[$:/messages/EnterEditMode]] set:[[$:/EditMode]] setTo:yes class:"btn btn-success"><Edit>>
|
<<button modal param:[[$:/messages/EnterEditMode]] set:[[$:/EditMode]] setTo:yes class:"btn btn-success"><Edit>>
|
||||||
>>
|
>>
|
||||||
|
|
||||||
|
<!-- Save changes is only visible in edit mode -->
|
||||||
<<reveal state:[[$:/EditMode]] type:match text:yes><
|
<<reveal state:[[$:/EditMode]] type:match text:yes><
|
||||||
<<button save-wiki class:"btn pull-right"><Save Changes>>
|
<<button save-wiki class:"btn pull-right"><Save Changes>>
|
||||||
>>
|
>>
|
||||||
@ -33,6 +41,7 @@ title: $:/templates/PageTemplate
|
|||||||
|
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
|
<!-- This navigator intercepts navigation events and sets the text of the specified tiddler to the target tiddler title -->
|
||||||
<<navigator set:[[$:/CurrentView]]><
|
<<navigator set:[[$:/CurrentView]]><
|
||||||
<<reveal state:ViewDropDownState type:popup position:below><
|
<<reveal state:ViewDropDownState type:popup position:below><
|
||||||
<div class="open">
|
<div class="open">
|
||||||
@ -48,6 +57,7 @@ title: $:/templates/PageTemplate
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- The main story references the same story and history tiddlers as the outer navigator -->
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<<story story:"$:/StoryTiddlers" history:"$:/History" storyviewTiddler:[[$:/CurrentView]] storyview:classic >>
|
<<story story:"$:/StoryTiddlers" history:"$:/History" storyviewTiddler:[[$:/CurrentView]] storyview:classic >>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user