mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
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
This commit is contained in:
parent
06318b7617
commit
9c0d6a46cc
@ -7,6 +7,12 @@ Wiki text block rule for HTML comments. For example:
|
||||
|
||||
```
|
||||
<!-- This is a comment -->
|
||||
\define macroX()
|
||||
<!-- This is a comment -->
|
||||
xxxx
|
||||
\end
|
||||
<!-- This is a comment -->
|
||||
|
||||
```
|
||||
|
||||
Note that the syntax for comments is simplified to an opening "<!--" sequence and a closing "-->" 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 "<!--" sequence an
|
||||
"use strict";
|
||||
|
||||
exports.name = "commentblock";
|
||||
exports.types = {block: true};
|
||||
exports.types = {block:true, pragma:true};
|
||||
|
||||
exports.init = function(parser) {
|
||||
this.parser = parser;
|
||||
|
@ -117,7 +117,14 @@ describe("WikiText parser tests", function() {
|
||||
[ { type : 'set', attributes : { name : { type : 'string', value : 'myMacro' }, value : { type : 'string', value : 'nothing' } }, children : [ ], params : [ ], isMacroDefinition : true } ]
|
||||
|
||||
);
|
||||
});
|
||||
|
||||
it("should parse comment in pragma area. Comment will be INVISIBLE", function() {
|
||||
expect(parse("<!-- comment in pragma area -->\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() {
|
||||
|
@ -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
|
||||
</article>
|
||||
```
|
||||
|
||||
[[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.
|
||||
|
||||
```
|
||||
<!-- NEW: Comment that describes the macro -->
|
||||
\define test()
|
||||
some text <!-- inline comment -->
|
||||
\end
|
||||
|
||||
<<test>>
|
||||
```
|
||||
|
||||
! 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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user