diff --git a/editions/test/tiddlers/tests/data/serialize/BlockRule.tid b/editions/test/tiddlers/tests/data/serialize/BlockRule.tid new file mode 100644 index 000000000..316f745c6 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/BlockRule.tid @@ -0,0 +1,7 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/BlockRule +type: text/vnd.tiddlywiki + +The speed of sound + +The light of speed \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/BoldEmphasis.tid b/editions/test/tiddlers/tests/data/serialize/BoldEmphasis.tid new file mode 100644 index 000000000..2caac9172 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/BoldEmphasis.tid @@ -0,0 +1,5 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/BoldEmphasis +type: text/vnd.tiddlywiki + +This is ''bold'' text \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/CodeBlock.tid b/editions/test/tiddlers/tests/data/serialize/CodeBlock.tid new file mode 100644 index 000000000..8b1499970 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/CodeBlock.tid @@ -0,0 +1,12 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/CodeBlock +type: text/vnd.tiddlywiki + +Simple `JS` and complex + +--- + +```js +var match = reEnd.exec(this.parser.source) +``` +end \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/CommentBlock.tid b/editions/test/tiddlers/tests/data/serialize/CommentBlock.tid new file mode 100644 index 000000000..c90b67c25 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/CommentBlock.tid @@ -0,0 +1,11 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/CommentBlock +type: text/vnd.tiddlywiki + + + +Some text + + + +More text \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/CommentInline.tid b/editions/test/tiddlers/tests/data/serialize/CommentInline.tid new file mode 100644 index 000000000..2d0e98513 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/CommentInline.tid @@ -0,0 +1,5 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/CommentInline +type: text/vnd.tiddlywiki + +This is some text with an inline comment and some more text. \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/Conditional.tid b/editions/test/tiddlers/tests/data/serialize/Conditional.tid new file mode 100644 index 000000000..4e96726f7 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/Conditional.tid @@ -0,0 +1,5 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/Conditional +type: text/vnd.tiddlywiki + +This is a <%if [{something}] %>Elephant<%elseif [{else}] %>Pelican<%else%>Crocodile<%endif%> \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/Dash.tid b/editions/test/tiddlers/tests/data/serialize/Dash.tid new file mode 100644 index 000000000..b0a7ddc55 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/Dash.tid @@ -0,0 +1,7 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/Dash +type: text/vnd.tiddlywiki + +This is an en-dash: -- + +This is an em-dash: --- \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/Entity.tid b/editions/test/tiddlers/tests/data/serialize/Entity.tid new file mode 100644 index 000000000..d8891e4ed --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/Entity.tid @@ -0,0 +1,5 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/Entity +type: text/vnd.tiddlywiki + +This is a copyright symbol: © \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/ExtLink.tid b/editions/test/tiddlers/tests/data/serialize/ExtLink.tid new file mode 100644 index 000000000..de966452f --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/ExtLink.tid @@ -0,0 +1,7 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/ExtLink +type: text/vnd.tiddlywiki + +An external link: https://www.tiddlywiki.com/ + +A suppressed external link: ~http://www.tiddlyspace.com/ \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/FilteredTranscludeBlock.tid b/editions/test/tiddlers/tests/data/serialize/FilteredTranscludeBlock.tid new file mode 100644 index 000000000..cbfc442c5 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/FilteredTranscludeBlock.tid @@ -0,0 +1,9 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/FilteredTranscludeBlock +type: text/vnd.tiddlywiki + +{{{ [tag[docs]] }}} +{{{ [tag[docs]] |tooltip}}} +{{{ [tag[docs]] ||TemplateTitle}}} +{{{ [tag[docs]] |tooltip||TemplateTitle}}} +{{{ [tag[docs]] }}width:40;height:50;}.class.class \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/FilteredTranscludeInline.tid b/editions/test/tiddlers/tests/data/serialize/FilteredTranscludeInline.tid new file mode 100644 index 000000000..8b3155882 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/FilteredTranscludeInline.tid @@ -0,0 +1,5 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/FilteredTranscludeInline +type: text/vnd.tiddlywiki + +{{{ [tag[docs]] }}} {{{ [tag[docs]] |tooltip}}} {{{ [tag[docs]] ||TemplateTitle}}} {{{ [tag[docs]] |tooltip||TemplateTitle}}} {{{ [tag[docs]] }}width:40;height:50;}.class.class \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/FunctionDefinition.tid b/editions/test/tiddlers/tests/data/serialize/FunctionDefinition.tid new file mode 100644 index 000000000..ebd4119a5 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/FunctionDefinition.tid @@ -0,0 +1,15 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/FunctionDefinition +type: text/vnd.tiddlywiki + +\function name(param:defaultvalue,param2:defaultvalue) +definition text +\end + +\procedure name(param:defaultvalue,param2:defaultvalue) +definition text +\end + +\widget $mywidget(param:defaultvalue,param2:defaultvalue) +definition text +\end \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/HardLineBreaks.tid b/editions/test/tiddlers/tests/data/serialize/HardLineBreaks.tid new file mode 100644 index 000000000..b6ea0b985 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/HardLineBreaks.tid @@ -0,0 +1,12 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/HardLineBreaks +type: text/vnd.tiddlywiki + +""" +This is some text +That is set like +It is a Poem +When it is +Clearly +Not +""" diff --git a/editions/test/tiddlers/tests/data/serialize/Heading.tid b/editions/test/tiddlers/tests/data/serialize/Heading.tid new file mode 100644 index 000000000..8f90e379a --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/Heading.tid @@ -0,0 +1,10 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/Heading +type: text/vnd.tiddlywiki + +! Heading 1 +!! Heading 2 +!!! Heading 3 +!!!! Heading 4 +!!!!! Heading 5 +!!!!!! Heading 6 \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/Html.tid b/editions/test/tiddlers/tests/data/serialize/Html.tid new file mode 100644 index 000000000..05507eb56 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/Html.tid @@ -0,0 +1,11 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/Html +type: text/vnd.tiddlywiki + + + +<$slider target="MyTiddler"> +This is a widget invocation + \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/Image.tid b/editions/test/tiddlers/tests/data/serialize/Image.tid new file mode 100644 index 000000000..8641df4cb --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/Image.tid @@ -0,0 +1,10 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/Image +type: text/vnd.tiddlywiki + +[img[https://tiddlywiki.com/fractalveg.jpg]] +[img width="23" height="24" [https://tiddlywiki.com/fractalveg.jpg]] +[img width={{!!width}} height={{!!height}} [https://tiddlywiki.com/fractalveg.jpg]] +[img[Description of image|https://tiddlywiki.com/fractalveg.jpg]] +[img[TiddlerTitle]] +[img[Description of image|TiddlerTitle]] \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/Import.tid b/editions/test/tiddlers/tests/data/serialize/Import.tid new file mode 100644 index 000000000..e467de534 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/Import.tid @@ -0,0 +1,6 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/Import +type: text/vnd.tiddlywiki + +\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] +\import [[$:/core/ui/PageMacros]] \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/ItalicEmphasis.tid b/editions/test/tiddlers/tests/data/serialize/ItalicEmphasis.tid new file mode 100644 index 000000000..a06ca62ce --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/ItalicEmphasis.tid @@ -0,0 +1,5 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/ItalicEmphasis +type: text/vnd.tiddlywiki + +This is //italic// text \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/List.tid b/editions/test/tiddlers/tests/data/serialize/List.tid new file mode 100644 index 000000000..d4088bcce --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/List.tid @@ -0,0 +1,27 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/List +type: text/vnd.tiddlywiki + +* This is an unordered list +* It has two items + +# This is a numbered list +## With a subitem +# And a third item + +; This is a term that is being defined +: This is the definition of that term + +#** One +#* Two +#** Three +#**** Four +#**# Five +#**## Six +## Seven +### Eight +## Nine + +* List item one +*.active List item two has the class `active` +* List item three \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/MacroCallBlock.tid b/editions/test/tiddlers/tests/data/serialize/MacroCallBlock.tid new file mode 100644 index 000000000..723e23edd --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/MacroCallBlock.tid @@ -0,0 +1,7 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/MacroCallBlock +type: text/vnd.tiddlywiki + +<> + +<<.def "macro calls">> \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/MacroCallInline.tid b/editions/test/tiddlers/tests/data/serialize/MacroCallInline.tid new file mode 100644 index 000000000..0b6b4fc50 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/MacroCallInline.tid @@ -0,0 +1,5 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/MacroCallInline +type: text/vnd.tiddlywiki + +These are macro calls in a line: <> and <<.def "macro calls">> \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/MacroDef.tid b/editions/test/tiddlers/tests/data/serialize/MacroDef.tid new file mode 100644 index 000000000..dcbc02e9d --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/MacroDef.tid @@ -0,0 +1,7 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/MacroDef +type: text/vnd.tiddlywiki + +\define name(param:defaultvalue,param2:defaultvalue) +definition text, including $param$ markers +\end \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/Parameters.tid b/editions/test/tiddlers/tests/data/serialize/Parameters.tid new file mode 100644 index 000000000..5b107a73d --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/Parameters.tid @@ -0,0 +1,5 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/Parameters +type: text/vnd.tiddlywiki + +\parameters(param:defaultvalue,param2:defaultvalue) \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/ParserMode.tid b/editions/test/tiddlers/tests/data/serialize/ParserMode.tid new file mode 100644 index 000000000..b4c31b66b --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/ParserMode.tid @@ -0,0 +1,9 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/ParserMode +type: text/vnd.tiddlywiki + +\parsermode block + +\parsermode inline + +Test. \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/PrettyExtLink.tid b/editions/test/tiddlers/tests/data/serialize/PrettyExtLink.tid new file mode 100644 index 000000000..1b4002b94 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/PrettyExtLink.tid @@ -0,0 +1,6 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/PrettyExtLink +type: text/vnd.tiddlywiki + +[ext[https://tiddlywiki.com/fractalveg.jpg]] +[ext[Tooltip|https://tiddlywiki.com/fractalveg.jpg]] \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/PrettyLink.tid b/editions/test/tiddlers/tests/data/serialize/PrettyLink.tid new file mode 100644 index 000000000..8c7afbc7f --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/PrettyLink.tid @@ -0,0 +1,6 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/PrettyLink +type: text/vnd.tiddlywiki + +[[Introduction]] +[[Link description|TiddlerTitle]] \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/QuoteBlock.tid b/editions/test/tiddlers/tests/data/serialize/QuoteBlock.tid new file mode 100644 index 000000000..a2f698846 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/QuoteBlock.tid @@ -0,0 +1,7 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/QuoteBlock +type: text/vnd.tiddlywiki + +<<` around this list will also have the class `myClass` +* List item 2 +@@ + +@@font-size:1.5em; +@@.coloured-text.coloured-bg +* Block content +* With custom style and classes +@@ \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/StyleBlock2.tid b/editions/test/tiddlers/tests/data/serialize/StyleBlock2.tid new file mode 100644 index 000000000..cdd31254e --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/StyleBlock2.tid @@ -0,0 +1,13 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/StyleBlock2 +type: text/vnd.tiddlywiki + +@@width:100px; +@@.myFirstClass.mySecondClass.myThirdClass +This is a paragraph +@@ + +@@background-color:lightcyan; +* Item one +* Item two +@@ \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/StyleInline.tid b/editions/test/tiddlers/tests/data/serialize/StyleInline.tid new file mode 100644 index 000000000..c491767f5 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/StyleInline.tid @@ -0,0 +1,7 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/StyleInline +type: text/vnd.tiddlywiki + +@@.myClass This is some text with a class@@ +@@background-color:red; This is some text with a background colour@@ +@@width:100px;.myClass This is some text with a class and a width@@ \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/SubscriptEmphasis.tid b/editions/test/tiddlers/tests/data/serialize/SubscriptEmphasis.tid new file mode 100644 index 000000000..b39d7f6d5 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/SubscriptEmphasis.tid @@ -0,0 +1,5 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/SubscriptEmphasis +type: text/vnd.tiddlywiki + +This is ,,subscript,, text \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/SuperscriptEmphasis.tid b/editions/test/tiddlers/tests/data/serialize/SuperscriptEmphasis.tid new file mode 100644 index 000000000..9683f9e54 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/SuperscriptEmphasis.tid @@ -0,0 +1,5 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/SuperscriptEmphasis +type: text/vnd.tiddlywiki + +This is ^^superscript^^ text \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/SysLink.tid b/editions/test/tiddlers/tests/data/serialize/SysLink.tid new file mode 100644 index 000000000..fdbc982fe --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/SysLink.tid @@ -0,0 +1,6 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/SysLink +type: text/vnd.tiddlywiki + +$:TiddlerTitle +~$:TiddlerTitle \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/Table.tid b/editions/test/tiddlers/tests/data/serialize/Table.tid new file mode 100644 index 000000000..213ecebff --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/Table.tid @@ -0,0 +1,8 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/Table +type: text/vnd.tiddlywiki + +|! |!Alpha |!Beta |!Gamma |!Delta | +|!One | | | | | +|!Two | | | | | +|!Three | | | | | \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/TranscludeBlock.tid b/editions/test/tiddlers/tests/data/serialize/TranscludeBlock.tid new file mode 100644 index 000000000..344171af0 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/TranscludeBlock.tid @@ -0,0 +1,21 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/TranscludeBlock +type: text/vnd.tiddlywiki + +{{MyTiddler}} + +{{MyTiddler||TemplateTitle}} + +{{||TemplateTitle}} + +{{MyTiddler|Parameter}} + +{{MyTiddler||TemplateTitle|Parameter|SecondParameter}} + +{{MyTiddler!!field}} + +{{!!field}} + +{{MyTiddler##index}} + +{{##index}} \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/TranscludeInline.tid b/editions/test/tiddlers/tests/data/serialize/TranscludeInline.tid new file mode 100644 index 000000000..df20658cf --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/TranscludeInline.tid @@ -0,0 +1,5 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/TranscludeInline +type: text/vnd.tiddlywiki + +{{MyTiddler}} {{MyTiddler||TemplateTitle}} \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/TypedBlock1.tid b/editions/test/tiddlers/tests/data/serialize/TypedBlock1.tid new file mode 100644 index 000000000..06362d062 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/TypedBlock1.tid @@ -0,0 +1,15 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/TypedBlock1 +type: text/vnd.tiddlywiki + +$$$text/vnd.tiddlywiki > text/plain +This is ''some'' wikitext +$$$ + +$$$text/unknown +Some plain text, which will not be //formatted//. + +$$$text/vnd.tiddlywiki > text/html +This is ''some'' wikitext +$$$ + diff --git a/editions/test/tiddlers/tests/data/serialize/TypedBlock2.tid b/editions/test/tiddlers/tests/data/serialize/TypedBlock2.tid new file mode 100644 index 000000000..082ca533a --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/TypedBlock2.tid @@ -0,0 +1,19 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/TypedBlock2 +type: text/vnd.tiddlywiki + +$$$.js +This will be rendered as JavaScript +$$$ + +$$$.svg + + + +$$$ + +$$$image/svg+xml + + + +$$$ \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/UnderscoreEmphasis.tid b/editions/test/tiddlers/tests/data/serialize/UnderscoreEmphasis.tid new file mode 100644 index 000000000..73dc6425c --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/UnderscoreEmphasis.tid @@ -0,0 +1,5 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/UnderscoreEmphasis +type: text/vnd.tiddlywiki + +This is __underscore__ text \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/WikiLink.tid b/editions/test/tiddlers/tests/data/serialize/WikiLink.tid new file mode 100644 index 000000000..18b04caf1 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/WikiLink.tid @@ -0,0 +1,7 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/WikiLink +type: text/vnd.tiddlywiki + +AWikiLink +AnotherLink +~SuppressedLink \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/serialize/WikiLinkPrefix.tid b/editions/test/tiddlers/tests/data/serialize/WikiLinkPrefix.tid new file mode 100644 index 000000000..982ed9071 --- /dev/null +++ b/editions/test/tiddlers/tests/data/serialize/WikiLinkPrefix.tid @@ -0,0 +1,5 @@ +tags: $:/tags/wikitext-serialize-test-spec +title: Serialize/WikiLinkPrefix +type: text/vnd.tiddlywiki + +~SuppressedLink \ No newline at end of file diff --git a/editions/test/tiddlers/tests/test-wikitext-serialize.js b/editions/test/tiddlers/tests/test-wikitext-serialize.js index a8431694a..e9c6f97cf 100644 --- a/editions/test/tiddlers/tests/test-wikitext-serialize.js +++ b/editions/test/tiddlers/tests/test-wikitext-serialize.js @@ -8,402 +8,11 @@ Tests the wikitext inverse-rendering from Wiki AST. \*/ describe("WikiAST serialization unit tests", function () { - var wiki = new $tw.Wiki(); - - wiki.addTiddler({ - title: "BoldEmphasisTest", - text: "This is ''bold'' text", - }); - it("should serialize bold emphasis correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("BoldEmphasisTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("BoldEmphasisTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "ItalicEmphasisTest", - text: "This is //italic// text", - }); - it("should serialize italic emphasis correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("ItalicEmphasisTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("ItalicEmphasisTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "StrikethroughEmphasisTest", - text: "This is ~~strikethrough~~ text", - }); - it("should serialize strikethrough emphasis correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("StrikethroughEmphasisTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("StrikethroughEmphasisTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "SubscriptEmphasisTest", - text: "This is ,,subscript,, text", - }); - it("should serialize subscript emphasis correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("SubscriptEmphasisTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("SubscriptEmphasisTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "SuperscriptEmphasisTest", - text: "This is ^^superscript^^ text", - }); - it("should serialize superscript emphasis correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("SuperscriptEmphasisTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("SuperscriptEmphasisTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "UnderscoreEmphasisTest", - text: "This is __underscore__ text", - }); - it("should serialize underscore emphasis correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("UnderscoreEmphasisTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("UnderscoreEmphasisTest").trimEnd()); - }); - - wiki.addTiddler({ title: "SimpleTextTest", text: "The quick brown fox" }); - it("should render tiddlers with no special markup as-is", function () { - // `trimEnd` because when we handle `p` element when parsing block rules, we always add a newline. But original text that may not have a trailing newline, will still be recognized as a block. - expect($tw.utils.serializeParseTree(wiki.parseTiddler("SimpleTextTest").tree).trimEnd()).toBe( - wiki.getTiddlerText("SimpleTextTest") - ); - }); - - wiki.addTiddler({ title: "SoftLineBreakTest", text: "The rain in Spain\nfalls mainly on the plain" }); - it("should preserve single new lines", function () { - expect($tw.utils.serializeParseTree(wiki.parseTiddler("SoftLineBreakTest").tree).trimEnd()).toBe( - wiki.getTiddlerText("SoftLineBreakTest") - ); - }); - - wiki.addTiddler({ title: "BlockRule", text: "The speed of sound\n\nThe light of speed" }); - it("should preserve double new lines to create paragraphs", function () { - expect($tw.utils.serializeParseTree(wiki.parseTiddler("BlockRule").tree).trimEnd()).toBe( - wiki.getTiddlerText("BlockRule") - ); - }); - - wiki.addTiddler({ - title: "CodeBlockTest", - text: "Simple `JS` and complex\n\n---\n\n```js\nvar match = reEnd.exec(this.parser.source)\n```\nend", - }); - it("should render inline code and block code", function () { - expect($tw.utils.serializeParseTree(wiki.parseTiddler("CodeBlockTest").tree).trimEnd()).toBe( - wiki.getTiddlerText("CodeBlockTest") - ); - }); - - wiki.addTiddler({ - title: "CommentBlockTest", - text: "\n\nSome text\n\n\n\nMore text", - }); - it("should serialize block comments correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("CommentBlockTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("CommentBlockTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "CommentInlineTest", - text: "This is some text with an inline comment and some more text.", - }); - it("should serialize inline comments correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("CommentInlineTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("CommentInlineTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "ConditionalTest", - text: "This is a <%if [{something}] %>Elephant<%elseif [{else}] %>Pelican<%else%>Crocodile<%endif%>", - }); - it("should serialize conditional statements correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("ConditionalTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("ConditionalTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "DashTest", - text: "This is an en-dash: --\n\nThis is an em-dash: ---", - }); - it("should serialize dashes correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("DashTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("DashTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "EntityTest", - text: "This is a copyright symbol: ©", - }); - it("should serialize HTML entities correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("EntityTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("EntityTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "ExtLinkTest", - text: "An external link: https://www.tiddlywiki.com/\n\nA suppressed external link: ~http://www.tiddlyspace.com/", - }); - it("should serialize external links correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("ExtLinkTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("ExtLinkTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "FilteredTranscludeBlockTest", - text: "{{{ [tag[docs]] }}}\n{{{ [tag[docs]] |tooltip}}}\n{{{ [tag[docs]] ||TemplateTitle}}}\n{{{ [tag[docs]] |tooltip||TemplateTitle}}}\n{{{ [tag[docs]] }}width:40;height:50;}.class.class", - }); - it("should serialize block-level filtered transclusion correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("FilteredTranscludeBlockTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("FilteredTranscludeBlockTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "FilteredTranscludeInlineTest", - text: "{{{ [tag[docs]] }}} {{{ [tag[docs]] |tooltip}}} {{{ [tag[docs]] ||TemplateTitle}}} {{{ [tag[docs]] |tooltip||TemplateTitle}}} {{{ [tag[docs]] }}width:40;height:50;}.class.class", - }); - it("should serialize inline filtered transclusion correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("FilteredTranscludeInlineTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("FilteredTranscludeInlineTest").trimEnd()); - }); - - // Test case based on the rule code's comment - wiki.addTiddler({ - title: "FunctionDefinition", - text: "\\function name(param:defaultvalue,param2:defaultvalue)\ndefinition text\n\\end\n\n\\procedure name(param:defaultvalue,param2:defaultvalue)\ndefinition text\n\\end\n\n\\widget $mywidget(param:defaultvalue,param2:defaultvalue)\ndefinition text\n\\end", - }); - it("should serialize function, procedure, and widget definitions correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("FunctionDefinition").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("FunctionDefinition").trimEnd()); - }); - - wiki.addTiddler({ - title: "HardLineBreaksTest", - text: '"""\nThis is some text\nThat is set like\nIt is a Poem\nWhen it is\nClearly\nNot\n"""\n', - }); - it("should serialize hard line breaks correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("HardLineBreaksTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("HardLineBreaksTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "HeadingTest", - text: "! Heading 1\n!! Heading 2\n!!! Heading 3\n!!!! Heading 4\n!!!!! Heading 5\n!!!!!! Heading 6", - }); - it("should serialize headings correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("HeadingTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("HeadingTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "HtmlTest", - text: '\n\n<$slider target="MyTiddler">\nThis is a widget invocation\n', - }); - it("should serialize HTML elements and widgets correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("HtmlTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("HtmlTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "ImageTest", - text: '[img[https://tiddlywiki.com/fractalveg.jpg]]\n[img width="23" height="24" [https://tiddlywiki.com/fractalveg.jpg]]\n[img width={{!!width}} height={{!!height}} [https://tiddlywiki.com/fractalveg.jpg]]\n[img[Description of image|https://tiddlywiki.com/fractalveg.jpg]]\n[img[TiddlerTitle]]\n[img[Description of image|TiddlerTitle]]', - }); - it("should serialize image tags correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("ImageTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("ImageTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "ImportTest", - text: "\\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]\n\\import [[$:/core/ui/PageMacros]]", - }); - it("should serialize import pragma correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("ImportTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("ImportTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "ListTest", - text: "* This is an unordered list\n* It has two items\n\n# This is a numbered list\n## With a subitem\n# And a third item\n\n; This is a term that is being defined\n: This is the definition of that term\n\n#** One\n#* Two\n#** Three\n#**** Four\n#**# Five\n#**## Six\n## Seven\n### Eight\n## Nine\n\n* List item one\n*.active List item two has the class `active`\n* List item three", - }); - it("should serialize lists correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("ListTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("ListTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "MacroCallBlockTest", - text: '<>\n\n<<.def "macro calls">>', - }); - it("should serialize block macro calls correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("MacroCallBlockTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("MacroCallBlockTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "MacroCallInlineTest", - text: 'These are macro calls in a line: <> and <<.def "macro calls">>', - }); - it("should serialize inline macro calls correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("MacroCallInlineTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("MacroCallInlineTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "MacroDefTest", - text: "\\define name(param:defaultvalue,param2:defaultvalue)\ndefinition text, including $param$ markers\n\\end", - }); - it("should serialize macro definitions correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("MacroDefTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("MacroDefTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "ParametersTest", - text: "\\parameters(param:defaultvalue,param2:defaultvalue)", - }); - it("should serialize parameter definitions correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("ParametersTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("ParametersTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "ParserModeTest", - text: "\\parsermode block\n\n\\parsermode inline\n\nTest.", - }); - it("should serialize parser mode specifications correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("ParserModeTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("ParserModeTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "PrettyExtLinkTest", - text: "[ext[https://tiddlywiki.com/fractalveg.jpg]]\n[ext[Tooltip|https://tiddlywiki.com/fractalveg.jpg]]", - }); - it("should serialize pretty external links correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("PrettyExtLinkTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("PrettyExtLinkTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "PrettyLinkTest", - text: "[[Introduction]]\n[[Link description|TiddlerTitle]]", - }); - it("should serialize pretty links correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("PrettyLinkTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("PrettyLinkTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "QuoteBlockTest", - text: "<<` around this list will also have the class `myClass`\n* List item 2\n@@\n\n@@font-size:1.5em;\n@@.coloured-text.coloured-bg\n* Block content\n* With custom style and classes\n@@", - }); - wiki.addTiddler({ - title: "StyleBlockTest2", - text: "@@width:100px;\n@@.myFirstClass.mySecondClass.myThirdClass\nThis is a paragraph\n@@\n\n@@background-color:lightcyan;\n* Item one\n* Item two\n@@", - }); - it("should serialize style blocks correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("StyleBlockTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("StyleBlockTest").trimEnd()); - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("StyleBlockTest2").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("StyleBlockTest2").trimEnd()); - }); - - wiki.addTiddler({ - title: "StyleInlineTest", - text: "@@.myClass This is some text with a class@@\n@@background-color:red; This is some text with a background colour@@\n@@width:100px;.myClass This is some text with a class and a width@@", - }); - it("should serialize style inlines correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("StyleInlineTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("StyleInlineTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "SysLinkTest", - text: "$:TiddlerTitle\n~$:TiddlerTitle", - }); - it("should serialize system links correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("SysLinkTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("SysLinkTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "TableTest", - text: "|! |!Alpha |!Beta |!Gamma |!Delta |\n|!One | | | | |\n|!Two | | | | |\n|!Three | | | | |", - }); - it("should serialize tables correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("TableTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("TableTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "TranscludeBlockTest", - text: "{{MyTiddler}}\n\n{{MyTiddler||TemplateTitle}}\n\n{{||TemplateTitle}}\n\n{{MyTiddler|Parameter}}\n\n{{MyTiddler||TemplateTitle|Parameter|SecondParameter}}\n\n{{MyTiddler!!field}}\n\n{{!!field}}\n\n{{MyTiddler##index}}\n\n{{##index}}", - }); - it("should serialize block-level transclusions correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("TranscludeBlockTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("TranscludeBlockTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "TranscludeInlineTest", - text: "{{MyTiddler}} {{MyTiddler||TemplateTitle}}", - }); - it("should serialize inline-level transclusions correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("TranscludeInlineTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("TranscludeInlineTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "TypedBlockTest1", - text: "$$$text/vnd.tiddlywiki > text/plain\nThis is ''some'' wikitext\n$$$\n\n$$$text/unknown\nSome plain text, which will not be //formatted//.\n\n$$$text/vnd.tiddlywiki > text/html\nThis is ''some'' wikitext\n$$$\n\n", - }); - wiki.addTiddler({ - title: "TypedBlockTest2", - text: '$$$.js\nThis will be rendered as JavaScript\n$$$\n\n$$$.svg\n\n \n\n$$$\n\n$$$image/svg+xml\n\n \n\n$$$', - }); - - it("should serialize typed blocks correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("TypedBlockTest1").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("TypedBlockTest1").trimEnd()); - serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("TypedBlockTest2").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("TypedBlockTest2").trimEnd()); - }); - - wiki.addTiddler({ - title: "WikiLinkTest", - text: "AWikiLink\nAnotherLink\n~SuppressedLink", - }); - it("should serialize wiki links correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("WikiLinkTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("WikiLinkTest").trimEnd()); - }); - - wiki.addTiddler({ - title: "WikiLinkPrefixTest", - text: "~SuppressedLink", - }); - it("should serialize suppressed wiki links correctly", function () { - var serialized = $tw.utils.serializeParseTree(wiki.parseTiddler("WikiLinkPrefixTest").tree).trimEnd(); - expect(serialized).toBe(wiki.getTiddlerText("WikiLinkPrefixTest").trimEnd()); + var cases = $tw.wiki.filterTiddlers("[all[shadows+tiddlers]tag[$:/tags/wikitext-serialize-test-spec]]"); + $tw.utils.each(cases, function (title) { + it("should serialize correctly for " + title, function () { + var serialized = $tw.utils.serializeParseTree($tw.wiki.parseTiddler(title).tree).trimEnd(); + expect(serialized).toBe($tw.wiki.getTiddlerText(title).trimEnd()); + }); }); });