diff --git a/CHANGELOG.md b/CHANGELOG.md index ed2a365..b8e6277 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,15 @@ #### Upcoming +Proposed: +* Added support for \autocite command from biblatex +* Added support for file inclusion via the subimport package (\subimport command) +* Relaxed requirements of %TEX root magic (additional spaces allowed, case insensitive) +* Removed additional brace characters from citation view * Expanded autocomplete support to include [pandoc-style citations](http://pandoc.org/MANUAL.html#citations) when you're writing in [Markdown](https://guides.github.com/features/mastering-markdown/#syntax) (`.md`) or [Rmarkdown](http://rmarkdown.rstudio.com/) (`.Rmd`). * Added support for specifying your bibfile (for citation autocompletion) as part of a [YAML Metadata block](http://pandoc.org/MANUAL.html#extension-yaml_metadata_block) * UPDATED README with an example of pandoc citation autocompletion + #### 0.3.0 * Options to switch off autocompletion * Added Atom commands diff --git a/lib/citation.coffee b/lib/citation.coffee index 3fe58db..649b277 100644 --- a/lib/citation.coffee +++ b/lib/citation.coffee @@ -71,5 +71,5 @@ class Citation termInd = content.lastIndexOf(term) continue if termInd < 0 content = content.substring(0, termInd) - content = content.replace(/\s+/g," ") + content = content.replace(/\s+/g," ").replace(/{/g,"").replace(/}/g,"") @properties.push({name: name, content: content}) diff --git a/lib/cite-view.coffee b/lib/cite-view.coffee index 3431bcd..c102322 100644 --- a/lib/cite-view.coffee +++ b/lib/cite-view.coffee @@ -64,7 +64,7 @@ class CiteView extends SelectListView basePath = basePath.substring 0, basePath.lastIndexOf(pathModule.sep) bibFiles = @getBibFileFromText(@editor.getText()) if bibFiles == null or bibFiles.length == 0 - texRootRex = /%(\s+)?!TEX root(\s+)?=(\s+)?(.+)/g + texRootRex = /%(\s+)?!TEX root(\s+)?=(\s+)?(.+)/gi while(match = texRootRex.exec(@editor.getText())) absolutFilePath = FindLabels.getAbsolutePath(activePaneItemPath,match[4]) diff --git a/lib/find-labels.coffee b/lib/find-labels.coffee index b50609a..0a5551a 100644 --- a/lib/find-labels.coffee +++ b/lib/find-labels.coffee @@ -14,6 +14,10 @@ FindLabels = while (match = inputRex.exec(text)) matches = matches.concat( @getLabels(@getAbsolutePath(baseFile, match[2]), baseFile)) + inputRex = /\\(subimport){([^}]+)}{([^}]+)}/g + while (match = inputRex.exec(text)) + matches = matches.concat(@getLabels( + @getAbsolutePath(baseFile, match[2]+match[3]), baseFile)) matches getLabels: (file, baseFile) -> diff --git a/lib/label-view.coffee b/lib/label-view.coffee index c840877..34fc0f8 100644 --- a/lib/label-view.coffee +++ b/lib/label-view.coffee @@ -16,9 +16,9 @@ class LabelView extends SelectListView @editor = editor file = editor?.buffer?.file basePath = file?.path - texRootRex = /%!TEX root = (.+)/g + texRootRex = /%(\s+)?!TEX root(\s+)?=(\s+)?(.+)/gi while(match = texRootRex.exec(@editor.getText())) - absolutFilePath = FindLabels.getAbsolutePath(basePath,match[1]) + absolutFilePath = FindLabels.getAbsolutePath(basePath,match[4]) try text = fs.readFileSync(absolutFilePath).toString() labels = FindLabels.getLabelsByText(text, absolutFilePath) diff --git a/lib/latexer-hook.coffee b/lib/latexer-hook.coffee index 1f52917..efd1e7f 100644 --- a/lib/latexer-hook.coffee +++ b/lib/latexer-hook.coffee @@ -8,7 +8,7 @@ module.exports = beginRex: /\\begin{([^}]+)}/ mathRex: /(\\+)\[/ refRex: /\\(\w*ref({|{[^}]+,)|[cC](page)?refrange({[^,}]*})?{)$/ - citeRex: /\\\w*(cite|citet|citep|citet\*|citep\*)(\[[^\]]+\])?({|{[^}]+,)$/ + citeRex: /\\\w*(cite|autocite|citet|citep|citet\*|citep\*)(\[[^\]]+\])?({|{[^}]+,)$/ constructor: (@editor) -> @disposables = new CompositeDisposable @disposables.add @editor.onDidChangeTitle => @subscribeBuffer()