Explorar el Código

Upgrade biber-log-parser.js

Shane Kilkelly hace 10 años
padre
commit
08de7b8abe
Se han modificado 1 ficheros con 9 adiciones y 2 borrados
  1. 9 2
      services/web/public/js/libs/biber-log-parser.js

+ 9 - 2
services/web/public/js/libs/biber-log-parser.js

@@ -12,7 +12,7 @@ define(function() {
       throw new Error("BiberLogParser Error: text parameter must be a string");
       throw new Error("BiberLogParser Error: text parameter must be a string");
     }
     }
     this.text = text.replace(/(\r\n)|\r/g, '\n');
     this.text = text.replace(/(\r\n)|\r/g, '\n');
-    this.options = options;
+    this.options = options || {};
     this.lines = text.split('\n');
     this.lines = text.split('\n');
   };
   };
   (function() {
   (function() {
@@ -26,7 +26,7 @@ define(function() {
         typesetting: []
         typesetting: []
       };
       };
       this.lines.forEach(function(line) {
       this.lines.forEach(function(line) {
-        var fullLine, lineNumber, match, message, messageType, newEntry;
+        var _, fileName, fullLine, lineMatch, lineNumber, match, message, messageType, newEntry, realMessage;
         match = line.match(LINE_SPLITTER_REGEX);
         match = line.match(LINE_SPLITTER_REGEX);
         if (match) {
         if (match) {
           fullLine = match[0], lineNumber = match[1], messageType = match[2], message = match[3];
           fullLine = match[0], lineNumber = match[1], messageType = match[2], message = match[3];
@@ -37,6 +37,13 @@ define(function() {
             line: null,
             line: null,
             raw: fullLine
             raw: fullLine
           };
           };
+          lineMatch = newEntry.message.match(/^BibTeX subsystem: \/.*\/(\w*\.\w*)_.*, line (\d+), (.*)$/);
+          if (lineMatch && lineMatch.length === 4) {
+            _ = lineMatch[0], fileName = lineMatch[1], lineNumber = lineMatch[2], realMessage = lineMatch[3];
+            newEntry.file = fileName;
+            newEntry.line = lineNumber;
+            newEntry.message = realMessage;
+          }
           result.all.push(newEntry);
           result.all.push(newEntry);
           switch (newEntry.level) {
           switch (newEntry.level) {
             case 'error':
             case 'error':