From 9c0d6a46ccfbb608312402fee111c7c0707fb282 Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Mon, 14 Jun 2021 18:39:56 +0200 Subject: [PATCH] Add "commentpragma" html style rule (#5726) * html-comment, that can be used in the pragma area * add commentpragma test * fix typo * fix typo and change comments ab bit * combine html-comment and pragma-comment and add some docs, how to use it * Make docs simpler by removing caching info * change h2 wording --- .../parsers/wikiparser/rules/commentblock.js | 8 ++++++- .../tiddlers/tests/test-wikitext-parser.js | 7 +++++++ .../tiddlers/wikitext/HTML in WikiText.tid | 21 +++++++++++++++++-- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/core/modules/parsers/wikiparser/rules/commentblock.js b/core/modules/parsers/wikiparser/rules/commentblock.js index b7651c272..1c303f38f 100644 --- a/core/modules/parsers/wikiparser/rules/commentblock.js +++ b/core/modules/parsers/wikiparser/rules/commentblock.js @@ -7,6 +7,12 @@ Wiki text block rule for HTML comments. For example: ``` +\define macroX() + +xxxx +\end + + ``` Note that the syntax for comments is simplified to an opening "" sequence -- HTML itself implements a more complex format (see http://ostermiller.org/findhtmlcomment.html) @@ -19,7 +25,7 @@ Note that the syntax for comments is simplified to an opening "\n\\define aMacro()\nnothing\n\\end\n")).toEqual( + + [ { type : 'set', attributes : { name : { type : 'string', value : 'aMacro' }, value : { type : 'string', value : 'nothing' } }, children : [ ], params : [ ], isMacroDefinition : true } ] + + ); }); it("should parse inline macro calls", function() { diff --git a/editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid b/editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid index 412963adc..ec19e8a84 100644 --- a/editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid +++ b/editions/tw5.com/tiddlers/wikitext/HTML in WikiText.tid @@ -1,10 +1,12 @@ caption: HTML created: 20131205160816081 -modified: 20201125094415933 +modified: 20210614100305329 tags: WikiText title: HTML in WikiText type: text/vnd.tiddlywiki +! HTML tags and comments + HTML tags and comments can be used directly in WikiText. For example: ``` @@ -14,7 +16,22 @@ This is my nice and simple block of text. HelloThere ``` -[[Widgets share the same syntax as HTML tags|Widgets in WikiText]], and so the following information applies to them, too. +!! Pragma Comments + +<<.from-version 5.2.0>> Comments can now be freely intermixed with pragmas as well as within the main body of a block of wikitext. + +``` + +\define test() +some text +\end + +<> +``` + +! Important + +<<.tip """[[Widgets share the same syntax as HTML tags|Widgets in WikiText]], and so the following information applies to them, too.""">> ! Block mode versus Inline mode