Class: MultipleLabelWarning

Inherits:
TexWarning show all
Defined in:
lib/trex.rb

Instance Attribute Summary

Attributes inherited from TexWarning

#filestate, #limit

Instance Method Summary collapse

Methods inherited from TexWarning

#add_error, #empty?, #expand_input, #format_error, #handle, #has_error?, #render_line, #size, #sort, #to_s

Constructor Details

#initialize(source, limits = 40) ⇒ MultipleLabelWarning

Returns a new instance of MultipleLabelWarning.



942
943
944
945
946
# File 'lib/trex.rb', line 942

def initialize(source, limits=40)
    super('Multiply defined Labels', /LaTeX Warning: Label.*? multiply/,
          /.*/, limits)
    @source = source
end

Instance Method Details

#extract_line(string, index, lines) ⇒ Object



952
953
954
955
# File 'lib/trex.rb', line 952

def extract_line(string, index, lines)
    label = self.format_warning_message(0, string)
    `sed -ne /\label{#{label}}/= #{@source}`.split.join(',')
end

#format_warning_message(line, string) ⇒ Object



948
949
950
# File 'lib/trex.rb', line 948

def format_warning_message(line, string)
    string.match(/Label `(.*?)' /)[1]
end