lib/docbookrx/docbook_visitor.rb
# transfer node type constants from Nokogiri
transfer node type constants from Nokogiri
transfer node type constants from Nokogiri
def visit_programlisting node
    language = node.attr('language') || node.attr('role') || @attributes['source-language']
    language = %(,#{language.downcase}) if language
    linenums = node.attr('linenumbering') == 'numbered'
    append_blank_line unless node.parent.name == 'para'
    append_line %([source#{language}#{linenums ? ',linenums' : nil}])
    if (first_element = node.elements.first) && first_element.name == 'include'
      append_line '----'
      node.elements.each do |el|
        append_line %(include::{sourcedir}/#{el.attr 'href'}[])
      end
      append_line '----'
    else
      source_lines = node.text.rstrip.split EOL
      if @delimit_source || (source_lines.detect {|line| line.rstrip.empty?})
        append_line '----'
        append_line (source_lines * EOL)
        append_line '----'
      else
        append_line (source_lines * EOL)
      end
    end
    false
  end
def visit_programlisting node language = node . attr ( 'language' ) || node . attr ( 'role' ) || @attributes [ 'source-language' ] language = %(,#{language.downcase}) if language linenums = node . attr ( 'linenumbering' ) == 'numbered' append_blank_line unless node . parent . name == 'para' append_line %([source#{language}#{linenums ? ',linenums' : nil}]) if ( first_element = node . elements . first ) && first_element . name == 'include' append_line '----' node . elements . each do | el | append_line %(include::{sourcedir}/#{el.attr 'href'}[]) end append_line '----' else source_lines = node . text . rstrip . split EOL if @delimit_source || ( source_lines . detect { | line | line . rstrip . empty? } ) append_line '----' append_line ( source_lines * EOL ) append_line '----' else append_line ( source_lines * EOL ) end end false end
transfer node type constants from Nokogiri
transfer node type constants from Nokogiri
node
<not_specific>