From 68159d5b389701b9065297effa92187df149cea9 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 10 Oct 2015 03:57:25 +0200 Subject: [PATCH] Add support for AsciiDoc --- components.js | 4 + components/prism-asciidoc.js | 271 +++++++++ components/prism-asciidoc.min.js | 1 + examples/prism-asciidoc.html | 107 ++++ plugins/show-language/prism-show-language.js | 2 +- .../show-language/prism-show-language.min.js | 2 +- .../asciidoc/admonition_feature.test | 19 + .../asciidoc/attribute-entry_feature.test | 58 ++ .../asciidoc/attributes_feature.test | 403 ++++++++++++++ tests/languages/asciidoc/callout_feature.test | 34 ++ .../asciidoc/comment-block_feature.test | 19 + tests/languages/asciidoc/comment_feature.test | 41 ++ tests/languages/asciidoc/entity_feature.test | 48 ++ tests/languages/asciidoc/hr_feature.test | 14 + .../asciidoc/indented-block_feature.test | 28 + tests/languages/asciidoc/inline_feature.test | 521 ++++++++++++++++++ .../asciidoc/line-continuation_feature.test | 18 + .../asciidoc/list-label_feature.test | 73 +++ .../asciidoc/list-punctuation_feature.test | 77 +++ .../asciidoc/literal-block_feature.test | 46 ++ tests/languages/asciidoc/macro_feature.test | 250 +++++++++ .../asciidoc/other-block_feature.test | 45 ++ .../asciidoc/page-break_feature.test | 14 + .../asciidoc/passthrough-block_feature.test | 29 + .../asciidoc/replacement_feature.test | 48 ++ tests/languages/asciidoc/table_feature.test | 61 ++ tests/languages/asciidoc/title_feature.test | 80 +++ 27 files changed, 2311 insertions(+), 2 deletions(-) create mode 100644 components/prism-asciidoc.js create mode 100644 components/prism-asciidoc.min.js create mode 100644 examples/prism-asciidoc.html create mode 100644 tests/languages/asciidoc/admonition_feature.test create mode 100644 tests/languages/asciidoc/attribute-entry_feature.test create mode 100644 tests/languages/asciidoc/attributes_feature.test create mode 100644 tests/languages/asciidoc/callout_feature.test create mode 100644 tests/languages/asciidoc/comment-block_feature.test create mode 100644 tests/languages/asciidoc/comment_feature.test create mode 100644 tests/languages/asciidoc/entity_feature.test create mode 100644 tests/languages/asciidoc/hr_feature.test create mode 100644 tests/languages/asciidoc/indented-block_feature.test create mode 100644 tests/languages/asciidoc/inline_feature.test create mode 100644 tests/languages/asciidoc/line-continuation_feature.test create mode 100644 tests/languages/asciidoc/list-label_feature.test create mode 100644 tests/languages/asciidoc/list-punctuation_feature.test create mode 100644 tests/languages/asciidoc/literal-block_feature.test create mode 100644 tests/languages/asciidoc/macro_feature.test create mode 100644 tests/languages/asciidoc/other-block_feature.test create mode 100644 tests/languages/asciidoc/page-break_feature.test create mode 100644 tests/languages/asciidoc/passthrough-block_feature.test create mode 100644 tests/languages/asciidoc/replacement_feature.test create mode 100644 tests/languages/asciidoc/table_feature.test create mode 100644 tests/languages/asciidoc/title_feature.test diff --git a/components.js b/components.js index ffa56830ab..5aacf8d1ef 100644 --- a/components.js +++ b/components.js @@ -79,6 +79,10 @@ var components = { "title": "AppleScript", "owner": "Golmote" }, + "asciidoc": { + "title": "AsciiDoc", + "owner": "Golmote" + }, "aspnet": { "title": "ASP.NET (C#)", "require": "markup", diff --git a/components/prism-asciidoc.js b/components/prism-asciidoc.js new file mode 100644 index 0000000000..55a6330353 --- /dev/null +++ b/components/prism-asciidoc.js @@ -0,0 +1,271 @@ +(function (Prism) { + + var attributes = { + pattern: /(^[ \t]*)\[(?!\[)(?:(["'$`])(?:(?!\2)[^\\]|\\.)*\2|\[(?:[^\]\\]|\\.)*\]|[^\]\\]|\\.)*\]/m, + lookbehind: true, + inside: { + 'quoted': { + pattern: /([$`])(?:(?!\1)[^\\]|\\.)*\1/, + inside: { + 'punctuation': /^[$`]|[$`]$/ + } + }, + 'interpreted': { + pattern: /'(?:[^'\\]|\\.)*'/, + inside: { + 'punctuation': /^'|'$/ + // See rest below + } + }, + 'string': /"(?:[^"\\]|\\.)*"/, + 'variable': /\w+(?==)/, + 'punctuation': /^\[|\]$|,/, + 'operator': /=/, + // The negative look-ahead prevents blank matches + 'attr-value': /(?!^\s+$).+/ + } + }; + Prism.languages.asciidoc = { + 'comment-block': { + pattern: /^(\/{4,})(?:\r?\n|\r)(?:.*(?:\r?\n|\r))*?\1/m, + alias: 'comment' + }, + 'table': { + pattern: /^\|={3,}(?:(?:\r?\n|\r).*)*?(?:\r?\n|\r)\|={3,}$/m, + inside: { + 'specifiers': { + pattern: /(?!\|)(?:(?:(?:\d+(?:\.\d+)?|\.\d+)[+*])?(?:[<^>](?:\.[<^>])?|\.[<^>])?[a-z]*)(?=\|)/, + alias: 'attr-value' + }, + 'punctuation': { + pattern: /(^|[^\\])[|!]=*/, + lookbehind: true + } + // See rest below + } + }, + + 'passthrough-block': { + pattern: /^(\+{4,})(?:\r?\n|\r)(?:.*(?:\r?\n|\r))*?\1$/m, + inside: { + 'punctuation': /^\++|\++$/ + // See rest below + } + }, + // Literal blocks and listing blocks + 'literal-block': { + pattern: /^(-{4,}|\.{4,})(?:\r?\n|\r)(?:.*(?:\r?\n|\r))*?\1$/m, + inside: { + 'punctuation': /^(?:-+|\.+)|(?:-+|\.+)$/ + // See rest below + } + }, + // Sidebar blocks, quote blocks, example blocks and open blocks + 'other-block': { + pattern: /^(--|\*{4,}|_{4,}|={4,})(?:\r?\n|\r)(?:.*(?:\r?\n|\r))*?\1$/m, + inside: { + 'punctuation': /^(?:-+|\*+|_+|=+)|(?:-+|\*+|_+|=+)$/ + // See rest below + } + }, + + // list-punctuation and list-label must appear before indented-block + 'list-punctuation': { + pattern: /(^[ \t]*)(?:-|\*{1,5}|\.{1,5}|(?:[a-z]|\d+)\.|[xvi]+\))(?= )/im, + lookbehind: true, + alias: 'punctuation' + }, + 'list-label': { + pattern: /(^[ \t]*)[a-z\d].+(?::{2,4}|;;)(?=\s)/im, + lookbehind: true, + alias: 'symbol' + }, + 'indented-block': { + pattern: /((\r?\n|\r)\2)([ \t]+)\S.*(?:(?:\r?\n|\r)\3.+)*(?=\2{2}|$)/, + lookbehind: true + }, + + 'comment': /^\/\/.*/m, + 'title': { + pattern: /^.+(?:\r?\n|\r)(?:={3,}|-{3,}|~{3,}|\^{3,}|\+{3,})$|^={1,5} +.+|^\.(?![\s.]).*/m, + alias: 'important', + inside: { + 'punctuation': /^(?:\.|=+)|(?:=+|-+|~+|\^+|\++)$/ + // See rest below + } + }, + 'attribute-entry': { + pattern: /^:[^:\r\n]+:(?: .*?(?: \+(?:\r?\n|\r).*?)*)?$/m, + alias: 'tag' + }, + 'attributes': attributes, + 'hr': { + pattern: /^'{3,}$/m, + alias: 'punctuation' + }, + 'page-break': { + pattern: /^<{3,}$/m, + alias: 'punctuation' + }, + 'admonition': { + pattern: /^(?:TIP|NOTE|IMPORTANT|WARNING|CAUTION):/m, + alias: 'keyword' + }, + 'callout': [ + { + pattern: /(^[ \t]*)/m, + lookbehind: true, + alias: 'symbol' + }, + { + pattern: /<\d+>/, + alias: 'symbol' + } + ], + 'macro': { + pattern: /\b[a-z\d][a-z\d-]*::?(?:(?:\S+)??\[(?:[^\]\\"]|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/, + inside: { + 'function': /^[a-z\d-]+(?=:)/, + 'punctuation': /^::?/, + 'attributes': { + pattern: /(?:\[(?:[^\]\\"]|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/, + inside: attributes.inside + } + } + }, + 'inline': { + /* + The initial look-behind prevents the highlighting of escaped quoted text. + + Quoted text can be multi-line but cannot span an empty line. + All quoted text can have attributes before [foobar, 'foobar', baz="bar"]. + + First, we handle the constrained quotes. + Those must be bounded by non-word chars and cannot have spaces between the delimiter and the first char. + They are, in order: _emphasis_, ``double quotes'', `single quotes', `monospace`, 'emphasis', *strong*, +monospace+ and #unquoted# + + Then we handle the unconstrained quotes. + Those do not have the restrictions of the constrained quotes. + They are, in order: __emphasis__, **strong**, ++monospace++, +++passthrough+++, ##unquoted##, $$passthrough$$, ~subscript~, ^superscript^, {attribute-reference}, [[anchor]], [[[bibliography anchor]]], <>, (((indexes))) and ((indexes)) + */ + pattern: /(^|[^\\])(?:(?:\B\[(?:[^\]\\"]|(["'])(?:(?!\2)[^\\]|\\.)*\2|\\.)*\])?(?:\b_(?!\s)(?: _|[^_\\\r\n]|\\.)+(?:(?:\r?\n|\r)(?: _|[^_\\\r\n]|\\.)+)*_\b|\B``(?!\s).+?(?:(?:\r?\n|\r).+?)*''\B|\B`(?!\s)(?: ['`]|.)+?(?:(?:\r?\n|\r)(?: ['`]|.)+?)*['`]\B|\B(['*+#])(?!\s)(?: \3|(?!\3)[^\\\r\n]|\\.)+(?:(?:\r?\n|\r)(?: \3|(?!\3)[^\\\r\n]|\\.)+)*\3\B)|(?:\[(?:[^\]\\"]|(["'])(?:(?!\4)[^\\]|\\.)*\4|\\.)*\])?(?:(__|\*\*|\+\+\+?|##|\$\$|[~^]).+?(?:(?:\r?\n|\r).+?)*\5|\{[^}\r\n]+\}|\[\[\[?.+?(?:(?:\r?\n|\r).+?)*\]?\]\]|<<.+?(?:(?:\r?\n|\r).+?)*>>|\(\(\(?.+?(?:(?:\r?\n|\r).+?)*\)?\)\)))/m, + lookbehind: true, + inside: { + 'attributes': attributes, + 'url': { + pattern: /^(?:\[\[\[?.+?\]?\]\]|<<.+?>>)$/, + inside: { + 'punctuation': /^(?:\[\[\[?|<<)|(?:\]\]\]?|>>)$/ + } + }, + 'attribute-ref': { + pattern: /^\{.+\}$/, + inside: { + 'variable': { + pattern: /(^\{)[a-z\d,+_-]+/, + lookbehind: true + }, + 'operator': /^[=?!#%@$]|!(?=[:}])/, + 'punctuation': /^\{|\}$|::?/ + } + }, + 'italic': { + pattern: /^(['_])[\s\S]+\1$/, + inside: { + 'punctuation': /^(?:''?|__?)|(?:''?|__?)$/ + } + }, + 'bold': { + pattern: /^\*[\s\S]+\*$/, + inside: { + punctuation: /^\*\*?|\*\*?$/ + } + }, + 'punctuation': /^(?:``?|\+{1,3}|##?|\$\$|[~^]|\(\(\(?)|(?:''?|\+{1,3}|##?|\$\$|[~^`]|\)?\)\))$/ + } + }, + 'replacement': { + pattern: /\((?:C|TM|R)\)/, + alias: 'builtin' + }, + 'entity': /&#?[\da-z]{1,8};/i, + 'line-continuation': { + pattern: /(^| )\+$/m, + lookbehind: true, + alias: 'punctuation' + } + }; + + + // Allow some nesting. There is no recursion though, so cloning should not be needed. + + attributes.inside['interpreted'].inside.rest = { + 'macro': Prism.languages.asciidoc['macro'], + 'inline': Prism.languages.asciidoc['inline'], + 'replacement': Prism.languages.asciidoc['replacement'], + 'entity': Prism.languages.asciidoc['entity'] + }; + + Prism.languages.asciidoc['passthrough-block'].inside.rest = { + 'macro': Prism.languages.asciidoc['macro'] + }; + + Prism.languages.asciidoc['literal-block'].inside.rest = { + 'callout': Prism.languages.asciidoc['callout'] + }; + + Prism.languages.asciidoc['table'].inside.rest = { + 'comment-block': Prism.languages.asciidoc['comment-block'], + 'passthrough-block': Prism.languages.asciidoc['passthrough-block'], + 'literal-block': Prism.languages.asciidoc['literal-block'], + 'other-block': Prism.languages.asciidoc['other-block'], + 'list-punctuation': Prism.languages.asciidoc['list-punctuation'], + 'indented-block': Prism.languages.asciidoc['indented-block'], + 'comment': Prism.languages.asciidoc['comment'], + 'title': Prism.languages.asciidoc['title'], + 'attribute-entry': Prism.languages.asciidoc['attribute-entry'], + 'attributes': Prism.languages.asciidoc['attributes'], + 'hr': Prism.languages.asciidoc['hr'], + 'page-break': Prism.languages.asciidoc['page-break'], + 'admonition': Prism.languages.asciidoc['admonition'], + 'list-label': Prism.languages.asciidoc['list-label'], + 'callout': Prism.languages.asciidoc['callout'], + 'macro': Prism.languages.asciidoc['macro'], + 'inline': Prism.languages.asciidoc['inline'], + 'replacement': Prism.languages.asciidoc['replacement'], + 'entity': Prism.languages.asciidoc['entity'], + 'line-continuation': Prism.languages.asciidoc['line-continuation'] + }; + + Prism.languages.asciidoc['other-block'].inside.rest = { + 'table': Prism.languages.asciidoc['table'], + 'list-punctuation': Prism.languages.asciidoc['list-punctuation'], + 'indented-block': Prism.languages.asciidoc['indented-block'], + 'comment': Prism.languages.asciidoc['comment'], + 'attribute-entry': Prism.languages.asciidoc['attribute-entry'], + 'attributes': Prism.languages.asciidoc['attributes'], + 'hr': Prism.languages.asciidoc['hr'], + 'page-break': Prism.languages.asciidoc['page-break'], + 'admonition': Prism.languages.asciidoc['admonition'], + 'list-label': Prism.languages.asciidoc['list-label'], + 'macro': Prism.languages.asciidoc['macro'], + 'inline': Prism.languages.asciidoc['inline'], + 'replacement': Prism.languages.asciidoc['replacement'], + 'entity': Prism.languages.asciidoc['entity'], + 'line-continuation': Prism.languages.asciidoc['line-continuation'] + }; + + Prism.languages.asciidoc['title'].inside.rest = { + 'macro': Prism.languages.asciidoc['macro'], + 'inline': Prism.languages.asciidoc['inline'], + 'replacement': Prism.languages.asciidoc['replacement'], + 'entity': Prism.languages.asciidoc['entity'] + }; + + // Plugin to make entity title show the real entity, idea by Roman Komarov + Prism.hooks.add('wrap', function(env) { + if (env.type === 'entity') { + env.attributes['title'] = env.content.replace(/&/, '&'); + } + }); +}(Prism)); \ No newline at end of file diff --git a/components/prism-asciidoc.min.js b/components/prism-asciidoc.min.js new file mode 100644 index 0000000000..6d6ae1732f --- /dev/null +++ b/components/prism-asciidoc.min.js @@ -0,0 +1 @@ +!function(a){var i={pattern:/(^[ \t]*)\[(?!\[)(?:(["'$`])(?:(?!\2)[^\\]|\\.)*\2|\[(?:[^\]\\]|\\.)*\]|[^\]\\]|\\.)*\]/m,lookbehind:!0,inside:{quoted:{pattern:/([$`])(?:(?!\1)[^\\]|\\.)*\1/,inside:{punctuation:/^[$`]|[$`]$/}},interpreted:{pattern:/'(?:[^'\\]|\\.)*'/,inside:{punctuation:/^'|'$/}},string:/"(?:[^"\\]|\\.)*"/,variable:/\w+(?==)/,punctuation:/^\[|\]$|,/,operator:/=/,"attr-value":/(?!^\s+$).+/}};a.languages.asciidoc={"comment-block":{pattern:/^(\/{4,})(?:\r?\n|\r)(?:.*(?:\r?\n|\r))*?\1/m,alias:"comment"},table:{pattern:/^\|={3,}(?:(?:\r?\n|\r).*)*?(?:\r?\n|\r)\|={3,}$/m,inside:{specifiers:{pattern:/(?!\|)(?:(?:(?:\d+(?:\.\d+)?|\.\d+)[+*])?(?:[<^>](?:\.[<^>])?|\.[<^>])?[a-z]*)(?=\|)/,alias:"attr-value"},punctuation:{pattern:/(^|[^\\])[|!]=*/,lookbehind:!0}}},"passthrough-block":{pattern:/^(\+{4,})(?:\r?\n|\r)(?:.*(?:\r?\n|\r))*?\1$/m,inside:{punctuation:/^\++|\++$/}},"literal-block":{pattern:/^(-{4,}|\.{4,})(?:\r?\n|\r)(?:.*(?:\r?\n|\r))*?\1$/m,inside:{punctuation:/^(?:-+|\.+)|(?:-+|\.+)$/}},"other-block":{pattern:/^(--|\*{4,}|_{4,}|={4,})(?:\r?\n|\r)(?:.*(?:\r?\n|\r))*?\1$/m,inside:{punctuation:/^(?:-+|\*+|_+|=+)|(?:-+|\*+|_+|=+)$/}},"list-punctuation":{pattern:/(^[ \t]*)(?:-|\*{1,5}|\.{1,5}|(?:[a-z]|\d+)\.|[xvi]+\))(?= )/im,lookbehind:!0,alias:"punctuation"},"list-label":{pattern:/(^[ \t]*)[a-z\d].+(?::{2,4}|;;)(?=\s)/im,lookbehind:!0,alias:"symbol"},"indented-block":{pattern:/((\r?\n|\r)\2)([ \t]+)\S.*(?:(?:\r?\n|\r)\3.+)*(?=\2{2}|$)/,lookbehind:!0},comment:/^\/\/.*/m,title:{pattern:/^.+(?:\r?\n|\r)(?:={3,}|-{3,}|~{3,}|\^{3,}|\+{3,})$|^={1,5} +.+|^\.(?![\s.]).*/m,alias:"important",inside:{punctuation:/^(?:\.|=+)|(?:=+|-+|~+|\^+|\++)$/}},"attribute-entry":{pattern:/^:[^:\r\n]+:(?: .*?(?: \+(?:\r?\n|\r).*?)*)?$/m,alias:"tag"},attributes:i,hr:{pattern:/^'{3,}$/m,alias:"punctuation"},"page-break":{pattern:/^<{3,}$/m,alias:"punctuation"},admonition:{pattern:/^(?:TIP|NOTE|IMPORTANT|WARNING|CAUTION):/m,alias:"keyword"},callout:[{pattern:/(^[ \t]*)/m,lookbehind:!0,alias:"symbol"},{pattern:/<\d+>/,alias:"symbol"}],macro:{pattern:/\b[a-z\d][a-z\d-]*::?(?:(?:\S+)??\[(?:[^\]\\"]|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/,inside:{"function":/^[a-z\d-]+(?=:)/,punctuation:/^::?/,attributes:{pattern:/(?:\[(?:[^\]\\"]|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/,inside:i.inside}}},inline:{pattern:/(^|[^\\])(?:(?:\B\[(?:[^\]\\"]|(["'])(?:(?!\2)[^\\]|\\.)*\2|\\.)*\])?(?:\b_(?!\s)(?: _|[^_\\\r\n]|\\.)+(?:(?:\r?\n|\r)(?: _|[^_\\\r\n]|\\.)+)*_\b|\B``(?!\s).+?(?:(?:\r?\n|\r).+?)*''\B|\B`(?!\s)(?: ['`]|.)+?(?:(?:\r?\n|\r)(?: ['`]|.)+?)*['`]\B|\B(['*+#])(?!\s)(?: \3|(?!\3)[^\\\r\n]|\\.)+(?:(?:\r?\n|\r)(?: \3|(?!\3)[^\\\r\n]|\\.)+)*\3\B)|(?:\[(?:[^\]\\"]|(["'])(?:(?!\4)[^\\]|\\.)*\4|\\.)*\])?(?:(__|\*\*|\+\+\+?|##|\$\$|[~^]).+?(?:(?:\r?\n|\r).+?)*\5|\{[^}\r\n]+\}|\[\[\[?.+?(?:(?:\r?\n|\r).+?)*\]?\]\]|<<.+?(?:(?:\r?\n|\r).+?)*>>|\(\(\(?.+?(?:(?:\r?\n|\r).+?)*\)?\)\)))/m,lookbehind:!0,inside:{attributes:i,url:{pattern:/^(?:\[\[\[?.+?\]?\]\]|<<.+?>>)$/,inside:{punctuation:/^(?:\[\[\[?|<<)|(?:\]\]\]?|>>)$/}},"attribute-ref":{pattern:/^\{.+\}$/,inside:{variable:{pattern:/(^\{)[a-z\d,+_-]+/,lookbehind:!0},operator:/^[=?!#%@$]|!(?=[:}])/,punctuation:/^\{|\}$|::?/}},italic:{pattern:/^(['_])[\s\S]+\1$/,inside:{punctuation:/^(?:''?|__?)|(?:''?|__?)$/}},bold:{pattern:/^\*[\s\S]+\*$/,inside:{punctuation:/^\*\*?|\*\*?$/}},punctuation:/^(?:``?|\+{1,3}|##?|\$\$|[~^]|\(\(\(?)|(?:''?|\+{1,3}|##?|\$\$|[~^`]|\)?\)\))$/}},replacement:{pattern:/\((?:C|TM|R)\)/,alias:"builtin"},entity:/&#?[\da-z]{1,8};/i,"line-continuation":{pattern:/(^| )\+$/m,lookbehind:!0,alias:"punctuation"}},i.inside.interpreted.inside.rest={macro:a.languages.asciidoc.macro,inline:a.languages.asciidoc.inline,replacement:a.languages.asciidoc.replacement,entity:a.languages.asciidoc.entity},a.languages.asciidoc["passthrough-block"].inside.rest={macro:a.languages.asciidoc.macro},a.languages.asciidoc["literal-block"].inside.rest={callout:a.languages.asciidoc.callout},a.languages.asciidoc.table.inside.rest={"comment-block":a.languages.asciidoc["comment-block"],"passthrough-block":a.languages.asciidoc["passthrough-block"],"literal-block":a.languages.asciidoc["literal-block"],"other-block":a.languages.asciidoc["other-block"],"list-punctuation":a.languages.asciidoc["list-punctuation"],"indented-block":a.languages.asciidoc["indented-block"],comment:a.languages.asciidoc.comment,title:a.languages.asciidoc.title,"attribute-entry":a.languages.asciidoc["attribute-entry"],attributes:a.languages.asciidoc.attributes,hr:a.languages.asciidoc.hr,"page-break":a.languages.asciidoc["page-break"],admonition:a.languages.asciidoc.admonition,"list-label":a.languages.asciidoc["list-label"],callout:a.languages.asciidoc.callout,macro:a.languages.asciidoc.macro,inline:a.languages.asciidoc.inline,replacement:a.languages.asciidoc.replacement,entity:a.languages.asciidoc.entity,"line-continuation":a.languages.asciidoc["line-continuation"]},a.languages.asciidoc["other-block"].inside.rest={table:a.languages.asciidoc.table,"list-punctuation":a.languages.asciidoc["list-punctuation"],"indented-block":a.languages.asciidoc["indented-block"],comment:a.languages.asciidoc.comment,"attribute-entry":a.languages.asciidoc["attribute-entry"],attributes:a.languages.asciidoc.attributes,hr:a.languages.asciidoc.hr,"page-break":a.languages.asciidoc["page-break"],admonition:a.languages.asciidoc.admonition,"list-label":a.languages.asciidoc["list-label"],macro:a.languages.asciidoc.macro,inline:a.languages.asciidoc.inline,replacement:a.languages.asciidoc.replacement,entity:a.languages.asciidoc.entity,"line-continuation":a.languages.asciidoc["line-continuation"]},a.languages.asciidoc.title.inside.rest={macro:a.languages.asciidoc.macro,inline:a.languages.asciidoc.inline,replacement:a.languages.asciidoc.replacement,entity:a.languages.asciidoc.entity},a.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))})}(Prism); \ No newline at end of file diff --git a/examples/prism-asciidoc.html b/examples/prism-asciidoc.html new file mode 100644 index 0000000000..770c7e4cda --- /dev/null +++ b/examples/prism-asciidoc.html @@ -0,0 +1,107 @@ +

AsciiDoc

+

To use this language, use the class "language-asciidoc".

+ +

Comments

+
/////
+Comment block
+/////
+
+// Comment line
+ +

Titles

+
Level 0
+========
+Level 1
+--------
+Level 2
+~~~~~~~~
+Level 3
+^^^^^^^^
+Level 4
+++++++++
+
+= Document Title (level 0) =
+== Section title (level 1) ==
+=== Section title (level 2) ===
+==== Section title (level 3) ====
+===== Section title (level 4) =====
+
+.Notes
+ +

Blocks

+
++++++++++++++++++++++++++
+Passthrough block
+++++++++++++++++++++++++++
+
+--------------------------
+Listing block
+--------------------------
+
+..........................
+Literal block
+No *highlighting* _here_
+..........................
+
+**************************
+Sidebar block
+**************************
+
+[quote,'http://en.wikipedia.org/wiki/Samuel_Johnson[Samuel Johnson]']
+_____________________________________________________________________
+Sir, a woman's preaching is like a dog's walking on his hind legs. It
+is not done well; but you are surprised to find it done at all.
+_____________________________________________________________________
+
+==========================
+Example block
+==========================
+ +

Lists

+
- List item.
+* List item.
+** List item.
+*** List item.
+**** List item.
+***** List item.
+
+1.   Arabic (decimal) numbered list item.
+a.   Lower case alpha (letter) numbered list item.
+F.   Upper case alpha (letter) numbered list item.
+iii) Lower case roman numbered list item.
+IX)  Upper case roman numbered list item.
+
+. Arabic (decimal) numbered list item.
+.. Lower case alpha (letter) numbered list item.
+... Lower case roman numbered list item.
+.... Upper case alpha (letter) numbered list item.
+..... Upper case roman numbered list item.
+
+Dolor::
+  Donec eget arcu bibendum nunc consequat lobortis.
+  Suspendisse;;
+    A massa id sem aliquam auctor.
+  Morbi;;
+    Pretium nulla vel lorem.
+  In;;
+    Dictum mauris in urna.
+    Vivamus::: Fringilla mi eu lacus.
+    Donec:::   Eget arcu bibendum nunc consequat lobortis.
+ +

Tables

+
[cols="e,m,^,>s",width="25%"]
+|============================
+|1 >s|2 |3 |4
+^|5 2.2+^.^|6 .3+<.>m|7
+^|8
+|9 2+>|10
+|============================
+ +

Inline styles

+
*Some bold text*
+This is an _emphasis_
+[[[walsh-muellner]]]
+ +

Attribute entries

+
:Author Initials: JB
+{authorinitials}
+:Author Initials!:
\ No newline at end of file diff --git a/plugins/show-language/prism-show-language.js b/plugins/show-language/prism-show-language.js index a221263076..14923a9526 100644 --- a/plugins/show-language/prism-show-language.js +++ b/plugins/show-language/prism-show-language.js @@ -5,7 +5,7 @@ if (typeof self === 'undefined' || !self.Prism || !self.document) { } // The languages map is built automatically with gulp -var Languages = /*languages_placeholder[*/{"css":"CSS","clike":"C-like","javascript":"JavaScript","abap":"ABAP","actionscript":"ActionScript","apacheconf":"Apache Configuration","apl":"APL","applescript":"AppleScript","aspnet":"ASP.NET (C#)","autoit":"AutoIt","autohotkey":"AutoHotkey","basic":"BASIC","csharp":"C#","cpp":"C++","coffeescript":"CoffeeScript","css-extras":"CSS Extras","fsharp":"F#","glsl":"GLSL","http":"HTTP","inform7":"Inform 7","latex":"LaTeX","lolcode":"LOLCODE","matlab":"MATLAB","mel":"MEL","nasm":"NASM","nginx":"nginx","nsis":"NSIS","objectivec":"Objective-C","ocaml":"OCaml","php":"PHP","php-extras":"PHP Extras","powershell":"PowerShell","jsx":"React JSX","rest":"reST (reStructuredText)","sas":"SAS","sass":"Sass (Sass)","scss":"Sass (Scss)","sql":"SQL","typescript":"TypeScript","vhdl":"VHDL","vim":"vim","wiki":"Wiki markup","yaml":"YAML"}/*]*/; +var Languages = /*languages_placeholder[*/{"css":"CSS","clike":"C-like","javascript":"JavaScript","abap":"ABAP","actionscript":"ActionScript","apacheconf":"Apache Configuration","apl":"APL","applescript":"AppleScript","asciidoc":"AsciiDoc","aspnet":"ASP.NET (C#)","autoit":"AutoIt","autohotkey":"AutoHotkey","basic":"BASIC","csharp":"C#","cpp":"C++","coffeescript":"CoffeeScript","css-extras":"CSS Extras","fsharp":"F#","glsl":"GLSL","http":"HTTP","inform7":"Inform 7","latex":"LaTeX","lolcode":"LOLCODE","matlab":"MATLAB","mel":"MEL","nasm":"NASM","nginx":"nginx","nsis":"NSIS","objectivec":"Objective-C","ocaml":"OCaml","php":"PHP","php-extras":"PHP Extras","powershell":"PowerShell","jsx":"React JSX","rest":"reST (reStructuredText)","sas":"SAS","sass":"Sass (Sass)","scss":"Sass (Scss)","sql":"SQL","typescript":"TypeScript","vhdl":"VHDL","vim":"vim","wiki":"Wiki markup","yaml":"YAML"}/*]*/; Prism.hooks.add('before-highlight', function(env) { var pre = env.element.parentNode; if (!pre || !/pre/i.test(pre.nodeName)) { diff --git a/plugins/show-language/prism-show-language.min.js b/plugins/show-language/prism-show-language.min.js index 2969d91af6..fb5732f0a8 100644 --- a/plugins/show-language/prism-show-language.min.js +++ b/plugins/show-language/prism-show-language.min.js @@ -1 +1 @@ -!function(){if("undefined"!=typeof self&&self.Prism&&self.document){var e={css:"CSS",clike:"C-like",javascript:"JavaScript",abap:"ABAP",actionscript:"ActionScript",apacheconf:"Apache Configuration",apl:"APL",applescript:"AppleScript",aspnet:"ASP.NET (C#)",autoit:"AutoIt",autohotkey:"AutoHotkey",basic:"BASIC",csharp:"C#",cpp:"C++",coffeescript:"CoffeeScript","css-extras":"CSS Extras",fsharp:"F#",glsl:"GLSL",http:"HTTP",inform7:"Inform 7",latex:"LaTeX",lolcode:"LOLCODE",matlab:"MATLAB",mel:"MEL",nasm:"NASM",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",ocaml:"OCaml",php:"PHP","php-extras":"PHP Extras",powershell:"PowerShell",jsx:"React JSX",rest:"reST (reStructuredText)",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)",sql:"SQL",typescript:"TypeScript",vhdl:"VHDL",vim:"vim",wiki:"Wiki markup",yaml:"YAML"};Prism.hooks.add("before-highlight",function(a){var t=a.element.parentNode;if(t&&/pre/i.test(t.nodeName)){var s=e[a.language]||a.language.substring(0,1).toUpperCase()+a.language.substring(1);t.setAttribute("data-language",s);var i,r,l=t.previousSibling;l&&/\s*\bprism-show-language\b\s*/.test(l.className)&&l.firstChild&&/\s*\bprism-show-language-label\b\s*/.test(l.firstChild.className)?(r=l.firstChild,r.getAttribute("data-language")!==s&&(r.setAttribute("data-language",s),r.innerHTML=s)):(i=document.createElement("div"),r=document.createElement("div"),r.className="prism-show-language-label",r.setAttribute("data-language",s),r.innerHTML=s,i.className="prism-show-language",i.appendChild(r),t.parentNode.insertBefore(i,t))}})}}(); \ No newline at end of file +!function(){if("undefined"!=typeof self&&self.Prism&&self.document){var e={css:"CSS",clike:"C-like",javascript:"JavaScript",abap:"ABAP",actionscript:"ActionScript",apacheconf:"Apache Configuration",apl:"APL",applescript:"AppleScript",asciidoc:"AsciiDoc",aspnet:"ASP.NET (C#)",autoit:"AutoIt",autohotkey:"AutoHotkey",basic:"BASIC",csharp:"C#",cpp:"C++",coffeescript:"CoffeeScript","css-extras":"CSS Extras",fsharp:"F#",glsl:"GLSL",http:"HTTP",inform7:"Inform 7",latex:"LaTeX",lolcode:"LOLCODE",matlab:"MATLAB",mel:"MEL",nasm:"NASM",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",ocaml:"OCaml",php:"PHP","php-extras":"PHP Extras",powershell:"PowerShell",jsx:"React JSX",rest:"reST (reStructuredText)",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)",sql:"SQL",typescript:"TypeScript",vhdl:"VHDL",vim:"vim",wiki:"Wiki markup",yaml:"YAML"};Prism.hooks.add("before-highlight",function(a){var s=a.element.parentNode;if(s&&/pre/i.test(s.nodeName)){var t=e[a.language]||a.language.substring(0,1).toUpperCase()+a.language.substring(1);s.setAttribute("data-language",t);var i,r,l=s.previousSibling;l&&/\s*\bprism-show-language\b\s*/.test(l.className)&&l.firstChild&&/\s*\bprism-show-language-label\b\s*/.test(l.firstChild.className)?(r=l.firstChild,r.getAttribute("data-language")!==t&&(r.setAttribute("data-language",t),r.innerHTML=t)):(i=document.createElement("div"),r=document.createElement("div"),r.className="prism-show-language-label",r.setAttribute("data-language",t),r.innerHTML=t,i.className="prism-show-language",i.appendChild(r),s.parentNode.insertBefore(i,s))}})}}(); \ No newline at end of file diff --git a/tests/languages/asciidoc/admonition_feature.test b/tests/languages/asciidoc/admonition_feature.test new file mode 100644 index 0000000000..6b1688f59b --- /dev/null +++ b/tests/languages/asciidoc/admonition_feature.test @@ -0,0 +1,19 @@ +TIP: Foobar +NOTE: Foo bar baz +IMPORTANT: Foobar +WARNING: Foo bar baz +CAUTION: Foobar + +---------------------------------------------------- + +[ + ["admonition", "TIP:"], " Foobar\r\n", + ["admonition", "NOTE:"], " Foo bar baz\r\n", + ["admonition", "IMPORTANT:"], " Foobar\r\n", + ["admonition", "WARNING:"], " Foo bar baz\r\n", + ["admonition", "CAUTION:"], " Foobar" +] + +---------------------------------------------------- + +Checks for admonitions. \ No newline at end of file diff --git a/tests/languages/asciidoc/attribute-entry_feature.test b/tests/languages/asciidoc/attribute-entry_feature.test new file mode 100644 index 0000000000..a12299ab88 --- /dev/null +++ b/tests/languages/asciidoc/attribute-entry_feature.test @@ -0,0 +1,58 @@ +:Foo bar: baz + +:Foobar: Foo + +bar + +baz + +:Foo bar!: +:Foobar!: + +===== +:Foo bar: baz + +:Foobar: Foo + +bar + +baz + +:Foo bar!: +:Foobar!: +===== + +|===== +| +:Foo bar: baz + +:Foobar: Foo + +bar + +baz +|===== + +---------------------------------------------------- + +[ + ["attribute-entry", ":Foo bar: baz"], + ["attribute-entry", ":Foobar: Foo +\r\nbar +\r\nbaz"], + ["attribute-entry", ":Foo bar!:"], + ["attribute-entry", ":Foobar!:"], + + ["other-block", [ + ["punctuation", "====="], + ["attribute-entry", ":Foo bar: baz"], + ["attribute-entry", ":Foobar: Foo +\r\nbar +\r\nbaz"], + ["attribute-entry", ":Foo bar!:"], + ["attribute-entry", ":Foobar!:"], + ["punctuation", "====="] + ]], + + ["table", [ + ["punctuation", "|====="], + ["punctuation", "|"], + ["attribute-entry", ":Foo bar: baz"], + ["attribute-entry", ":Foobar: Foo +\r\nbar +\r\nbaz"], + ["punctuation", "|====="] + ]] +] + +---------------------------------------------------- + +Checks for attribute entries. \ No newline at end of file diff --git a/tests/languages/asciidoc/attributes_feature.test b/tests/languages/asciidoc/attributes_feature.test new file mode 100644 index 0000000000..a4eb9e25f9 --- /dev/null +++ b/tests/languages/asciidoc/attributes_feature.test @@ -0,0 +1,403 @@ +Foo [big red yellow-background]#obvious# + +[float] +[quote,'http://en.wikipedia.org/wiki/Samuel_Johnson[Samuel Johnson]'] +[quote,'"with *an* image" image:foo.png[] (TM)'] + +[NOTE] +[icon="./images/icons/wink.png"] +[icons=None, caption="My Special Note"] +[start=7] + +[cols="e,m,^,>s",width="25%"] + +===== +Foo [big red yellow-background]#obvious# + +[float] +[quote,'http://en.wikipedia.org/wiki/Samuel_Johnson[Samuel Johnson]'] +[quote,'"with *an* image" image:foo.png[] (TM)'] + +[NOTE] +[icon="./images/icons/wink.png"] +[icons=None, caption="My Special Note"] +[start=7] + +[cols="e,m,^,>s",width="25%"] +===== + +|===== +| +Foo [big red yellow-background]#obvious# + +[float] +[quote,'http://en.wikipedia.org/wiki/Samuel_Johnson[Samuel Johnson]'] +[quote,'"with *an* image" image:foo.png[] (TM)'] + +[NOTE] +[icon="./images/icons/wink.png"] +[icons=None, caption="My Special Note"] +[start=7] + +[cols="e,m,^,>s",width="25%"] +|===== + + +latexmath:[$C = \alpha + \beta Y^{\gamma} + \epsilon$] +asciimath:[`x/x={(1,if x!=0),(text{undefined},if x=0):}`] +latexmath:[$\sum_{n=1}^\infty \frac{1}{2^n}$] + +---------------------------------------------------- + +[ + "Foo ", + ["inline", [ + ["attributes", [ + ["punctuation", "["], + ["attr-value", "big red yellow-background"], + ["punctuation", "]"] + ]], + ["punctuation", "#"], "obvious", ["punctuation", "#"] + ]], + + ["attributes", [ + ["punctuation", "["], ["attr-value", "float"], ["punctuation", "]"] + ]], + ["attributes", [ + ["punctuation", "["], + ["attr-value", "quote"], ["punctuation", ","], + ["interpreted", [ + ["punctuation", "'"], + ["macro", [ + ["function", "http"], ["punctuation", ":"], + "//en.wikipedia.org/wiki/Samuel_Johnson", + ["attributes", [ + ["punctuation", "["], + ["attr-value", "Samuel Johnson"], + ["punctuation", "]"] + ]] + ]], + ["punctuation", "'"] + ]], + ["punctuation", "]"] + ]], + ["attributes", [ + ["punctuation", "["], + ["attr-value", "quote"], ["punctuation", ","], + ["interpreted", [ + ["punctuation", "'"], + ["entity", """], + "with ", + ["inline", [ + ["bold", [ + ["punctuation", "*"], "an", ["punctuation", "*"] + ]] + ]], + " image", + ["entity", """], + ["macro", [ + ["function", "image"], ["punctuation", ":"], + "foo.png", + ["attributes", [ + ["punctuation", "["], ["punctuation", "]"] + ]] + ]], + ["replacement", "(TM)"], + ["punctuation", "'"] + ]], + ["punctuation", "]"] + ]], + + ["attributes", [ + ["punctuation", "["], ["attr-value", "NOTE"], ["punctuation", "]"] + ]], + ["attributes", [ + ["punctuation", "["], + ["variable", "icon"], + ["operator", "="], + ["string", "\"./images/icons/wink.png\""], + ["punctuation", "]"] + ]], + ["attributes", [ + ["punctuation", "["], + ["variable", "icons"], + ["operator", "="], + ["attr-value", "None"], + ["punctuation", ","], + ["variable", "caption"], + ["operator", "="], + ["string", "\"My Special Note\""], + ["punctuation", "]"] + ]], + ["attributes", [ + ["punctuation", "["], + ["variable", "start"], + ["operator", "="], + ["attr-value", "7"], + ["punctuation", "]"] + ]], + + ["attributes", [ + ["punctuation", "["], + ["variable", "cols"], + ["operator", "="], + ["string", "\"e,m,^,>s\""], + ["punctuation", ","], + ["variable", "width"], + ["operator", "="], + ["string", "\"25%\""], + ["punctuation", "]"] + ]], + + ["other-block", [ + ["punctuation", "====="], + + "\r\nFoo ", + ["inline", [ + ["attributes", [ + ["punctuation", "["], + ["attr-value", "big red yellow-background"], + ["punctuation", "]"] + ]], + ["punctuation", "#"], "obvious", ["punctuation", "#"] + ]], + + ["attributes", [ + ["punctuation", "["], ["attr-value", "float"], ["punctuation", "]"] + ]], + ["attributes", [ + ["punctuation", "["], + ["attr-value", "quote"], ["punctuation", ","], + ["interpreted", [ + ["punctuation", "'"], + ["macro", [ + ["function", "http"], ["punctuation", ":"], + "//en.wikipedia.org/wiki/Samuel_Johnson", + ["attributes", [ + ["punctuation", "["], + ["attr-value", "Samuel Johnson"], + ["punctuation", "]"] + ]] + ]], + ["punctuation", "'"] + ]], + ["punctuation", "]"] + ]], + ["attributes", [ + ["punctuation", "["], + ["attr-value", "quote"], ["punctuation", ","], + ["interpreted", [ + ["punctuation", "'"], + ["entity", """], + "with ", + ["inline", [ + ["bold", [ + ["punctuation", "*"], "an", ["punctuation", "*"] + ]] + ]], + " image", + ["entity", """], + ["macro", [ + ["function", "image"], ["punctuation", ":"], + "foo.png", + ["attributes", [ + ["punctuation", "["], ["punctuation", "]"] + ]] + ]], + ["replacement", "(TM)"], + ["punctuation", "'"] + ]], + ["punctuation", "]"] + ]], + + ["attributes", [ + ["punctuation", "["], ["attr-value", "NOTE"], ["punctuation", "]"] + ]], + ["attributes", [ + ["punctuation", "["], + ["variable", "icon"], + ["operator", "="], + ["string", "\"./images/icons/wink.png\""], + ["punctuation", "]"] + ]], + ["attributes", [ + ["punctuation", "["], + ["variable", "icons"], + ["operator", "="], + ["attr-value", "None"], + ["punctuation", ","], + ["variable", "caption"], + ["operator", "="], + ["string", "\"My Special Note\""], + ["punctuation", "]"] + ]], + ["attributes", [ + ["punctuation", "["], + ["variable", "start"], + ["operator", "="], + ["attr-value", "7"], + ["punctuation", "]"] + ]], + + ["attributes", [ + ["punctuation", "["], + ["variable", "cols"], + ["operator", "="], + ["string", "\"e,m,^,>s\""], + ["punctuation", ","], + ["variable", "width"], + ["operator", "="], + ["string", "\"25%\""], + ["punctuation", "]"] + ]], + + ["punctuation", "====="] + ]], + + ["table", [ + ["punctuation", "|====="], + ["punctuation", "|"], + + "\r\nFoo ", + ["inline", [ + ["attributes", [ + ["punctuation", "["], + ["attr-value", "big red yellow-background"], + ["punctuation", "]"] + ]], + ["punctuation", "#"], "obvious", ["punctuation", "#"] + ]], + + ["attributes", [ + ["punctuation", "["], ["attr-value", "float"], ["punctuation", "]"] + ]], + ["attributes", [ + ["punctuation", "["], + ["attr-value", "quote"], ["punctuation", ","], + ["interpreted", [ + ["punctuation", "'"], + ["macro", [ + ["function", "http"], ["punctuation", ":"], + "//en.wikipedia.org/wiki/Samuel_Johnson", + ["attributes", [ + ["punctuation", "["], + ["attr-value", "Samuel Johnson"], + ["punctuation", "]"] + ]] + ]], + ["punctuation", "'"] + ]], + ["punctuation", "]"] + ]], + ["attributes", [ + ["punctuation", "["], + ["attr-value", "quote"], ["punctuation", ","], + ["interpreted", [ + ["punctuation", "'"], + ["entity", """], + "with ", + ["inline", [ + ["bold", [ + ["punctuation", "*"], "an", ["punctuation", "*"] + ]] + ]], + " image", + ["entity", """], + ["macro", [ + ["function", "image"], ["punctuation", ":"], + "foo.png", + ["attributes", [ + ["punctuation", "["], ["punctuation", "]"] + ]] + ]], + ["replacement", "(TM)"], + ["punctuation", "'"] + ]], + ["punctuation", "]"] + ]], + + ["attributes", [ + ["punctuation", "["], ["attr-value", "NOTE"], ["punctuation", "]"] + ]], + ["attributes", [ + ["punctuation", "["], + ["variable", "icon"], + ["operator", "="], + ["string", "\"./images/icons/wink.png\""], + ["punctuation", "]"] + ]], + ["attributes", [ + ["punctuation", "["], + ["variable", "icons"], + ["operator", "="], + ["attr-value", "None"], + ["punctuation", ","], + ["variable", "caption"], + ["operator", "="], + ["string", "\"My Special Note\""], + ["punctuation", "]"] + ]], + ["attributes", [ + ["punctuation", "["], + ["variable", "start"], + ["operator", "="], + ["attr-value", "7"], + ["punctuation", "]"] + ]], + + ["attributes", [ + ["punctuation", "["], + ["variable", "cols"], + ["operator", "="], + ["string", "\"e,m,^,>s\""], + ["punctuation", ","], + ["variable", "width"], + ["operator", "="], + ["string", "\"25%\""], + ["punctuation", "]"] + ]], + + ["punctuation", "|====="] + ]], + + ["macro", [ + ["function", "latexmath"], ["punctuation", ":"], + ["attributes", [ + ["punctuation", "["], + ["quoted", [ + ["punctuation", "$"], + "C = \\alpha + \\beta Y^{\\gamma} + \\epsilon", + ["punctuation", "$"] + ]], + ["punctuation", "]"] + ]] + ]], + ["macro", [ + ["function", "asciimath"], ["punctuation", ":"], + ["attributes", [ + ["punctuation", "["], + ["quoted", [ + ["punctuation", "`"], + "x/x={(1,if x!=0),(text{undefined},if x=0):}", + ["punctuation", "`"] + ]], + ["punctuation", "]"] + ]] + ]], + ["macro", [ + ["function", "latexmath"], ["punctuation", ":"], + ["attributes", [ + ["punctuation", "["], + ["quoted", [ + ["punctuation", "$"], + "\\sum_{n=1}^\\infty \\frac{1}{2^n}", + ["punctuation", "$"] + ]], + ["punctuation", "]"] + ]] + ]] +] + +---------------------------------------------------- + +Checks for attributes. \ No newline at end of file diff --git a/tests/languages/asciidoc/callout_feature.test b/tests/languages/asciidoc/callout_feature.test new file mode 100644 index 0000000000..b7de9b1bcb --- /dev/null +++ b/tests/languages/asciidoc/callout_feature.test @@ -0,0 +1,34 @@ +Foobar <1> +<1> Foo +1> Bar +> Baz + +|==== +| Foobar <1> +<1> Foo +1> Bar +> Baz +|==== + +---------------------------------------------------- + +[ + "Foobar ", ["callout", "<1>"], + ["callout", "<1>"], " Foo\r\n", + ["callout", "1>"], " Bar\r\n", + ["callout", ">"], " Baz\r\n\r\n", + + ["table", [ + ["punctuation", "|===="], + ["punctuation", "|"], + " Foobar ", ["callout", "<1>"], + ["callout", "<1>"], " Foo\r\n", + ["callout", "1>"], " Bar\r\n", + ["callout", ">"], " Baz\r\n", + ["punctuation", "|===="] + ]] +] + +---------------------------------------------------- + +Checks for callouts. \ No newline at end of file diff --git a/tests/languages/asciidoc/comment-block_feature.test b/tests/languages/asciidoc/comment-block_feature.test new file mode 100644 index 0000000000..4c4248edf5 --- /dev/null +++ b/tests/languages/asciidoc/comment-block_feature.test @@ -0,0 +1,19 @@ +//// +//// + +//// +Foobar + +Baz +//// + +---------------------------------------------------- + +[ + ["comment-block", "////\r\n////"], + ["comment-block", "////\r\nFoobar\r\n\r\nBaz\r\n////"] +] + +---------------------------------------------------- + +Checks for comment blocks. \ No newline at end of file diff --git a/tests/languages/asciidoc/comment_feature.test b/tests/languages/asciidoc/comment_feature.test new file mode 100644 index 0000000000..c2ccc51b50 --- /dev/null +++ b/tests/languages/asciidoc/comment_feature.test @@ -0,0 +1,41 @@ +// +// Foobar + +****** +// +// Foobar +****** + +|====== +| +// +| +// Foobar +|====== + +---------------------------------------------------- + +[ + ["comment", "//"], + ["comment", "// Foobar"], + + ["other-block", [ + ["punctuation", "******"], + ["comment", "//"], + ["comment", "// Foobar"], + ["punctuation", "******"] + ]], + + ["table", [ + ["punctuation", "|======"], + ["punctuation", "|"], + ["comment", "//"], + ["punctuation", "|"], + ["comment", "// Foobar"], + ["punctuation", "|======"] + ]] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/tests/languages/asciidoc/entity_feature.test b/tests/languages/asciidoc/entity_feature.test new file mode 100644 index 0000000000..a3d5ce8175 --- /dev/null +++ b/tests/languages/asciidoc/entity_feature.test @@ -0,0 +1,48 @@ +➊ ¶ + +➊ ¶ +============ + +['➊ ¶'] + +-- +➊ ¶ +-- + +|====== +| ➊ ¶ +|====== + +---------------------------------------------------- + +[ + ["entity", "➊"], ["entity", "¶"], + ["title", [ + ["entity", "➊"], ["entity", "¶"], + ["punctuation", "============"] + ]], + ["attributes", [ + ["punctuation", "["], + ["interpreted", [ + ["punctuation", "'"], + ["entity", "➊"], ["entity", "¶"], + ["punctuation", "'"] + ]], + ["punctuation", "]"] + ]], + ["other-block", [ + ["punctuation", "--"], + ["entity", "➊"], ["entity", "¶"], + ["punctuation", "--"] + ]], + ["table", [ + ["punctuation", "|======"], + ["punctuation", "|"], + ["entity", "➊"], ["entity", "¶"], + ["punctuation", "|======"] + ]] +] + +---------------------------------------------------- + +Checks for entities. \ No newline at end of file diff --git a/tests/languages/asciidoc/hr_feature.test b/tests/languages/asciidoc/hr_feature.test new file mode 100644 index 0000000000..822a7dbb45 --- /dev/null +++ b/tests/languages/asciidoc/hr_feature.test @@ -0,0 +1,14 @@ +''' + +'''''''''' + +---------------------------------------------------- + +[ + ["hr", "'''"], + ["hr", "''''''''''"] +] + +---------------------------------------------------- + +Checks for hr. \ No newline at end of file diff --git a/tests/languages/asciidoc/indented-block_feature.test b/tests/languages/asciidoc/indented-block_feature.test new file mode 100644 index 0000000000..c6d665754a --- /dev/null +++ b/tests/languages/asciidoc/indented-block_feature.test @@ -0,0 +1,28 @@ +. + + (TM) __foobar__ + :bar: baz + + Foo *bar* baz + // Foobar + == Foobar == + + Title + ~~~~~ + ..... + ..... + +---------------------------------------------------- + +[ + ".\r\n\r\n", + ["indented-block", "\t(TM) __foobar__\r\n\t:bar: baz"], + ["indented-block", " Foo *bar* baz\r\n // Foobar\r\n == Foobar =="], + ["indented-block", " Title\r\n ~~~~~\r\n .....\r\n ....."] +] + +---------------------------------------------------- + +Checks for indented blocks. +Also checks that nothing gets highlighted inside. +The initial dot is required because tests are trimmed. \ No newline at end of file diff --git a/tests/languages/asciidoc/inline_feature.test b/tests/languages/asciidoc/inline_feature.test new file mode 100644 index 0000000000..d88a57080c --- /dev/null +++ b/tests/languages/asciidoc/inline_feature.test @@ -0,0 +1,521 @@ +_emphasis_ +``double quotes'' +`single quotes' +`monospace` +'emphasis' +*strong* ++monospace+ +#unquoted# + +_foo _ bar baz_ +`foo ' bar baz' +`foo ` bar baz` +'foo ' bar baz' +*foo * bar baz* ++foo + bar baz+ +#foo # bar baz# + +_foo +bar_ +``foo +bar'' +`foo +bar' +`foo +bar` +'foo +bar' +*foo +bar* ++foo +bar+ +#foo +bar# + +foo__emphasis__bar +foo**strong**bar +foo++monospace++bar +foo+++passthrough+++bar +foo##unquoted##bar +foo$$passthrough$$bar +foo~subscript~bar +foo^superscript^bar +foo{attribute-reference}bar +foo[[anchor]]bar +foo[[[bibliography anchor]]]bar +foo<>bar +foo(((indexes)))bar +foo((indexes))bar + +==== +_emphasis_ +``double quotes'' +`single quotes' +`monospace` +'emphasis' +*strong* ++monospace+ +#unquoted# +__emphasis__ +**strong** +++monospace++ ++++passthrough+++ +##unquoted## +$$passthrough$$ +~subscript~ +^superscript^ +{attribute-reference} +[[anchor]] +[[[bibliography anchor]]] +<> +(((indexes))) +((indexes)) +==== + +|==== +| +_emphasis_ +``double quotes'' +`single quotes' +`monospace` +'emphasis' +*strong* ++monospace+ +#unquoted# +__emphasis__ +**strong** +++monospace++ ++++passthrough+++ +##unquoted## +$$passthrough$$ +~subscript~ +^superscript^ +{attribute-reference} +[[anchor]] +[[[bibliography anchor]]] +<> +(((indexes))) +((indexes)) +|==== + +['foo *bar* baz'] + +== foo *bar* baz == + +{names=value} +{names?value} +{names!value} +{names#value} +{names%value} +{names@regexp:value1:value2} +{names$regexp:value1:value2} +{names$regexp::value} +{foo,bar=foobar} +{foo+bar=foobar} +{counter:attrname} + +---------------------------------------------------- + +[ + ["inline", [ + ["italic", [["punctuation", "_"], "emphasis", ["punctuation", "_"]]] + ]], + ["inline", [ + ["punctuation", "``"], "double quotes", ["punctuation", "''"] + ]], + ["inline", [ + ["punctuation", "`"], "single quotes", ["punctuation", "'"] + ]], + ["inline", [ + ["punctuation", "`"], "monospace", ["punctuation", "`"] + ]], + ["inline", [ + ["italic", [["punctuation", "'"], "emphasis", ["punctuation", "'"]]] + ]], + ["inline", [ + ["bold", [["punctuation", "*"], "strong", ["punctuation", "*"]]] + ]], + ["inline", [ + ["punctuation", "+"], "monospace", ["punctuation", "+"] + ]], + ["inline", [ + ["punctuation", "#"], "unquoted", ["punctuation", "#"] + ]], + + ["inline", [ + ["italic", [["punctuation", "_"], "foo _ bar baz", ["punctuation", "_"]]] + ]], + ["inline", [ + ["punctuation", "`"], "foo ' bar baz", ["punctuation", "'"] + ]], + ["inline", [ + ["punctuation", "`"], "foo ` bar baz", ["punctuation", "`"] + ]], + ["inline", [ + ["italic", [["punctuation", "'"], "foo ' bar baz", ["punctuation", "'"]]] + ]], + ["inline", [ + ["bold", [["punctuation", "*"], "foo * bar baz", ["punctuation", "*"]]] + ]], + ["inline", [ + ["punctuation", "+"], "foo + bar baz", ["punctuation", "+"] + ]], + ["inline", [ + ["punctuation", "#"], "foo # bar baz", ["punctuation", "#"] + ]], + + ["inline", [ + ["italic", [["punctuation", "_"], "foo\r\nbar", ["punctuation", "_"]]] + ]], + ["inline", [ + ["punctuation", "``"], "foo\r\nbar", ["punctuation", "''"] + ]], + ["inline", [ + ["punctuation", "`"], "foo\r\nbar", ["punctuation", "'"] + ]], + ["inline", [ + ["punctuation", "`"], "foo\r\nbar", ["punctuation", "`"] + ]], + ["inline", [ + ["italic", [["punctuation", "'"], "foo\r\nbar", ["punctuation", "'"]]] + ]], + ["inline", [ + ["bold", [["punctuation", "*"], "foo\r\nbar", ["punctuation", "*"]]] + ]], + ["inline", [ + ["punctuation", "+"], "foo\r\nbar", ["punctuation", "+"] + ]], + ["inline", [ + ["punctuation", "#"], "foo\r\nbar", ["punctuation", "#"] + ]], + + "\r\n\r\nfoo", + ["inline", [ + ["italic", [["punctuation", "__"], "emphasis", ["punctuation", "__"]]] + ]], + "bar\r\nfoo", + ["inline", [ + ["bold", [["punctuation", "**"], "strong", ["punctuation", "**"]]] + ]], + "bar\r\nfoo", + ["inline", [ + ["punctuation", "++"], "monospace", ["punctuation", "++"] + ]], + "bar\r\nfoo", + ["inline", [ + ["punctuation", "+++"], "passthrough", ["punctuation", "+++"] + ]], + "bar\r\nfoo", + ["inline", [ + ["punctuation", "##"], "unquoted", ["punctuation", "##"] + ]], + "bar\r\nfoo", + ["inline", [ + ["punctuation", "$$"], "passthrough", ["punctuation", "$$"] + ]], + "bar\r\nfoo", + ["inline", [ + ["punctuation", "~"], "subscript", ["punctuation", "~"] + ]], + "bar\r\nfoo", + ["inline", [ + ["punctuation", "^"], "superscript", ["punctuation", "^"] + ]], + "bar\r\nfoo", + ["inline", [ + ["attribute-ref", [["punctuation", "{"], ["variable", "attribute-reference"], ["punctuation", "}"]]] + ]], + "bar\r\nfoo", + ["inline", [ + ["url", [["punctuation", "[["], "anchor", ["punctuation", "]]"]]] + ]], + "bar\r\nfoo", + ["inline", [ + ["url", [["punctuation", "[[["], "bibliography anchor", ["punctuation", "]]]"]]] + ]], + "bar\r\nfoo", + ["inline", [ + ["url", [["punctuation", "<<"], "xref", ["punctuation", ">>"]]] + ]], + "bar\r\nfoo", + ["inline", [ + ["punctuation", "((("], "indexes", ["punctuation", ")))"] + ]], + "bar\r\nfoo", + ["inline", [ + ["punctuation", "(("], "indexes", ["punctuation", "))"] + ]], + "bar\r\n\r\n", + + ["other-block", [ + ["punctuation", "===="], + + ["inline", [ + ["italic", [["punctuation", "_"], "emphasis", ["punctuation", "_"]]] + ]], + ["inline", [ + ["punctuation", "``"], "double quotes", ["punctuation", "''"] + ]], + ["inline", [ + ["punctuation", "`"], "single quotes", ["punctuation", "'"] + ]], + ["inline", [ + ["punctuation", "`"], "monospace", ["punctuation", "`"] + ]], + ["inline", [ + ["italic", [["punctuation", "'"], "emphasis", ["punctuation", "'"]]] + ]], + ["inline", [ + ["bold", [["punctuation", "*"], "strong", ["punctuation", "*"]]] + ]], + ["inline", [ + ["punctuation", "+"], "monospace", ["punctuation", "+"] + ]], + ["inline", [ + ["punctuation", "#"], "unquoted", ["punctuation", "#"] + ]], + ["inline", [ + ["italic", [["punctuation", "__"], "emphasis", ["punctuation", "__"]]] + ]], + ["inline", [ + ["bold", [["punctuation", "**"], "strong", ["punctuation", "**"]]] + ]], + ["inline", [ + ["punctuation", "++"], "monospace", ["punctuation", "++"] + ]], + ["inline", [ + ["punctuation", "+++"], "passthrough", ["punctuation", "+++"] + ]], + ["inline", [ + ["punctuation", "##"], "unquoted", ["punctuation", "##"] + ]], + ["inline", [ + ["punctuation", "$$"], "passthrough", ["punctuation", "$$"] + ]], + ["inline", [ + ["punctuation", "~"], "subscript", ["punctuation", "~"] + ]], + ["inline", [ + ["punctuation", "^"], "superscript", ["punctuation", "^"] + ]], + ["inline", [ + ["attribute-ref", [["punctuation", "{"], ["variable", "attribute-reference"], ["punctuation", "}"]]] + ]], + ["inline", [ + ["url", [["punctuation", "[["], "anchor", ["punctuation", "]]"]]] + ]], + ["inline", [ + ["url", [["punctuation", "[[["], "bibliography anchor", ["punctuation", "]]]"]]] + ]], + ["inline", [ + ["url", [["punctuation", "<<"], "xref", ["punctuation", ">>"]]] + ]], + ["inline", [ + ["punctuation", "((("], "indexes", ["punctuation", ")))"] + ]], + ["inline", [ + ["punctuation", "(("], "indexes", ["punctuation", "))"] + ]], + + ["punctuation", "===="] + ]], + + ["table", [ + ["punctuation", "|===="], + ["punctuation", "|"], + + ["inline", [ + ["italic", [["punctuation", "_"], "emphasis", ["punctuation", "_"]]] + ]], + ["inline", [ + ["punctuation", "``"], "double quotes", ["punctuation", "''"] + ]], + ["inline", [ + ["punctuation", "`"], "single quotes", ["punctuation", "'"] + ]], + ["inline", [ + ["punctuation", "`"], "monospace", ["punctuation", "`"] + ]], + ["inline", [ + ["italic", [["punctuation", "'"], "emphasis", ["punctuation", "'"]]] + ]], + ["inline", [ + ["bold", [["punctuation", "*"], "strong", ["punctuation", "*"]]] + ]], + ["inline", [ + ["punctuation", "+"], "monospace", ["punctuation", "+"] + ]], + ["inline", [ + ["punctuation", "#"], "unquoted", ["punctuation", "#"] + ]], + ["inline", [ + ["italic", [["punctuation", "__"], "emphasis", ["punctuation", "__"]]] + ]], + ["inline", [ + ["bold", [["punctuation", "**"], "strong", ["punctuation", "**"]]] + ]], + ["inline", [ + ["punctuation", "++"], "monospace", ["punctuation", "++"] + ]], + ["inline", [ + ["punctuation", "+++"], "passthrough", ["punctuation", "+++"] + ]], + ["inline", [ + ["punctuation", "##"], "unquoted", ["punctuation", "##"] + ]], + ["inline", [ + ["punctuation", "$$"], "passthrough", ["punctuation", "$$"] + ]], + ["inline", [ + ["punctuation", "~"], "subscript", ["punctuation", "~"] + ]], + ["inline", [ + ["punctuation", "^"], "superscript", ["punctuation", "^"] + ]], + ["inline", [ + ["attribute-ref", [["punctuation", "{"], ["variable", "attribute-reference"], ["punctuation", "}"]]] + ]], + ["inline", [ + ["url", [["punctuation", "[["], "anchor", ["punctuation", "]]"]]] + ]], + ["inline", [ + ["url", [["punctuation", "[[["], "bibliography anchor", ["punctuation", "]]]"]]] + ]], + ["inline", [ + ["url", [["punctuation", "<<"], "xref", ["punctuation", ">>"]]] + ]], + ["inline", [ + ["punctuation", "((("], "indexes", ["punctuation", ")))"] + ]], + ["inline", [ + ["punctuation", "(("], "indexes", ["punctuation", "))"] + ]], + + ["punctuation", "|===="] + ]], + + ["attributes", [ + ["punctuation", "["], + ["interpreted", [ + ["punctuation", "'"], + "foo ", ["inline", [["bold", [["punctuation", "*"], "bar", ["punctuation", "*"]]]]], " baz", + ["punctuation", "'"] + ]], + ["punctuation", "]"] + ]], + + ["title", [ + ["punctuation", "=="], + " foo ", ["inline", [["bold", [["punctuation", "*"], "bar", ["punctuation", "*"]]]]], " baz ", + ["punctuation", "=="] + ]], + + ["inline", [ + ["attribute-ref", [ + ["punctuation", "{"], + ["variable", "names"], + ["operator", "="], + "value", + ["punctuation", "}"] + ]] + ]], + ["inline", [ + ["attribute-ref", [ + ["punctuation", "{"], + ["variable", "names"], + ["operator", "?"], + "value", + ["punctuation", "}"] + ]] + ]], + ["inline", [ + ["attribute-ref", [ + ["punctuation", "{"], + ["variable", "names"], + ["operator", "!"], + "value", + ["punctuation", "}"] + ]] + ]], + ["inline", [ + ["attribute-ref", [ + ["punctuation", "{"], + ["variable", "names"], + ["operator", "#"], + "value", + ["punctuation", "}"] + ]] + ]], + ["inline", [ + ["attribute-ref", [ + ["punctuation", "{"], + ["variable", "names"], + ["operator", "%"], + "value", + ["punctuation", "}"] + ]] + ]], + ["inline", [ + ["attribute-ref", [ + ["punctuation", "{"], + ["variable", "names"], + ["operator", "@"], + "regexp", ["punctuation", ":"], + "value1", ["punctuation", ":"], + "value2", + ["punctuation", "}"] + ]] + ]], + ["inline", [ + ["attribute-ref", [ + ["punctuation", "{"], + ["variable", "names"], + ["operator", "$"], + "regexp", ["punctuation", ":"], + "value1", ["punctuation", ":"], + "value2", + ["punctuation", "}"] + ]] + ]], + ["inline", [ + ["attribute-ref", [ + ["punctuation", "{"], + ["variable", "names"], + ["operator", "$"], + "regexp", ["punctuation", "::"], + "value", + ["punctuation", "}"] + ]] + ]], + ["inline", [ + ["attribute-ref", [ + ["punctuation", "{"], + ["variable", "foo,bar"], + ["operator", "="], + "foobar", + ["punctuation", "}"] + ]] + ]], + ["inline", [ + ["attribute-ref", [ + ["punctuation", "{"], + ["variable", "foo+bar"], + ["operator", "="], + "foobar", + ["punctuation", "}"] + ]] + ]], + ["inline", [ + ["attribute-ref", [ + ["punctuation", "{"], + ["variable", "counter"], + ["punctuation", ":"], + "attrname", + ["punctuation", "}"] + ]] + ]] +] + +---------------------------------------------------- + +Checks for all kinds of inline quoted text. \ No newline at end of file diff --git a/tests/languages/asciidoc/line-continuation_feature.test b/tests/languages/asciidoc/line-continuation_feature.test new file mode 100644 index 0000000000..651fa81fa3 --- /dev/null +++ b/tests/languages/asciidoc/line-continuation_feature.test @@ -0,0 +1,18 @@ +Foo + +bar + +* Foo ++ +bar + +---------------------------------------------------- + +[ + "Foo ", ["line-continuation", "+"], "\r\nbar\r\n\r\n", + ["list-punctuation", "*"], " Foo\r\n", + ["line-continuation", "+"], "\r\nbar" +] + +---------------------------------------------------- + +Checks for line continuations. \ No newline at end of file diff --git a/tests/languages/asciidoc/list-label_feature.test b/tests/languages/asciidoc/list-label_feature.test new file mode 100644 index 0000000000..3e95bb6ac4 --- /dev/null +++ b/tests/languages/asciidoc/list-label_feature.test @@ -0,0 +1,73 @@ +In:: +Lorem:: + Foo bar baz +Dolor::: + Ipsum:::: + Donec;; + Foobar + +____ +In:: +Lorem:: + Foo bar baz +Dolor::: + Ipsum:::: + Donec;; + Foobar +____ + +|======== +| +In:: +Lorem:: + Foo bar baz +Dolor::: + Ipsum:::: + Donec;; + Foobar +|======== + +---------------------------------------------------- + +[ + ["list-label", "In::"], + ["list-label", "Lorem::"], + "\r\n Foo bar baz\r\n", + ["list-label", "Dolor:::"], + ["list-label", "Ipsum::::"], + ["list-label", "Donec;;"], + "\r\n Foobar\r\n\r\n", + + ["other-block", [ + ["punctuation", "____"], + + ["list-label", "In::"], + ["list-label", "Lorem::"], + "\r\n Foo bar baz\r\n", + ["list-label", "Dolor:::"], + ["list-label", "Ipsum::::"], + ["list-label", "Donec;;"], + "\r\n Foobar\r\n", + + ["punctuation", "____"] + ]], + + ["table", [ + ["punctuation", "|========"], + ["punctuation", "|"], + + ["list-label", "In::"], + ["list-label", "Lorem::"], + "\r\n Foo bar baz\r\n", + ["list-label", "Dolor:::"], + ["list-label", "Ipsum::::"], + ["list-label", "Donec;;"], + "\r\n Foobar\r\n", + + ["punctuation", "|========"] + ]] +] + +---------------------------------------------------- + +Checks for list labels. \ No newline at end of file diff --git a/tests/languages/asciidoc/list-punctuation_feature.test b/tests/languages/asciidoc/list-punctuation_feature.test new file mode 100644 index 0000000000..60dbf13cb5 --- /dev/null +++ b/tests/languages/asciidoc/list-punctuation_feature.test @@ -0,0 +1,77 @@ +- Foo +* Foo +** Foo bar +*** Foo + 1. Foo + 2. Foo bar + 42. Foo +**** Foo +***** Foo bar + +. Foo +.. Foo + a. Foo + b. Foo + z. Foo +... Foo bar +.... Foo + i) Foo + vi) Bar + xxvii) Baz +..... Foo + +____ +. 1 +.. 2 +____ + +|=== +| +xi) a +xii) b +|=== + +---------------------------------------------------- + +[ + ["list-punctuation", "-"], " Foo\r\n", + ["list-punctuation", "*"], " Foo\r\n", + ["list-punctuation", "**"], " Foo bar\r\n", + ["list-punctuation", "***"], " Foo\r\n\t", + ["list-punctuation", "1."], " Foo\r\n\t", + ["list-punctuation", "2."], " Foo bar\r\n\t", + ["list-punctuation", "42."], " Foo\r\n", + ["list-punctuation", "****"], " Foo\r\n", + ["list-punctuation", "*****"], " Foo bar\r\n\r\n", + + ["list-punctuation", "."], " Foo\r\n", + ["list-punctuation", ".."], " Foo\r\n ", + ["list-punctuation", "a."], " Foo\r\n ", + ["list-punctuation", "b."], " Foo\r\n ", + ["list-punctuation", "z."], " Foo\r\n", + ["list-punctuation", "..."], " Foo bar\r\n", + ["list-punctuation", "...."], " Foo\r\n\t", + ["list-punctuation", "i)"], " Foo\r\n\t", + ["list-punctuation", "vi)"], " Bar\r\n\t", + ["list-punctuation", "xxvii)"], " Baz\r\n", + ["list-punctuation", "....."], " Foo\r\n\r\n", + + ["other-block", [ + ["punctuation", "____"], + ["list-punctuation", "."], " 1\r\n", + ["list-punctuation", ".."], " 2\r\n", + ["punctuation", "____"] + ]], + + ["table", [ + ["punctuation", "|==="], + ["punctuation", "|"], + ["list-punctuation", "xi)"], " a\r\n", + ["list-punctuation", "xii)"], " b\r\n", + ["punctuation", "|==="] + ]] +] + +---------------------------------------------------- + +Checks for list punctuation. \ No newline at end of file diff --git a/tests/languages/asciidoc/literal-block_feature.test b/tests/languages/asciidoc/literal-block_feature.test new file mode 100644 index 0000000000..9449ca06d1 --- /dev/null +++ b/tests/languages/asciidoc/literal-block_feature.test @@ -0,0 +1,46 @@ +---- +== Foobar == +Bar _baz_ (TM) <1> +* Foo <2> +<1> Foobar +2> Baz +---- + +....... +.Foo +. Foobar <1> +include::addendum.txt <2> +> Foo +> Bar +__Foo__**bar**{baz} +....... + +---------------------------------------------------- + +[ + ["literal-block", [ + ["punctuation", "----"], + "\r\n== Foobar ==\r\nBar _baz_ (TM) ", + ["callout", "<1>"], + "\r\n* Foo ", + ["callout", "<2>"], + ["callout", "<1>"], " Foobar\r\n", + ["callout", "2>"], " Baz\r\n", + ["punctuation", "----"] + ]], + ["literal-block", [ + ["punctuation", "......."], + "\r\n.Foo\r\n. Foobar ", + ["callout", "<1>"], + "\r\ninclude::addendum.txt ", + ["callout", "<2>"], + ["callout", ">"], " Foo\r\n", + ["callout", ">"], " Bar\r\n__Foo__**bar**{baz}\r\n", + ["punctuation", "......."] + ]] +] + +---------------------------------------------------- + +Checks for literal blocks and listing blocks. +Also checks that nothing gets highlighted inside expect callouts. diff --git a/tests/languages/asciidoc/macro_feature.test b/tests/languages/asciidoc/macro_feature.test new file mode 100644 index 0000000000..50ee161609 --- /dev/null +++ b/tests/languages/asciidoc/macro_feature.test @@ -0,0 +1,250 @@ +footnote:[An example footnote.] +indexterm:[Tigers,Big cats] + +http://www.docbook.org/[DocBook.org] +include::chapt1.txt[tabsize=2] +mailto:srackham@gmail.com[] + +image:screen-thumbnail.png[height=32,link="screen.png"] + +== Foo image:foo.jpg[] == + +-- +footnote:[An example footnote.] +indexterm:[Tigers,Big cats] + +http://www.docbook.org/[DocBook.org] +include::chapt1.txt[tabsize=2] +mailto:srackham@gmail.com[] + +image:screen-thumbnail.png[height=32,link="screen.png"] +-- + +|==== +| +footnote:[An example footnote.] +indexterm:[Tigers,Big cats] + +http://www.docbook.org/[DocBook.org] +include::chapt1.txt[tabsize=2] +mailto:srackham@gmail.com[] + +image:screen-thumbnail.png[height=32,link="screen.png"] +|==== + +---------------------------------------------------- + +[ + ["macro", [ + ["function", "footnote"], ["punctuation", ":"], + ["attributes", [ + ["punctuation", "["], + ["attr-value", "An example footnote."], + ["punctuation", "]"] + ]] + ]], + ["macro", [ + ["function", "indexterm"], ["punctuation", ":"], + ["attributes", [ + ["punctuation", "["], + ["attr-value", "Tigers"], + ["punctuation", ","], + ["attr-value", "Big cats"], + ["punctuation", "]"] + ]] + ]], + ["macro", [ + ["function", "http"], ["punctuation", ":"], + "//www.docbook.org/", + ["attributes", [ + ["punctuation", "["], + ["attr-value", "DocBook.org"], + ["punctuation", "]"] + ]] + ]], + ["macro", [ + ["function", "include"], ["punctuation", "::"], + "chapt1.txt", + ["attributes", [ + ["punctuation", "["], + ["variable", "tabsize"], + ["operator", "="], + ["attr-value", "2"], + ["punctuation", "]"] + ]] + ]], + ["macro", [ + ["function", "mailto"], ["punctuation", ":"], + "srackham@gmail.com", + ["attributes", [ + ["punctuation", "["], ["punctuation", "]"] + ]] + ]], + ["macro", [ + ["function", "image"], ["punctuation", ":"], + "screen-thumbnail.png", + ["attributes", [ + ["punctuation", "["], + ["variable", "height"], + ["operator", "="], + ["attr-value", "32"], + ["punctuation", ","], + ["variable", "link"], + ["operator", "="], + ["string", "\"screen.png\""], + ["punctuation", "]"] + ]] + ]], + + ["title", [ + ["punctuation", "=="], + " Foo ", + ["macro", [ + ["function", "image"], ["punctuation", ":"], + "foo.jpg", + ["attributes", [ + ["punctuation", "["], ["punctuation", "]"] + ]] + ]], + ["punctuation", "=="] + ]], + + ["other-block", [ + ["punctuation", "--"], + + ["macro", [ + ["function", "footnote"], ["punctuation", ":"], + ["attributes", [ + ["punctuation", "["], + ["attr-value", "An example footnote."], + ["punctuation", "]"] + ]] + ]], + ["macro", [ + ["function", "indexterm"], ["punctuation", ":"], + ["attributes", [ + ["punctuation", "["], + ["attr-value", "Tigers"], + ["punctuation", ","], + ["attr-value", "Big cats"], + ["punctuation", "]"] + ]] + ]], + ["macro", [ + ["function", "http"], ["punctuation", ":"], + "//www.docbook.org/", + ["attributes", [ + ["punctuation", "["], + ["attr-value", "DocBook.org"], + ["punctuation", "]"] + ]] + ]], + ["macro", [ + ["function", "include"], ["punctuation", "::"], + "chapt1.txt", + ["attributes", [ + ["punctuation", "["], + ["variable", "tabsize"], + ["operator", "="], + ["attr-value", "2"], + ["punctuation", "]"] + ]] + ]], + ["macro", [ + ["function", "mailto"], ["punctuation", ":"], + "srackham@gmail.com", + ["attributes", [ + ["punctuation", "["], ["punctuation", "]"] + ]] + ]], + ["macro", [ + ["function", "image"], ["punctuation", ":"], + "screen-thumbnail.png", + ["attributes", [ + ["punctuation", "["], + ["variable", "height"], + ["operator", "="], + ["attr-value", "32"], + ["punctuation", ","], + ["variable", "link"], + ["operator", "="], + ["string", "\"screen.png\""], + ["punctuation", "]"] + ]] + ]], + + ["punctuation", "--"] + ]], + + ["table", [ + ["punctuation", "|===="], + ["punctuation", "|"], + + ["macro", [ + ["function", "footnote"], ["punctuation", ":"], + ["attributes", [ + ["punctuation", "["], + ["attr-value", "An example footnote."], + ["punctuation", "]"] + ]] + ]], + ["macro", [ + ["function", "indexterm"], ["punctuation", ":"], + ["attributes", [ + ["punctuation", "["], + ["attr-value", "Tigers"], + ["punctuation", ","], + ["attr-value", "Big cats"], + ["punctuation", "]"] + ]] + ]], + ["macro", [ + ["function", "http"], ["punctuation", ":"], + "//www.docbook.org/", + ["attributes", [ + ["punctuation", "["], + ["attr-value", "DocBook.org"], + ["punctuation", "]"] + ]] + ]], + ["macro", [ + ["function", "include"], ["punctuation", "::"], + "chapt1.txt", + ["attributes", [ + ["punctuation", "["], + ["variable", "tabsize"], + ["operator", "="], + ["attr-value", "2"], + ["punctuation", "]"] + ]] + ]], + ["macro", [ + ["function", "mailto"], ["punctuation", ":"], + "srackham@gmail.com", + ["attributes", [ + ["punctuation", "["], ["punctuation", "]"] + ]] + ]], + ["macro", [ + ["function", "image"], ["punctuation", ":"], + "screen-thumbnail.png", + ["attributes", [ + ["punctuation", "["], + ["variable", "height"], + ["operator", "="], + ["attr-value", "32"], + ["punctuation", ","], + ["variable", "link"], + ["operator", "="], + ["string", "\"screen.png\""], + ["punctuation", "]"] + ]] + ]], + + ["punctuation", "|===="] + ]] +] + +---------------------------------------------------- + +Checks for macros. \ No newline at end of file diff --git a/tests/languages/asciidoc/other-block_feature.test b/tests/languages/asciidoc/other-block_feature.test new file mode 100644 index 0000000000..fb33c207f6 --- /dev/null +++ b/tests/languages/asciidoc/other-block_feature.test @@ -0,0 +1,45 @@ +**** +Sidebar block <1> +**** + +______ +Quote block <2> +______ + +======== +Example block <3> +======== + +-- +Open block <4> +-- + +---------------------------------------------------- + +[ + ["other-block", [ + ["punctuation", "****"], + "\r\nSidebar block <1>\r\n", + ["punctuation", "****"] + ]], + ["other-block", [ + ["punctuation", "______"], + "\r\nQuote block <2>\r\n", + ["punctuation", "______"] + ]], + ["other-block", [ + ["punctuation", "========"], + "\r\nExample block <3>\r\n", + ["punctuation", "========"] + ]], + ["other-block", [ + ["punctuation", "--"], + "\r\nOpen block <4>\r\n", + ["punctuation", "--"] + ]] +] + +---------------------------------------------------- + +Checks for sidebar blocks, quote blocks, example blocks and open blocks. +Also checks that callouts are not highlighted. \ No newline at end of file diff --git a/tests/languages/asciidoc/page-break_feature.test b/tests/languages/asciidoc/page-break_feature.test new file mode 100644 index 0000000000..010a590133 --- /dev/null +++ b/tests/languages/asciidoc/page-break_feature.test @@ -0,0 +1,14 @@ +<<< + +<<<<<<<<<<<<< + +---------------------------------------------------- + +[ + ["page-break", "<<<"], + ["page-break", "<<<<<<<<<<<<<"] +] + +---------------------------------------------------- + +Checks for page breaks. \ No newline at end of file diff --git a/tests/languages/asciidoc/passthrough-block_feature.test b/tests/languages/asciidoc/passthrough-block_feature.test new file mode 100644 index 0000000000..a5bb08b43c --- /dev/null +++ b/tests/languages/asciidoc/passthrough-block_feature.test @@ -0,0 +1,29 @@ +++++ +.Fo__o__bar *baz* +Fo(((o)))bar baz +* Foobar baz +include::addendum.txt[] +++++ + +---------------------------------------------------- + +[ + ["passthrough-block", [ + ["punctuation", "++++"], + "\r\n.Fo__o__bar *baz*\r\nFo(((o)))bar baz\r\n* Foobar baz\r\n", + ["macro", [ + ["function", "include"], + ["punctuation", "::"], + "addendum.txt", + ["attributes", [ + ["punctuation", "["], ["punctuation", "]"] + ]] + ]], + ["punctuation", "++++"] + ]] +] + +---------------------------------------------------- + +Checks for passthrough blocks. +Also checks that nothing gets highlighted inside expect macros. \ No newline at end of file diff --git a/tests/languages/asciidoc/replacement_feature.test b/tests/languages/asciidoc/replacement_feature.test new file mode 100644 index 0000000000..ca27610e21 --- /dev/null +++ b/tests/languages/asciidoc/replacement_feature.test @@ -0,0 +1,48 @@ +(C) (TM) (R) + +(C) (TM) (R) +============ + +['(C) (TM) (R)'] + +-- +(C) (TM) (R) +-- + +|====== +| (C) (TM) (R) +|====== + +---------------------------------------------------- + +[ + ["replacement", "(C)"], ["replacement", "(TM)"], ["replacement", "(R)"], + ["title", [ + ["replacement", "(C)"], ["replacement", "(TM)"], ["replacement", "(R)"], + ["punctuation", "============"] + ]], + ["attributes", [ + ["punctuation", "["], + ["interpreted", [ + ["punctuation", "'"], + ["replacement", "(C)"], ["replacement", "(TM)"], ["replacement", "(R)"], + ["punctuation", "'"] + ]], + ["punctuation", "]"] + ]], + ["other-block", [ + ["punctuation", "--"], + ["replacement", "(C)"], ["replacement", "(TM)"], ["replacement", "(R)"], + ["punctuation", "--"] + ]], + ["table", [ + ["punctuation", "|======"], + ["punctuation", "|"], + ["replacement", "(C)"], ["replacement", "(TM)"], ["replacement", "(R)"], + ["punctuation", "|======"] + ]] +] + +---------------------------------------------------- + +Checks for replacements. \ No newline at end of file diff --git a/tests/languages/asciidoc/table_feature.test b/tests/languages/asciidoc/table_feature.test new file mode 100644 index 0000000000..0b4bd3c69a --- /dev/null +++ b/tests/languages/asciidoc/table_feature.test @@ -0,0 +1,61 @@ +|=== +|1 +|=== + +|============================ +|1 >s|2 |3 |4 +^|5 2.2+^.^|6 .3+<.>m|7 +2*^|8 +|9 2+>|10 +|============================ + +|============================================== +|Normal cell + +|Cell with nested table + +!============================================== +!Nested table cell 1 !Nested table cell 2 +!============================================== + +|============================================== + +---------------------------------------------------- + +[ + ["table", [ + ["punctuation", "|==="], + ["punctuation", "|"], "1\r\n", + ["punctuation", "|==="] + ]], + + ["table", [ + ["punctuation", "|============================"], + ["punctuation", "|"], "1 ", + ["specifiers", ">s"], ["punctuation", "|"], "2 ", + ["punctuation", "|"], "3 ", + ["punctuation", "|"], "4\r\n", + ["specifiers", "^"], ["punctuation", "|"], "5 ", + ["specifiers", "2.2+^.^"], ["punctuation", "|"], "6 ", + ["specifiers", ".3+<.>m"], ["punctuation", "|"], "7\r\n", + ["specifiers", "2*^"], ["punctuation", "|"], "8\r\n", + ["punctuation", "|"], "9 ", + ["specifiers", "2+>"], ["punctuation", "|"], "10\r\n", + ["punctuation", "|============================"] + ]], + + ["table", [ + ["punctuation", "|=============================================="], + ["punctuation", "|"], "Normal cell\r\n\r\n", + ["punctuation", "|"], "Cell with nested table\r\n\r\n", + ["punctuation", "!=============================================="], + ["punctuation", "!"], "Nested table cell 1 ", + ["punctuation", "!"], "Nested table cell 2\r\n", + ["punctuation", "!=============================================="], + ["punctuation", "|=============================================="] + ]] +] + +---------------------------------------------------- + +Checks for tables. \ No newline at end of file diff --git a/tests/languages/asciidoc/title_feature.test b/tests/languages/asciidoc/title_feature.test new file mode 100644 index 0000000000..a9d4047428 --- /dev/null +++ b/tests/languages/asciidoc/title_feature.test @@ -0,0 +1,80 @@ +Foobar +====== + +Foobar +------ + +Foobar +~~~~~~ + +Foobar +^^^^^^ + +Foo ++++ + += Foo bar baz = +== Foo bar baz +=== Foo bar baz === +==== Foo bar baz +===== Foo bar baz ===== + +.Foo bar baz + +---------------------------------------------------- + +[ + ["title", [ + "Foobar\r\n", + ["punctuation", "======"] + ]], + ["title", [ + "Foobar\r\n", + ["punctuation", "------"] + ]], + ["title", [ + "Foobar\r\n", + ["punctuation", "~~~~~~"] + ]], + ["title", [ + "Foobar\r\n", + ["punctuation", "^^^^^^"] + ]], + ["title", [ + "Foo\r\n", + ["punctuation", "+++"] + ]], + + ["title", [ + ["punctuation", "="], + " Foo bar baz ", + ["punctuation", "="] + ]], + ["title", [ + ["punctuation", "=="], + " Foo bar baz" + ]], + ["title", [ + ["punctuation", "==="], + " Foo bar baz ", + ["punctuation", "==="] + ]], + ["title", [ + ["punctuation", "===="], + " Foo bar baz" + ]], + ["title", [ + ["punctuation", "====="], + " Foo bar baz ", + ["punctuation", "====="] + ]], + + ["title", [ + ["punctuation", "."], + "Foo bar baz" + ]] +] + +---------------------------------------------------- + +Checks for titles. \ No newline at end of file