mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Extracts envs to separate file so they can be exported to rich text
This commit is contained in:
parent
33742d447d
commit
1f9c1ca6c6
2 changed files with 34 additions and 29 deletions
|
@ -1,31 +1,7 @@
|
|||
define () ->
|
||||
environments = [
|
||||
"abstract",
|
||||
"align", "align*",
|
||||
"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
|
||||
define [
|
||||
'ide/editor/directives/aceEditor/auto-complete/snippets/Environments'
|
||||
], (Environments) ->
|
||||
staticSnippets = for env in Environments.withoutSnippets
|
||||
{
|
||||
caption: "\\begin{#{env}}..."
|
||||
snippet: """
|
||||
|
@ -151,7 +127,7 @@ define () ->
|
|||
result = []
|
||||
iterations = 0
|
||||
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]}
|
||||
iterations += 1
|
||||
if iterations >= 1000
|
||||
|
|
|
@ -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
|
||||
}
|
Loading…
Reference in a new issue