Extracts envs to separate file so they can be exported to rich text

This commit is contained in:
Alasdair Smith 2018-06-22 16:00:12 +01:00
parent 33742d447d
commit 1f9c1ca6c6
2 changed files with 34 additions and 29 deletions

View file

@ -1,31 +1,7 @@
define () -> define [
environments = [ 'ide/editor/directives/aceEditor/auto-complete/snippets/Environments'
"abstract", ], (Environments) ->
"align", "align*", staticSnippets = for env in Environments.withoutSnippets
"equation", "equation*",
"gather", "gather*",
"multline", "multline*",
"split",
"verbatim",
"quote",
"center"
]
snippetNames = [
"array",
"figure",
"tabular",
"table",
"list",
"enumerate",
"itemize",
"frame",
"thebibliography"
]
environmentNames = snippetNames.concat(environments)
staticSnippets = for env in environments
{ {
caption: "\\begin{#{env}}..." caption: "\\begin{#{env}}..."
snippet: """ snippet: """
@ -151,7 +127,7 @@ define () ->
result = [] result = []
iterations = 0 iterations = 0
while match = re.exec(text) while match = re.exec(text)
if match[1] not in environmentNames and match[1] != "document" if match[1] not in Environments.all and match[1] != "document"
result.push {name: match[1], whitespace: match[2]} result.push {name: match[1], whitespace: match[2]}
iterations += 1 iterations += 1
if iterations >= 1000 if iterations >= 1000

View file

@ -0,0 +1,29 @@
define () ->
envs = [
"abstract",
"align", "align*",
"equation", "equation*",
"gather", "gather*",
"multline", "multline*",
"split",
"verbatim",
"quote",
"center"
]
envsWithSnippets = [
"array",
"figure",
"tabular",
"table",
"list",
"enumerate",
"itemize",
"frame",
"thebibliography"
]
return {
all: envs.concat(envsWithSnippets)
withoutSnippets: envs
}