diff --git a/src/bibtex_js.js b/src/bibtex_js.js index f5c6ba4..52a6a2f 100644 --- a/src/bibtex_js.js +++ b/src/bibtex_js.js @@ -277,7 +277,7 @@ function BibtexParser() { end = this.pos + 1; if (this.tryMatch("}")) { this.match("}"); - } else { + } else if (this.tryMatch(")")) { this.match(")"); } if (this.tryMatch(",")) { @@ -312,7 +312,8 @@ function BibtexDisplay() { this.regExps.push(new RegExp("\\\\\\W*\{\\w+\}")); // 2 \[]{\[]} this.regExps.push(new RegExp("\\\\\\W*\\w+\\s")); // 3 \[] this.regExps.push(new RegExp("\\\\\\W*\\w+")); // 4 \[] - this.regExps.push(new RegExp("\\\\(?![:\\\\\])\\W{1}")); // 5 + this.regExps.push(new RegExp("\\\\\\w\{\\w\}")); // 5 \\\w{\w} to match e.g. \v{r} + this.regExps.push(new RegExp("\\\\(?![:\\\\\])\\W{1}")); // 6 this.fixValue = function(value) { do { @@ -347,6 +348,7 @@ function BibtexDisplay() { } } value = value.replace(/[\{|\}]/g, ''); + value = value.replace(/\$(.*?)\$/, '$1'); // remove $..$ used for math env. return value; } @@ -3568,4 +3570,4 @@ var latex_to_unicode = { "{\\o}": "\u00D8", "{\AA}": "\u212B", "\\relax ": "" -}; \ No newline at end of file +};