Class: TexLogParser::StandardError
- Inherits:
-
Object
- Object
- TexLogParser::StandardError
- Includes:
- LogParser::RegExpPattern
- Defined in:
- lib/tex_log_parser/patterns/standard_error.rb
Overview
Matches messages of this form:
! File ended while scanning use of \@footnotetext.
<inserted text>
\par
<*> plain.tex
and
! Font TU/NoSuchFont(0)/m/n/9=NoSuchFont at 9.0pt not loadable: Metric (TFM) fi
le or installed font not found.
<to be read again>
relax
l.40 \end{document}
Instance Method Summary collapse
-
#initialize ⇒ StandardError
constructor
Creates a new instance.
-
#read(lines) ⇒ Array<(Message, Int)>
Reads a message from the given lines.
Methods included from LogParser::RegExpPattern
Methods included from LogParser::Pattern
Constructor Details
permalink #initialize ⇒ StandardError
Creates a new instance.
22 23 24 25 26 |
# File 'lib/tex_log_parser/patterns/standard_error.rb', line 22 def initialize super(/^! \w+/, { pattern: ->(_) { /^\s*<\*>\s+([^\s]+)|^l\.(\d+)\s+/ }, until: :match, inclusive: true } ) end |
Instance Method Details
permalink #read(lines) ⇒ Array<(Message, Int)>
Reads a message from the given lines.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/tex_log_parser/patterns/standard_error.rb', line 29 def read(lines) # @type [Message] msg msg, consumed = super(lines) msg.level = :error # Remove last line msg..gsub!(@ending[:pattern][nil], '') # Remove `! ` prefix msg..sub!(/^!\s*/, '') # Remove trailing whitespace msg..rstrip! file = @end_match[1] line = @end_match[2].to_i msg.source_file = file unless file.nil? msg.source_lines = { from: line, to: line } unless line.nil? || line.zero? msg.preformatted = true [msg, consumed] end |