diff --git a/core/modules/parsers/wikiparser/rules/quoteblock.js b/core/modules/parsers/wikiparser/rules/quoteblock.js new file mode 100644 index 000000000..e69c8edc8 --- /dev/null +++ b/core/modules/parsers/wikiparser/rules/quoteblock.js @@ -0,0 +1,93 @@ +/*\ +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({ + type: "element", + tag: "cite", + children: cite + }); + } + + // Parse any optional cite + this.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true}); + var cite = this.parser.parseInlineRun(/(\r?\n)/mg); + // If we got a cite, push it + if ( cite.length > 0 ) { + tree.push({ + type: "element", + tag: "cite", + children: cite + }); + } + + // Return the blockquote element + return [{ + type: "element", + tag: "blockquote", + attributes: { + class: { type: "string", value: classes.join(" ") }, + }, + children: tree + }]; +}; + +})();