From d4d6e2c45d499d1cc65a65aa5113987d285403f8 Mon Sep 17 00:00:00 2001 From: Hugh O'Brien Date: Tue, 14 Jul 2020 09:59:07 +0100 Subject: [PATCH] Merge pull request #3002 from overleaf/hb-parse-bst-errors Adds parser for bst file bibtex errors GitOrigin-RevId: 6481b0ca7cf6ab4522827ed5c6161b84472ccc19 --- .../web/frontend/js/vendor/libs/bib-log-parser.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/services/web/frontend/js/vendor/libs/bib-log-parser.js b/services/web/frontend/js/vendor/libs/bib-log-parser.js index dad0bd8b0c..a8326840b6 100644 --- a/services/web/frontend/js/vendor/libs/bib-log-parser.js +++ b/services/web/frontend/js/vendor/libs/bib-log-parser.js @@ -37,6 +37,8 @@ define(function() { MULTILINE_ERROR_REGEX = /^(.*)---line (\d+) of file (.*)\n([^]+?)\nI'm skipping whatever remains of this entry$/m; BAD_CROSS_REFERENCE_REGEX = /^(A bad cross reference---entry ".+?"\nrefers to entry.+?, which doesn't exist)$/m; MULTILINE_COMMAND_ERROR_REGEX = /^(.*)\n?---line (\d+) of file (.*)\n([^]+?)\nI'm skipping whatever remains of this command$/m; + // Errors hit in BST file have a slightly different format + BST_ERROR_REGEX = /^(.*?)\nwhile executing---line (\d+) of file (.*)/m; warningParsers = [ [ MULTILINE_WARNING_REGEX, function(match) { @@ -101,8 +103,21 @@ define(function() { raw: fullMatch }; } + ],[ + BST_ERROR_REGEX, function(match) { + var fileName, firstMessage, fullMatch, lineNumber, secondMessage; + fullMatch = match[0], firstMessage = match[1], lineNumber = match[2], fileName = match[3]; + return { + file: fileName, + level: "error", + message: firstMessage, + line: lineNumber, + raw: fullMatch + }; + } ] ]; + (function() { this.parseBibtex = function() { var allErrors, allWarnings, ref, ref1, remainingText, result;