Method: IsoDoc::PresentationXMLConvert#source_restore_callouts

Defined in:
lib/isodoc/presentation_function/sourcecode.rb

#source_restore_callouts(code, callouts) ⇒ Object



140
141
142
143
144
145
146
147
148
# File 'lib/isodoc/presentation_function/sourcecode.rb', line 140

def source_restore_callouts(code, callouts)
  text = to_xml(code)
  text.split(/[\n\r]/).each_with_index do |c, i|
    while !callouts.empty? && callouts[0][:line] == i
      c.sub!(/\s+$/, " #{reinsert_callout(callouts[0][:xml])} ")
      callouts.shift
    end
  end.join("\n")
end