11
11
// Switching the engines to use the FILE:LINE-style error messages could help a lot.
13
13
parenRE = new RegExp("[()]");
14
newFileRE = new RegExp("^\\(([\\./][^ )]+)");
14
// Should catch filenames of the following forms:
19
// * \\server\abc, "\\server\abc"
20
// Caveats: filenames with escaped " or space in the filename don't work (correctly)
21
newFileRE = new RegExp("^\\(\"?((?:\\./|/|.\\\\|[a-zA-Z]:\\\\|\\\\\\\\[^\\\" )]+\\\\)[^\" )]+)");
15
22
lineNumRE = new RegExp("^l\\.(\\d+)");
16
23
badLineRE = new RegExp("^(?:Over|Under)full \\\\hbox.*at lines (\\d+)");
17
24
warnLineRE = new RegExp("^(?:LaTeX|Package (?:.*)) Warning: .*");
18
25
warnLineNumRE = new RegExp("on input line (\\d+).");
30
function trim (zeichenkette) {
31
return zeichenkette.replace (/^\s+/, '').replace (/\s+$/, '');
21
34
// get the text from the standard console output
22
35
txt = TW.target.consoleOutput;
68
81
error[0] = curFile;
70
matched = warnLineNumRE.exec(line);
85
while (++i < lines.length) {
88
error[2] += "\n" + line;
90
matched = warnLineNumRE.exec(error[2].replace(/\n/, ""));
72
92
error[1] = matched[1];
74
while (line != "" && i < lines.length) {
130
function htmlize(str) {
132
html = html.replace(/&/g, "&");
133
html = html.replace(/</g, "<");
134
html = html.replace(/>/g, ">");
135
html = html.replace(/\n /g, "\n ");
136
html = html.replace(/ /g, " ");
137
html = html.replace(/ /g, " ");
138
return html.replace(/\n/g, "<br />\n");
142
function makeResultRow(data, color) {
144
var url = 'texworks:' + data[0] + (data[1] != '?' && data[1] != 0 ? '#' + data[1] : '');
146
html += '<td width="10" style="background-color: ' + color + '"></td>';
147
html += '<td valign="top"><a href="' + url + '">' + data[0] + '</a></td>';
148
html += '<td valign="top">' + data[1] + '</td>';
149
html += '<td valign="top" style="font-family: monospace;">' + htmlize(data[2]) + '</td>';
116
154
// finally, return our result (if any)
117
if (result.length > 0) {
155
if (errors.length > 0 || warnings.length > 0 || infos.length > 0) {
156
html = '<html><body>';
157
html += '<table border="1" cellspacing="0" cellpadding="4">';
159
for(i = 0; i < errors.length; ++i)
160
html += makeResultRow(errors[i], 'red');
161
for(i = 0; i < warnings.length; ++i)
162
html += makeResultRow(warnings[i], 'yellow');
163
for(i = 0; i < infos.length; ++i)
164
html += makeResultRow(infos[i], '#8080ff');
167
html += "</body></html>";