tex_log_parser 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -2
- data/lib/tex_log_parser/patterns/bad_hbox_warning.rb +5 -4
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d2c2a92c84683d3392c7372ea2a3920d14a285193aedfd96deffdb2298a9d1a
|
4
|
+
data.tar.gz: 8e700667425901781af7e0a4d297fc92973502d7da6e2fc266ba40d8937202ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8895e5afd489068f5f6eb20974ca1beca2838d87499c4193d68f2d6bffa0b5e8323d021a16fdd4624e24f0de9650617b6d26d4c4a4a89736068828806fb847d
|
7
|
+
data.tar.gz: 03f913573f1e1cfc49ea63a196b88deae53f314cadbe49b22aa04b13e24d36878822ec737b0d22c2e6ea8f06add4fe8a4dee23a0036c92cbcdedb0bc07caadd7
|
data/README.md
CHANGED
@@ -40,6 +40,10 @@ This adds so little runtime overhead that there are few reasons _not_ to use it.
|
|
40
40
|
Note that the original log file will still be written to `example.log`,
|
41
41
|
so no information is lost.
|
42
42
|
|
43
|
+
**Important:** Without `nonstopmode`, `pdflatex` et al. stop on errors to interact
|
44
|
+
with the user; `texlogparser` is not prepared to play the middle man for that and
|
45
|
+
will block.
|
46
|
+
|
43
47
|
You can also read from and/or write to files:
|
44
48
|
|
45
49
|
```bash
|
@@ -51,16 +55,38 @@ cat example.log | texlogparser -o example.simple.log # From stdin, to file
|
|
51
55
|
If you want to use the output programmatically, you may want to add option `-f json`.
|
52
56
|
It does just what it sounds like.
|
53
57
|
|
54
|
-
|
55
58
|
### Ruby API
|
56
59
|
|
60
|
+
The interface is rather narrow; your main entry point is class
|
61
|
+
[TexLogParser](http://www.rubydoc.info/gems/tex_log_parser/TexLogParser).
|
62
|
+
Calling `parse` on it will yield a list of
|
63
|
+
[Message](http://www.rubydoc.info/gems/tex_log_parser/LogParser/Message)
|
64
|
+
objects.
|
65
|
+
|
66
|
+
Here is a minimal yet complete example:
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
require 'tex_log_parser'
|
70
|
+
|
71
|
+
log = File.readlines('example.log')
|
72
|
+
parser = TexLogParser.new(log)
|
73
|
+
puts parser.parse[0]
|
74
|
+
```
|
75
|
+
|
57
76
|
### Recommendations
|
58
77
|
|
78
|
+
Here are some tips on how to generate logs that do not trip up parsing unnecessarily:
|
79
|
+
|
59
80
|
* Use `_latex` option `-file-line-error` to get higher accuracy regarding source files and lines.
|
60
81
|
* [Increase the maximum line length](https://tex.stackexchange.com/a/52994/3213) as much as possible
|
61
82
|
to improve overall efficacy. Bad linebreaks are
|
62
83
|
[bad](https://github.com/reitzig/texlogparser/search?utf8=%E2%9C%93&q=BROKEN_BY_LINEBREAKS&type=).
|
63
84
|
* Avoid parentheses and whitespace in file paths.
|
85
|
+
* The shell output of the initial run of `pdflatex` et al. on a new file can
|
86
|
+
contain output of subprograms, and be complicated in other ways as well.
|
87
|
+
It is therefore more robust to use the log file as written to disk, and/or
|
88
|
+
the output resp. log file produced by a subsequent run.
|
89
|
+
(Don't worry, real errors will stick around!)
|
64
90
|
|
65
91
|
## Contributing
|
66
92
|
|
@@ -109,4 +135,10 @@ very appreciated. Particular areas of interest include:
|
|
109
135
|
* Does the documentation cover all your questions?
|
110
136
|
* Is the Gem structured properly?
|
111
137
|
* What can be improved to encourage code contributions?
|
112
|
-
* Does the CLI script have problems on any platform?
|
138
|
+
* Does the CLI script have problems on any platform?
|
139
|
+
|
140
|
+
### Contributors
|
141
|
+
|
142
|
+
* [egreg](https://tex.stackexchange.com/users/4427/egreg) and
|
143
|
+
[David Carlisle](https://tex.stackexchange.com/users/1090/david-carlisle)
|
144
|
+
provided helpful test cases and insight in LaTeX Stack Exchange chat.
|
@@ -17,8 +17,8 @@ class TexLogParser
|
|
17
17
|
|
18
18
|
# Creates a new instance.
|
19
19
|
def initialize
|
20
|
-
super(/^(Over|Under)full \\hbox.*at
|
21
|
-
{ pattern: ->(_) { /^\s
|
20
|
+
super(/^(Over|Under)full \\hbox.*at line(?:s)? (\d+)(?:--(\d+))?/,
|
21
|
+
{ pattern: ->(_) { /^\s*(\[\])?\s*$/ }, until: :match, inclusive: false }
|
22
22
|
)
|
23
23
|
end
|
24
24
|
|
@@ -27,8 +27,9 @@ class TexLogParser
|
|
27
27
|
# @type [Message] msg
|
28
28
|
msg, consumed = super(lines)
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
from_line = @start_match[2].to_i
|
31
|
+
end_line = @start_match[3].nil? ? from_line : @start_match[3].to_i
|
32
|
+
msg.source_lines = { from: from_line, to: end_line }
|
32
33
|
msg.preformatted = true
|
33
34
|
msg.level = :warning
|
34
35
|
|
data/lib/version.rb
CHANGED