diff --git a/grammars/language-asciidoc.cson b/grammars/language-asciidoc.cson index f4a674a..76cddd5 100644 --- a/grammars/language-asciidoc.cson +++ b/grammars/language-asciidoc.cson @@ -227,10 +227,10 @@ repository: patterns: [ { name: "markup.explicit.asciidoc" - match: "^\\[((normal|literal|listing|TIP|NOTE|IMPORTANT|WARNING|CAUTION|partintro|comment|example|sidebar|source|music|latex|graphviz))\\]$" + match: "^\\[((normal|literal|listing|TIP|NOTE|IMPORTANT|WARNING|CAUTION|partintro|comment|example|sidebar|source|music|latex|graphviz))\\]$(? @@ -70,15 +75,15 @@ module.exports = begin: "^\\s*(`{3,})\\s*(?i:(#{lang.pattern}))\\s*$" beginCaptures: 0: name: 'support.asciidoc' - end: '^\\s*\\1\\s*$' - endCaptures: - 0: name: 'support.asciidoc' contentName: "#{lang.type}.embedded.#{lang.code}" patterns: [ include: '#block-callout' , include: "#{lang.type}.#{lang.code}" ] + end: '^\\s*\\1\\s*$' + endCaptures: + 0: name: 'support.asciidoc' # add generic block codeBlocks.push @@ -86,11 +91,12 @@ module.exports = begin: '^\\s*(`{3,}).*$' beginCaptures: 0: name: 'support.asciidoc' - patterns: [include: '#block-callout'] + patterns: [ + include: '#block-callout' + ] end: '^\\s*\\1\\s*$' endCaptures: 0: name: 'support.asciidoc' - if debug - console.log CSON.stringify codeBlocks + if debug then console.log CSON.stringify codeBlocks codeBlocks diff --git a/spec/blocks/code-block-grammar-spec.coffee b/spec/blocks/code-block-grammar-spec.coffee index c6d3632..abefc90 100644 --- a/spec/blocks/code-block-grammar-spec.coffee +++ b/spec/blocks/code-block-grammar-spec.coffee @@ -29,9 +29,9 @@ describe 'Should tokenizes code block when', -> expect(tokens).toHaveLength 7 # Number of lines expect(tokens[0]).toHaveLength 5 expect(tokens[0][0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'support.asciidoc'] - expect(tokens[0][1]).toEqualJson value: 'source', scopes: ['source.asciidoc', 'support.asciidoc', 'constant.asciidoc'] + expect(tokens[0][1]).toEqualJson value: 'source', scopes: ['source.asciidoc', 'support.asciidoc', 'entity.name.function.asciidoc'] expect(tokens[0][2]).toEqualJson value: ',', scopes: ['source.asciidoc', 'support.asciidoc'] - expect(tokens[0][3]).toEqualJson value: 'shell', scopes: ['source.asciidoc', 'support.asciidoc', 'string.asciidoc'] + expect(tokens[0][3]).toEqualJson value: 'shell', scopes: ['source.asciidoc', 'support.asciidoc', 'entity.name.type.asciidoc'] expect(tokens[0][4]).toEqualJson value: ']', scopes: ['source.asciidoc', 'support.asciidoc'] expect(tokens[1]).toHaveLength 1 expect(tokens[1][0]).toEqualJson value: '----', scopes: ['source.asciidoc', 'markup.code.shell.asciidoc', 'support.asciidoc'] @@ -77,13 +77,13 @@ describe 'Should tokenizes code block when', -> expect(tokens).toHaveLength 4 # Number of lines expect(tokens[0]).toHaveLength 9 expect(tokens[0][0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'support.asciidoc'] - expect(tokens[0][1]).toEqualJson value: 'source', scopes: ['source.asciidoc', 'support.asciidoc', 'constant.asciidoc'] + expect(tokens[0][1]).toEqualJson value: 'source', scopes: ['source.asciidoc', 'support.asciidoc', 'entity.name.function.asciidoc'] expect(tokens[0][2]).toEqualJson value: ',', scopes: ['source.asciidoc', 'support.asciidoc'] - expect(tokens[0][3]).toEqualJson value: 'java', scopes: ['source.asciidoc', 'support.asciidoc', 'string.asciidoc'] + expect(tokens[0][3]).toEqualJson value: 'java', scopes: ['source.asciidoc', 'support.asciidoc', 'entity.name.type.asciidoc'] expect(tokens[0][4]).toEqualJson value: ',', scopes: ['source.asciidoc', 'support.asciidoc'] - expect(tokens[0][5]).toEqualJson value: 'subs="', scopes: ['source.asciidoc', 'support.asciidoc'] - expect(tokens[0][6]).toEqualJson value: '{markup-in-source}', scopes: ['source.asciidoc', 'support.asciidoc', 'markup.substitution.attribute-reference.asciidoc'] - expect(tokens[0][7]).toEqualJson value: '"', scopes: ['source.asciidoc', 'support.asciidoc'] + expect(tokens[0][5]).toEqualJson value: 'subs="', scopes: ['source.asciidoc', 'support.asciidoc', 'markup.meta.attribute-list.asciidoc'] + expect(tokens[0][6]).toEqualJson value: '{markup-in-source}', scopes: ['source.asciidoc', 'support.asciidoc', 'markup.meta.attribute-list.asciidoc', 'markup.substitution.attribute-reference.asciidoc'] + expect(tokens[0][7]).toEqualJson value: '"', scopes: ['source.asciidoc', 'support.asciidoc', 'markup.meta.attribute-list.asciidoc'] expect(tokens[0][8]).toEqualJson value: ']', scopes: ['source.asciidoc', 'support.asciidoc'] expect(tokens[1]).toHaveLength 1 expect(tokens[1][0]).toEqualJson value: '----', scopes: ['source.asciidoc', 'markup.code.java.asciidoc', 'support.asciidoc'] diff --git a/spec/blocks/quote-grammar-spec.coffee b/spec/blocks/quote-grammar-spec.coffee index c391cf0..b283ae6 100644 --- a/spec/blocks/quote-grammar-spec.coffee +++ b/spec/blocks/quote-grammar-spec.coffee @@ -26,11 +26,11 @@ describe 'Should tokenizes quote block when', -> expect(tokens).toHaveLength 4 expect(tokens[0]).toHaveLength 7 expect(tokens[0][0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc'] - expect(tokens[0][1]).toEqualJson value: 'quote', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc', 'none.quotes.label.asciidoc' ] + expect(tokens[0][1]).toEqualJson value: 'quote', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc', 'entity.name.function.label.asciidoc' ] expect(tokens[0][2]).toEqualJson value: ', ', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc'] - expect(tokens[0][3]).toEqualJson value: 'Erwin Schrödinger', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc', 'none.quotes.attribution.asciidoc'] + expect(tokens[0][3]).toEqualJson value: 'Erwin Schrödinger', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc', 'string.unquoted.attribution.asciidoc'] expect(tokens[0][4]).toEqualJson value: ', ', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc'] - expect(tokens[0][5]).toEqualJson value: 'Sorry', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc', 'none.quotes.citetitle.asciidoc'] + expect(tokens[0][5]).toEqualJson value: 'Sorry', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc', 'string.unquoted.citetitle.asciidoc'] expect(tokens[0][6]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc'] expect(tokens[1]).toHaveLength 1 expect(tokens[1][0]).toEqualJson value: '____', scopes: ['source.asciidoc', 'markup.italic.quotes.asciidoc'] @@ -43,9 +43,9 @@ describe 'Should tokenizes quote block when', -> {tokens} = grammar.tokenizeLine '[verse, Homer Simpson]\n' expect(tokens).toHaveLength 6 expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc'] - expect(tokens[1]).toEqualJson value: 'verse', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc', 'none.quotes.label.asciidoc'] + expect(tokens[1]).toEqualJson value: 'verse', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc', 'entity.name.function.label.asciidoc'] expect(tokens[2]).toEqualJson value: ', ', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc'] - expect(tokens[3]).toEqualJson value: 'Homer Simpson', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc', 'none.quotes.attribution.asciidoc'] + expect(tokens[3]).toEqualJson value: 'Homer Simpson', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc', 'string.unquoted.attribution.asciidoc'] expect(tokens[4]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc'] expect(tokens[5]).toEqualJson value: '\n', scopes: ['source.asciidoc'] @@ -53,11 +53,11 @@ describe 'Should tokenizes quote block when', -> {tokens} = grammar.tokenizeLine '[quote, Erwin Schrödinger, Sorry]\n' expect(tokens).toHaveLength 8 expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc'] - expect(tokens[1]).toEqualJson value: 'quote', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc', 'none.quotes.label.asciidoc'] + expect(tokens[1]).toEqualJson value: 'quote', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc', 'entity.name.function.label.asciidoc'] expect(tokens[2]).toEqualJson value: ', ', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc'] - expect(tokens[3]).toEqualJson value: 'Erwin Schrödinger', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc', 'none.quotes.attribution.asciidoc'] + expect(tokens[3]).toEqualJson value: 'Erwin Schrödinger', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc', 'string.unquoted.attribution.asciidoc'] expect(tokens[4]).toEqualJson value: ', ', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc'] - expect(tokens[5]).toEqualJson value: 'Sorry', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc', 'none.quotes.citetitle.asciidoc'] + expect(tokens[5]).toEqualJson value: 'Sorry', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc', 'string.unquoted.citetitle.asciidoc'] expect(tokens[6]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.italic.quotes.attributes.asciidoc'] expect(tokens[7]).toEqualJson value: '\n', scopes: ['source.asciidoc'] diff --git a/spec/code-block-generator-spec.coffee b/spec/code-block-generator-spec.coffee index 2c029b1..9529ac6 100644 --- a/spec/code-block-generator-spec.coffee +++ b/spec/code-block-generator-spec.coffee @@ -9,22 +9,24 @@ describe 'Code block generator', -> codeBlocks = generator.makeAsciidocBlocks(languages) expect(codeBlocks).toHaveLength 2 # Number of blocks expect(codeBlocks[0]).toEqualJson - begin: '^\\[(source)(?:,([^,\\]]*)){0,2}\\]$' + begin: '^\\[(source)(,([^\\]]*))?\\]$' beginCaptures: 0: name: 'support.asciidoc' - 1: name: 'constant.asciidoc' - 2: name: 'string.asciidoc' + 1: name: 'entity.name.function.asciidoc' + 2: name: 'markup.meta.attribute-list.asciidoc' + end: '(?<=----)[\\r\\n]+$' patterns: [ name: 'markup.raw.asciidoc' begin: '^(-{4,})\\s*$' beginCaptures: 0: name: 'support.asciidoc' - patterns: [include: '#block-callout'] + patterns: [ + include: '#block-callout' + ] end: '^\\1*$' endCaptures: 0: name: 'support.asciidoc' ] - end: '(?<=----)[\\r\\n]+$' it 'should generate listing block', -> languages = [] @@ -35,7 +37,9 @@ describe 'Code block generator', -> begin: '^(-{4,})\\s*$' beginCaptures: 0: name: 'support.asciidoc' - patterns: [include: '#block-callout'] + patterns: [ + include: '#block-callout' + ] end: '^\\1*$' endCaptures: 0: name: 'support.asciidoc' @@ -50,9 +54,10 @@ describe 'Code block generator', -> begin: '^\\[(source),\\p{Blank}*(?i:(javascript|js))(?:,([^\]]*))?\\]$' beginCaptures: 0: name: 'support.asciidoc' - 1: name: 'constant.asciidoc' - 2: name: 'string.asciidoc' + 1: name: 'entity.name.function.asciidoc' + 2: name: 'entity.name.type.asciidoc' 3: + name: 'markup.meta.attribute-list.asciidoc' patterns: [ include: '#attribute-reference' ] @@ -83,9 +88,10 @@ describe 'Code block generator', -> begin: '^\\[(source),\\p{Blank}*(?i:(c(pp|\\+\\+)))(?:,([^\]]*))?\\]$' beginCaptures: 0: name: 'support.asciidoc' - 1: name: 'constant.asciidoc' - 2: name: 'string.asciidoc' + 1: name: 'entity.name.function.asciidoc' + 2: name: 'entity.name.type.asciidoc' 3: + name: 'markup.meta.attribute-list.asciidoc' patterns: [ include: '#attribute-reference' ] diff --git a/spec/inlines/characters-grammar-spec.coffee b/spec/inlines/characters-grammar-spec.coffee index 0ccf2d1..a6ee0f8 100644 --- a/spec/inlines/characters-grammar-spec.coffee +++ b/spec/inlines/characters-grammar-spec.coffee @@ -20,9 +20,9 @@ describe 'Should tokenizes characters when', -> {tokens} = grammar.tokenizeLine 'Dungeons & Dragons' expect(tokens).toHaveLength 5 expect(tokens[0]).toEqualJson value: 'Dungeons ', scopes: ['source.asciidoc'] - expect(tokens[1]).toEqualJson value: '&', scopes: ['source.asciidoc', 'markup.htmlentity.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqualJson value: 'amp', scopes: ['source.asciidoc', 'markup.htmlentity.asciidoc'] - expect(tokens[3]).toEqualJson value: ';', scopes: ['source.asciidoc', 'markup.htmlentity.asciidoc', 'support.constant.asciidoc'] + expect(tokens[1]).toEqualJson value: '&', scopes: ['source.asciidoc', 'markup.character-reference.asciidoc', 'constant.character.asciidoc'] + expect(tokens[2]).toEqualJson value: 'amp', scopes: ['source.asciidoc', 'markup.character-reference.asciidoc'] + expect(tokens[3]).toEqualJson value: ';', scopes: ['source.asciidoc', 'markup.character-reference.asciidoc', 'constant.character.asciidoc'] expect(tokens[4]).toEqualJson value: ' Dragons', scopes: ['source.asciidoc'] it 'contains space (invalid context)', -> diff --git a/spec/grammar-properties-lang-spec.coffee b/spec/language-properties-spec.coffee similarity index 100% rename from spec/grammar-properties-lang-spec.coffee rename to spec/language-properties-spec.coffee diff --git a/spec/partials/block-callout-grammar-spec.coffee b/spec/partials/block-callout-grammar-spec.coffee index df1e0e2..d58bbcc 100644 --- a/spec/partials/block-callout-grammar-spec.coffee +++ b/spec/partials/block-callout-grammar-spec.coffee @@ -29,9 +29,9 @@ describe 'Should tokenizes callout in code block when', -> expect(tokens).toHaveLength 8 expect(tokens[0]).toHaveLength 5 expect(tokens[0][0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'support.asciidoc'] - expect(tokens[0][1]).toEqualJson value: 'source', scopes: ['source.asciidoc', 'support.asciidoc', 'constant.asciidoc'] + expect(tokens[0][1]).toEqualJson value: 'source', scopes: ['source.asciidoc', 'support.asciidoc', 'entity.name.function.asciidoc'] expect(tokens[0][2]).toEqualJson value: ', ', scopes: ['source.asciidoc', 'support.asciidoc'] - expect(tokens[0][3]).toEqualJson value: 'js', scopes: ['source.asciidoc', 'support.asciidoc', 'string.asciidoc'] + expect(tokens[0][3]).toEqualJson value: 'js', scopes: ['source.asciidoc', 'support.asciidoc', 'entity.name.type.asciidoc'] expect(tokens[0][4]).toEqualJson value: ']', scopes: ['source.asciidoc', 'support.asciidoc'] expect(tokens[1]).toHaveLength 1 expect(tokens[1][0]).toEqualJson value: '----', scopes: ['source.asciidoc', 'markup.code.js.asciidoc', 'support.asciidoc'] diff --git a/spec/partials/explicit-paragraph-grammar-spec.coffee b/spec/partials/explicit-paragraph-grammar-spec.coffee index c067cb4..f6583f8 100644 --- a/spec/partials/explicit-paragraph-grammar-spec.coffee +++ b/spec/partials/explicit-paragraph-grammar-spec.coffee @@ -19,121 +19,121 @@ describe 'Should tokenizes explicit paragraph when', -> it 'use "normal" keyword', -> {tokens} = grammar.tokenizeLine '[normal]' expect(tokens).toHaveLength 3 - expect(tokens[0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[1]).toEqual value: 'normal', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[1]).toEqualJson value: 'normal', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] it 'use "literal" keyword', -> {tokens} = grammar.tokenizeLine '[literal]' expect(tokens).toHaveLength 3 - expect(tokens[0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[1]).toEqual value: 'literal', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[1]).toEqualJson value: 'literal', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] it 'use "listing" keyword', -> {tokens} = grammar.tokenizeLine '[listing]' expect(tokens).toHaveLength 3 - expect(tokens[0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[1]).toEqual value: 'listing', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[1]).toEqualJson value: 'listing', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] it 'use "TIP" keyword', -> {tokens} = grammar.tokenizeLine '[TIP]' expect(tokens).toHaveLength 3 - expect(tokens[0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[1]).toEqual value: 'TIP', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[1]).toEqualJson value: 'TIP', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] it 'use "NOTE" keyword', -> {tokens} = grammar.tokenizeLine '[NOTE]' expect(tokens).toHaveLength 3 - expect(tokens[0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[1]).toEqual value: 'NOTE', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[1]).toEqualJson value: 'NOTE', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] it 'use "IMPORTANT" keyword', -> {tokens} = grammar.tokenizeLine '[IMPORTANT]' expect(tokens).toHaveLength 3 - expect(tokens[0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[1]).toEqual value: 'IMPORTANT', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[1]).toEqualJson value: 'IMPORTANT', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] it 'use "WARNING" keyword', -> {tokens} = grammar.tokenizeLine '[WARNING]' expect(tokens).toHaveLength 3 - expect(tokens[0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[1]).toEqual value: 'WARNING', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[1]).toEqualJson value: 'WARNING', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] it 'use "CAUTION" keyword', -> {tokens} = grammar.tokenizeLine '[CAUTION]' expect(tokens).toHaveLength 3 - expect(tokens[0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[1]).toEqual value: 'CAUTION', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[1]).toEqualJson value: 'CAUTION', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] it 'use "partintro" keyword', -> {tokens} = grammar.tokenizeLine '[partintro]' expect(tokens).toHaveLength 3 - expect(tokens[0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[1]).toEqual value: 'partintro', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[1]).toEqualJson value: 'partintro', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] it 'use "comment" keyword', -> {tokens} = grammar.tokenizeLine '[comment]' expect(tokens).toHaveLength 3 - expect(tokens[0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[1]).toEqual value: 'comment', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[1]).toEqualJson value: 'comment', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] it 'use "example" keyword', -> {tokens} = grammar.tokenizeLine '[example]' expect(tokens).toHaveLength 3 - expect(tokens[0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[1]).toEqual value: 'example', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[1]).toEqualJson value: 'example', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] it 'use "WARNING" keyword', -> {tokens} = grammar.tokenizeLine '[WARNING]' expect(tokens).toHaveLength 3 - expect(tokens[0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[1]).toEqual value: 'WARNING', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[1]).toEqualJson value: 'WARNING', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] it 'use "sidebar" keyword', -> {tokens} = grammar.tokenizeLine '[sidebar]' expect(tokens).toHaveLength 3 - expect(tokens[0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[1]).toEqual value: 'sidebar', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[1]).toEqualJson value: 'sidebar', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] it 'use "source" keyword', -> {tokens} = grammar.tokenizeLine '[source]' expect(tokens).toHaveLength 3 - expect(tokens[0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[1]).toEqual value: 'source', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[1]).toEqualJson value: 'source', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] it 'use "music" keyword', -> {tokens} = grammar.tokenizeLine '[music]' expect(tokens).toHaveLength 3 - expect(tokens[0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[1]).toEqual value: 'music', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[1]).toEqualJson value: 'music', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] it 'use "latex" keyword', -> {tokens} = grammar.tokenizeLine '[latex]' expect(tokens).toHaveLength 3 - expect(tokens[0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[1]).toEqual value: 'latex', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[1]).toEqualJson value: 'latex', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] it 'use "graphviz" keyword', -> {tokens} = grammar.tokenizeLine '[graphviz]' expect(tokens).toHaveLength 3 - expect(tokens[0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[1]).toEqual value: 'graphviz', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[1]).toEqualJson value: 'graphviz', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] it 'simple title with example block', -> @@ -145,12 +145,12 @@ describe 'Should tokenizes explicit paragraph when', -> ''' expect(tokens).toHaveLength 4 expect(tokens[0]).toHaveLength 3 - expect(tokens[0][0]).toEqual value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] - expect(tokens[0][1]).toEqual value: 'example', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'support.constant.asciidoc'] - expect(tokens[0][2]).toEqual value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0][0]).toEqualJson value: '[', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] + expect(tokens[0][1]).toEqualJson value: 'example', scopes: ['source.asciidoc', 'markup.explicit.asciidoc', 'entity.name.function.asciidoc'] + expect(tokens[0][2]).toEqualJson value: ']', scopes: ['source.asciidoc', 'markup.explicit.asciidoc'] expect(tokens[1]).toHaveLength 1 - expect(tokens[1][0]).toEqual value: '====', scopes: ['source.asciidoc', 'markup.block.example.asciidoc'] + expect(tokens[1][0]).toEqualJson value: '====', scopes: ['source.asciidoc', 'markup.block.example.asciidoc'] expect(tokens[2]).toHaveLength 1 - expect(tokens[2][0]).toEqual value: 'foobar', scopes: ['source.asciidoc', 'markup.block.example.asciidoc'] + expect(tokens[2][0]).toEqualJson value: 'foobar', scopes: ['source.asciidoc', 'markup.block.example.asciidoc'] expect(tokens[3]).toHaveLength 1 - expect(tokens[3][0]).toEqual value: '====', scopes: ['source.asciidoc', 'markup.block.example.asciidoc'] + expect(tokens[3][0]).toEqualJson value: '====', scopes: ['source.asciidoc', 'markup.block.example.asciidoc'] diff --git a/styles/asciidoc.atom-text-editor.less b/styles/asciidoc.atom-text-editor.less index c908b97..27afc42 100644 --- a/styles/asciidoc.atom-text-editor.less +++ b/styles/asciidoc.atom-text-editor.less @@ -15,7 +15,7 @@ atom-text-editor::shadow, :host { font-style: italic; } - &.htmlentity { + &.character-reference { font-style: italic; color: mix(red, @syntax-text-color, 20%); } @@ -26,9 +26,8 @@ atom-text-editor::shadow, :host { color: mix(green, @syntax-text-color, 20%); } - &.reference { + &.xref { font-style: italic; - color: mix(green, @syntax-text-color, 20%); } &.admonition, @@ -44,18 +43,18 @@ atom-text-editor::shadow, :host { font-weight: bold; // Lighten headers for dark themes. - & when (lightness(@syntax-background-color) < 50%){ + & when (lightness(@syntax-background-color) < 50%) { color: lighten(@syntax-text-color, 20%); } // Darken headers for light themes. - & when (lightness(@syntax-background-color) > 50%){ + & when (lightness(@syntax-background-color) > 50%) { color: darken(@syntax-text-color, 20%); } } &.heading.blocktitle, - &.substitution{ + &.substitution { color: @syntax-text-color-unobtrusive; } &.meta.attribute-list {