mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-18 06:42:11 -05:00
20 lines
731 B
CoffeeScript
20 lines
731 B
CoffeeScript
define [
|
|
"libs/latex-log-parser"
|
|
"ide/human-readable-logs/HumanReadableLogsRules"
|
|
], (LogParser, ruleset) ->
|
|
parse : (rawLog, options) ->
|
|
parsedLogEntries = LogParser.parse(rawLog, options)
|
|
|
|
_getRule = (logMessage) ->
|
|
return rule for rule in ruleset when rule.regexToMatch.test logMessage
|
|
|
|
for entry in parsedLogEntries.all
|
|
ruleDetails = _getRule entry.message
|
|
|
|
if (ruleDetails?)
|
|
entry.ruleId = 'hint_' + ruleDetails.regexToMatch.toString().replace(/\s/g, '_').slice(1, -1) if ruleDetails.regexToMatch?
|
|
|
|
entry.humanReadableHint = ruleDetails.humanReadableHint if ruleDetails.humanReadableHint?
|
|
entry.extraInfoURL = ruleDetails.extraInfoURL if ruleDetails.extraInfoURL?
|
|
|
|
return parsedLogEntries
|