diff --git a/.gitmodules b/.gitmodules index 0335cb46..5820ec5f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -100,3 +100,6 @@ [submodule "assets/syntaxes/HTML (Twig)"] path = assets/syntaxes/HTML (Twig) url = https://github.com/Anomareh/PHP-Twig.tmbundle.git +[submodule "assets/syntaxes/AsciiDoc"] + path = assets/syntaxes/AsciiDoc + url = https://github.com/SublimeText/AsciiDoc.git diff --git a/assets/syntaxes.bin b/assets/syntaxes.bin index 9c7dd552..d52ca6d5 100644 Binary files a/assets/syntaxes.bin and b/assets/syntaxes.bin differ diff --git a/assets/syntaxes/AsciiDoc b/assets/syntaxes/AsciiDoc new file mode 160000 index 00000000..d0089991 --- /dev/null +++ b/assets/syntaxes/AsciiDoc @@ -0,0 +1 @@ +Subproject commit d0089991e5db83a6cb2c505b2ea3548f559ed2af diff --git a/assets/syntaxes/AsciiDoc.sublime-syntax b/assets/syntaxes/AsciiDoc.sublime-syntax new file mode 100644 index 00000000..7bc64431 --- /dev/null +++ b/assets/syntaxes/AsciiDoc.sublime-syntax @@ -0,0 +1,283 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: AsciiDoc +comment: | + A very early hack. Mostly ripped from other syntaxes. + Only the very basic stuff is working. +file_extensions: + - adoc + - asciidoc + - asc +scope: text.html.asciidoc +contexts: + main: + - include: heading_inline + - include: heading-block + - include: heading-blockattr + - match: \$\$(?!\$) + push: + - meta_scope: comment.block.passthrough.macro.doubledollar.asciidoc + - match: \$\$(?!\$) + pop: true + - match: \+\+\+(?!\+) + push: + - meta_scope: comment.block.passthrough.macro.tripeplus.asciidoc + - match: \+\+\+(?!\+) + pop: true + - match: (//).*$\n? + scope: comment.line.double-slash.asciidoc + - match: |- + (?x)^ + (?= ([/+-.*_=]{4,})\s*$ + | ([ \t]{1,}) + | [=]{1,6}\s*+ + | [ ]{,3}(?[-*_])([ ]{,2}\k){2,}[ \t]*+$ + ) + push: + - meta_scope: meta.block-level.asciidoc + - match: |- + (?x)^ + (?! \1 + | ([ \t]{1,}) + | [=]{1,6}\s*+ + | [ ]{,3}(?[-*_])([ ]{,2}\k){2,}[ \t]*+$ + ) + pop: true + - include: block_quote + - include: block_raw + - include: heading_inline + - include: heading-block + - include: separator + - match: '^[ ]{0,3}([*+-])(?=\s)' + captures: + 1: punctuation.definition.list_item.asciidoc + push: + - meta_scope: markup.list.unnumbered.asciidoc + - match: ^(?=\S) + captures: + 1: punctuation.definition.list_item.asciidoc + pop: true + - include: list-paragraph + - match: '^[ ]{0,3}[0-9]+(\.)(?=\s)' + captures: + 1: punctuation.definition.list_item.asciidoc + push: + - meta_scope: markup.list.numbered.asciidoc + - match: ^(?=\S) + captures: + 1: punctuation.definition.list_item.asciidoc + pop: true + - include: list-paragraph + - match: '^([/+-.*_=]){4,}\s*$' + push: + - meta_scope: comment.block.asciidoc + - match: '^\1{4,}\s*$' + pop: true + - match: '^([/+.]){4,}\s*$' + comment: asciidoc formatting is disabled inside certain blocks. + push: + - meta_scope: meta.disable-asciidoc + - match: '^[/+.]{4,}\s*$' + pop: true + - match: '^(?=\S)(?![=-]{3,}(?=$))(?!\.\S+)' + push: + - meta_scope: meta.paragraph.asciidoc + - match: '^(?:\s*$|(?=[ ]{,3}>.))|(?=[ \t]*\n)(?<=^===|^====|=====|^---|^----|-----)[ \t]*\n' + pop: true + - include: inline + - include: scope:text.html.basic + - match: '^(={3,})(?=[ \t]*$)' + scope: markup.heading.0.asciidoc + captures: + 1: punctuation.definition.heading.asciidoc + - match: '^(-{3,})(?=[ \t]*$)' + scope: markup.heading.1.asciidoc + captures: + 1: punctuation.definition.heading.asciidoc + - match: '^(~{3,})(?=[ \t]*$)' + scope: markup.heading.2.asciidoc + captures: + 1: punctuation.definition.heading.asciidoc + - match: '^(\^{3,})(?=[ \t]*$)' + scope: markup.heading.3.asciidoc + captures: + 1: punctuation.definition.heading.asciidoc + - match: '^(\+{3,})(?=[ \t]*$)' + scope: markup.heading.4.asciidoc + captures: + 1: punctuation.definition.heading.asciidoc + attribute-entry: + - match: '^:[-_. A-Za-z0-9]+:\s*(.*)\s*$' + scope: variable.other + attribute-reference: + - match: "{[-_. A-Za-z0-9]+}" + scope: variable.other + attribute-reference-predefined: + - match: "{(?i:amp|asciidoc-dir|asciidoc-file|asciidoc-version|author|authored|authorinitials|backend-docbook|backend-xhtml11|backend-html4|docbook-article|xhtml11-article|html4-article|docbook-book|xhtml11-book|html4-book|docbook-manpage|xhtml11-manpage|html4-manpage|backend|backslash|basebackend|brvbar|date|docdate|doctime|docname|docfile|docdir|doctitle|doctype-article|doctype-book|doctype-manpage|doctype|email|empty|encoding|filetype|firstname|gt|id|indir|infile|lastname|level|listindex|localdate|localtime|lt|manname|manpurpose|mantitle|manvolnum|middlename|nbsp|outdir|outfile|reftext|revision|sectnum|showcomments|title|two_colons|two_semicolons|user-dir|verbose)}" + scope: support.variable + block_quote: + - match: '^([/+-.*_=]){4,}\s*$' + push: + - meta_scope: comment.block.asciidoc + - match: '^\1{4,}\s*$' + pop: true + block_raw: + - match: '\G([ ]{4}|\t).*$\n?' + scope: markup.raw.block.asciidoc + bracket: + - match: '<(?![a-z/?\$!])' + comment: | + asciidoc will convert this for us. We match it so that the + HTML grammar will not mark it up as invalid. + scope: meta.other.valid-bracket.asciidoc + character-replacements: + - match: \(C\)|\(R\)|\(TM\)|--(?!-)|\.\.\.(?!\.)|->|<-|=>|<= + scope: constant.character.asciidoc + escape: + - match: '\\[-`*_#+.!(){}\[\]\\>:]' + scope: constant.character.escape.asciidoc + heading: + - match: '(?m)^(\S+)$([=-~^+])+\s*$' + scope: markup.heading.asciidoc + captures: + 1: punctuation.definition.heading.asciidoc + heading-block: + - match: ^\.(\w.*)$ + scope: markup.heading.asciidoc + captures: + 1: punctuation.definition.heading.asciidoc + heading-blockattr: + - match: '^\[\[?(\w.*)\]$' + scope: markup.heading.asciidoc + captures: + 1: punctuation.definition.heading.asciidoc + heading_inline: + - match: '\G(={1,6})(?!=)\s*(?=\S)' + captures: + 1: punctuation.definition.heading.asciidoc + push: + - meta_scope: markup.heading.asciidoc + - meta_content_scope: entity.name.section.asciidoc + - match: \s*(=*)$\n? + captures: + 1: punctuation.definition.heading.asciidoc + pop: true + - include: inline + inline: + - include: line-break + - include: line-page-break + - include: line-ruler + - include: escape + - include: passthrough-macro-trippleplus-inline + - include: passthrough-macro-doubledollar-inline + - include: character-replacements + - include: bracket + - include: raw + - include: text-quote-single + - include: text-quote-double + - include: text-quote-other + - include: text-bold-unconstrained + - include: text-italic-unconstrained + - include: text-monospace-unconstrained + - include: text-unquoted-unconstrained + - include: text-bold + - include: text-italic + - include: text-monospace + - include: text-unquoted + - include: attribute-entry + - include: attribute-reference-predefined + - include: attribute-reference + line-break: + - match: (?<=\S)\s+\+$ + scope: constant.character.escape.asciidoc + line-page-break: + - match: "^<{3,}$" + scope: constant.character.escape.asciidoc + line-ruler: + - match: "^'{3,}$" + scope: constant.character.escape.asciidoc + list-paragraph: + - match: \G\s+(?=\S) + push: + - meta_scope: meta.paragraph.list.asciidoc + - match: ^\s*$ + pop: true + - include: inline + passthrough-macro-doubledollar-inline: + - match: '(?:\[.*\])?\$\$(?!\$).+\$\$(?!\$)' + scope: comment.block.passthrough.asciidoc + passthrough-macro-trippleplus-inline: + - match: '(?:\[.*\])?\+\+\+(?!\+).+\+\+\+(?!\+)' + scope: comment.block.passthrough.asciidoc + raw: + - match: '(`+)(?:[^`]|(?!(?