Clean up a bit, and upgrade parser.

This commit is contained in:
Shane Kilkelly 2016-03-08 14:04:42 +00:00
parent 08de7b8abe
commit 471cb95091
2 changed files with 6 additions and 9 deletions

View file

@ -90,12 +90,11 @@ define [
$scope.pdf.logEntries = logEntries $scope.pdf.logEntries = logEntries
$scope.pdf.logEntries.all = logEntries.errors.concat(logEntries.warnings).concat(logEntries.typesetting) $scope.pdf.logEntries.all = logEntries.errors.concat(logEntries.warnings).concat(logEntries.typesetting)
# # # # # # # #
forward = () -> proceed = () ->
$scope.pdf.logEntryAnnotations = {} $scope.pdf.logEntryAnnotations = {}
for entry in logEntries.all for entry in logEntries.all
if entry.file? if entry.file?
entry.file = normalizeFilePath(entry.file) entry.file = normalizeFilePath(entry.file)
entity = ide.fileTreeManager.findEntityByPath(entry.file) entity = ide.fileTreeManager.findEntityByPath(entry.file)
if entity? if entity?
$scope.pdf.logEntryAnnotations[entity.id] ||= [] $scope.pdf.logEntryAnnotations[entity.id] ||= []
@ -104,23 +103,21 @@ define [
type: if entry.level == "error" then "error" else "warning" type: if entry.level == "error" then "error" else "warning"
text: entry.message text: entry.message
} }
# Get the biber log and parse it too
$http.get "/project/#{$scope.project_id}/output/output.blg" + qs $http.get "/project/#{$scope.project_id}/output/output.blg" + qs
.success (log) -> .success (log) ->
window._s = $scope window._s = $scope
console.log ">> yay"
console.log log
biberLogEntries = BiberLogParser.parse(log, {}) biberLogEntries = BiberLogParser.parse(log, {})
console.log biberLogEntries
if $scope.pdf.logEntries if $scope.pdf.logEntries
entries = $scope.pdf.logEntries entries = $scope.pdf.logEntries
all = biberLogEntries.errors.concat(biberLogEntries.warnings) all = biberLogEntries.errors.concat(biberLogEntries.warnings)
entries.all = entries.all.concat(all) entries.all = entries.all.concat(all)
entries.errors = entries.errors.concat(biberLogEntries.errors) entries.errors = entries.errors.concat(biberLogEntries.errors)
entries.warnings = entries.warnings.concat(biberLogEntries.warnings) entries.warnings = entries.warnings.concat(biberLogEntries.warnings)
forward() proceed()
.error (e) -> .error (e) ->
console.log ">> error", e console.error ">> error", e
forward() proceed()
# # # # # # # #
.error () -> .error () ->
$scope.pdf.logEntries = [] $scope.pdf.logEntries = []

View file

@ -37,7 +37,7 @@ define(function() {
line: null, line: null,
raw: fullLine raw: fullLine
}; };
lineMatch = newEntry.message.match(/^BibTeX subsystem: \/.*\/(\w*\.\w*)_.*, line (\d+), (.*)$/); lineMatch = newEntry.message.match(/^BibTeX subsystem: \/.+\/(\w+\.\w+)_.+, line (\d+), (.+)$/);
if (lineMatch && lineMatch.length === 4) { if (lineMatch && lineMatch.length === 4) {
_ = lineMatch[0], fileName = lineMatch[1], lineNumber = lineMatch[2], realMessage = lineMatch[3]; _ = lineMatch[0], fileName = lineMatch[1], lineNumber = lineMatch[2], realMessage = lineMatch[3];
newEntry.file = fileName; newEntry.file = fileName;