Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support macro \cacheMeCode from robust-externalize #80

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/generate-latex-grammars.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ function generateMintedBlock(envNames, language, source, contentName=undefined)
}

/**
* Generate the json rules for a minted type block
* @param {string[]} envNames Typically minted
* Generate the json rules for a robust externalize type block
* @param {string[]} envNames Typically CacheMeCode
* @param {string[]} language A list of languages used to build an alternation
* @param {string} source The source language to include
* @param {string} contentName The scope to assign to the content. If undefined, use {@link source}
Expand Down
58 changes: 58 additions & 0 deletions syntaxes/LaTeX.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -1881,6 +1881,64 @@
}
]
},
{
"begin": "((\\\\)cacheMeCode(?=\\[))",
"end": "\\}",
"beginCaptures": {
"1": {
"name": "support.function.verb.latex"
},
"2": {
"name": "punctuation.definition.function.latex"
}
},
"endCaptures": {
"0": {
"name": "punctuation.definition.arguments.end.latex"
}
},
"patterns": [
{
"begin": "\\G(\\[)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.arguments.optional.begin.latex"
}
},
"end": "(?=\\})",
"patterns": [
{
"begin": "\\G",
"end": "(\\])(?=\\{)",
"endCaptures": {
"1": {
"name": "punctuation.definition.arguments.optional.end.latex"
}
},
"patterns": [
{
"include": "text.tex#braces"
},
{
"include": "$base"
}
]
},
{
"begin": "(?<=\\])(\\{)",
"end": "(?=\\})",
"beginCaptures": {
"0": {
"name": "punctuation.definition.arguments.begin.latex"
}
},
"contentName": "meta.function.embedded.latex",
"name": "meta.embedded.block.generic.latex"
}
]
}
]
},
{
"begin": "((\\\\)addplot)(?:\\+?)((?:\\[[^\\[]*\\]))*\\s*(gnuplot)\\s*((?:\\[[^\\[]*\\]))*\\s*(\\{)",
"captures": {
Expand Down
63 changes: 63 additions & 0 deletions syntaxes/src/LaTeX.tmLanguage.base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,69 @@ patterns:
contentName: meta.function.embedded.latex
end: ^\s*(?=\\end\{terminal\*?\})
name: meta.embedded.block.generic.latex
- begin: ((\\)cacheMeCode(?=\[))
end: \}
beginCaptures:
'1':
name: support.function.verb.latex
'2':
name: punctuation.definition.function.latex
endCaptures:
'0':
name: punctuation.definition.arguments.end.latex
patterns:
- begin: \G(\[)
beginCaptures:
'1':
name: punctuation.definition.arguments.optional.begin.latex
end: (?=\})
patterns:
- begin: \G
end: (\])(?=\{)
endCaptures:
'1':
name: punctuation.definition.arguments.optional.end.latex
patterns:
- include: text.tex#braces
- include: $base
- begin: (?<=\])(\{)
end: (?=\})
beginCaptures:
'0':
name: punctuation.definition.arguments.begin.latex
patterns:
- include: text.tex#braces
contentName: meta.function.embedded.latex
name: meta.embedded.block.generic.latex
# - begin: ((\\)cacheMeCode(?=\[))
# end: (?<=\})
# beginCaptures:
# '1':
# name: support.function.verb.latex
# '2':
# name: punctuation.definition.function.latex
# patterns:
# - begin: \[
# end: \]
# beginCaptures:
# '0':
# name: punctuation.definition.arguments.optional.begin.latex
# endCaptures:
# '0':
# name: punctuation.definition.arguments.optional.end.latex
# patterns:
# - include: text.tex#braces
# - include: $base
# - begin: (?<=\])\{
# end: \}
# beginCaptures:
# '0':
# name: punctuation.definition.arguments.begin.latex
# endCaptures:
# '0':
# name: punctuation.definition.arguments.end.latex
# contentName: meta.function.embedded.latex
# name: meta.embedded.block.generic.latex
- begin: ((\\)addplot)(?:\+?)((?:\[[^\[]*\]))*\s*(gnuplot)\s*((?:\[[^\[]*\]))*\s*(\{)
captures:
'1':
Expand Down