From f1299120a6a62a7ca5fb7d224c1d2bd758bd7595 Mon Sep 17 00:00:00 2001 From: Joshua Fontany Date: Wed, 15 May 2024 04:25:02 -0700 Subject: [PATCH] Block Quotes - fix parsing error with spaces before reEndString (#8186) * fix parsing error with spaces before reEndString, update docs to clarify block mode inside block quotes. * additional advanced example * oops, convert spaces back to tabs. * reset indentation * final tabs * missed some * wikitext classes are appended to other leading wikitext, no need to skip whitespace here. --- .../parsers/wikiparser/rules/quoteblock.js | 30 ++--------------- .../wikitext/Block Quotes in WikiText.tid | 33 ++++++++++++++++++- .../wikitext/Hard Linebreaks in WikiText.tid | 10 ++++-- .../wikitext/parser/Block Mode WikiText.tid | 4 +-- 4 files changed, 44 insertions(+), 33 deletions(-) diff --git a/core/modules/parsers/wikiparser/rules/quoteblock.js b/core/modules/parsers/wikiparser/rules/quoteblock.js index 71b689680..787b7e30f 100644 --- a/core/modules/parsers/wikiparser/rules/quoteblock.js +++ b/core/modules/parsers/wikiparser/rules/quoteblock.js @@ -3,30 +3,7 @@ title: $:/core/modules/parsers/wikiparser/rules/quoteblock.js type: application/javascript module-type: wikirule -Wiki text rule for quote blocks. For example: - -``` - <<<.optionalClass(es) optional cited from - a quote - <<< - - <<<.optionalClass(es) - a quote - <<< optional cited from -``` - -Quotes can be quoted by putting more 0) { tree.unshift({ diff --git a/editions/tw5.com/tiddlers/wikitext/Block Quotes in WikiText.tid b/editions/tw5.com/tiddlers/wikitext/Block Quotes in WikiText.tid index 181779fe9..5e2a368f4 100644 --- a/editions/tw5.com/tiddlers/wikitext/Block Quotes in WikiText.tid +++ b/editions/tw5.com/tiddlers/wikitext/Block Quotes in WikiText.tid @@ -1,6 +1,6 @@ caption: Block Quotes created: 20131206154636572 -modified: 20170417165145317 +modified: 20240512000910702 tags: WikiText title: Block Quotes in WikiText type: text/vnd.tiddlywiki @@ -72,3 +72,34 @@ You can also mix block quotes with other list items. For example: **> Another quote * List Three ">> + +! Advanced Wikitext and Block Quotes +You can also mix block quotes with paragraphs and other block wikitext. Be mindful of block mode - if other quoted content follows a paragraph, end it with a blank line. The final paragraph in the quote does not need to end with a blank line. If using indentation, make sure __not to indent the blank lines__. The parser will interpret this as additional inline content and not return to block mode. For example: + +< A quote +""" +A poem +with line beaks +needs to have +a blank line after +the final quotes +if followed +by other content +""" + + <<<< Deep Block Quote + A paragraph before other //wikitext//, which ends with a blank line. + + ! A Header + Another paragraph, which needs to end with a blank line. + + !! Sub Header + A final paragraph, which __does not__ need to end with a blank line as the Block Quote ends. + <<<< +<<< +'>> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/wikitext/Hard Linebreaks in WikiText.tid b/editions/tw5.com/tiddlers/wikitext/Hard Linebreaks in WikiText.tid index c49b866ce..b7f05756f 100644 --- a/editions/tw5.com/tiddlers/wikitext/Hard Linebreaks in WikiText.tid +++ b/editions/tw5.com/tiddlers/wikitext/Hard Linebreaks in WikiText.tid @@ -1,9 +1,9 @@ +caption: Hard Linebreaks created: 20131214165710101 -modified: 20131214170106553 +modified: 20240512001649319 tags: WikiText title: Hard Linebreaks in WikiText type: text/vnd.tiddlywiki -caption: Hard Linebreaks The usual handling of [[paragraphs in wikitext|Paragraphs in WikiText]] causes single line breaks to be ignored, and double linebreaks to be interpreted as the end of a paragraph. @@ -15,4 +15,8 @@ and this is a new line while this is yet another line and this is the final one apart from this one -"""'>> +""" + +'>> + +<<.tip 'Note: Hard Linebreaks in ~WikiText require an extra blank line after the trailing `"""` before the parser will return to [[block mode|Block Mode WikiText]].'>>. \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/wikitext/parser/Block Mode WikiText.tid b/editions/tw5.com/tiddlers/wikitext/parser/Block Mode WikiText.tid index 9501f672c..b0e00cfaf 100644 --- a/editions/tw5.com/tiddlers/wikitext/parser/Block Mode WikiText.tid +++ b/editions/tw5.com/tiddlers/wikitext/parser/Block Mode WikiText.tid @@ -1,6 +1,6 @@ caption: block parser mode created: 20220110234234616 -modified: 20220122182842032 +modified: 20240512001555383 tags: [[WikiText Parser Modes]] title: Block Mode WikiText type: text/vnd.tiddlywiki @@ -28,7 +28,7 @@ Common characteristics of such block mode WikiText: The above WikiText types are only recognised in ''block mode''. However, the text <<.em enclosed>> by most of them will be parsed in ''inline mode'' ([[Block Quotes in WikiText]] and [[Styles and Classes in WikiText]] are the two exceptions in which the parser will continue in ''block mode''). While in ''inline mode'' the parser may encounter something which moves it to ''block mode'' (see [[WikiText parser mode transitions]]). At the end of the terminating line, the parser will return to ''block mode''. -<<.tip 'Note: [[Hard Linebreaks in WikiText]] require an extra blank line after the trailing `"""` before the parser will return to block mode'>>. +<<.tip 'Note: [[Hard Linebreaks in WikiText]] require an extra blank line after the trailing `"""` before the parser will return to block mode.'>> If the punctuation for the above types of WikiText is encountered while the parser is in ''inline mode'', it will be //ignored// and output as-is.