lib/docbookrx/docbook_visitor.rb
# transfer node type constants from Nokogiri
transfer node type constants from Nokogiri
transfer node type constants from Nokogiri
def process_info node
    title = text_at_css node, '> title'
    append_line %(= #{title})
    authors = []
    (node.css 'author').each do |author_node|
      author = if (personname_node = (author_node.at_css 'personname'))
        text personname_node
      else
        [(text_at_css author_node, 'firstname'), (text_at_css author_node, 'surname')].compact * ' '
      end
      if (email_node = (author_node.at_css 'email'))
        author = %(#{author} <#{text email_node}>)
      end
      authors << author unless author.empty?
    end
    append_line (authors * '; ') unless authors.empty?
    date_line = nil
    if (revnumber_node = node.at_css('revhistory revnumber', 'releaseinfo'))
      date_line = %(v#{revnumber_node.text}, ) 
    end
    if (date_node = node.at_css('> date', '> pubdate'))
      append_line %(#{date_line}#{date_node.text})
    end
    if node.name == 'bookinfo' || node.parent.name == 'book' || node.parent.name == 'chapter'
      append_line ':compat-mode:' if @compat_mode
      append_line ':doctype: book'
      append_line ':sectnums:'
      append_line ':toc: left'
      append_line ':icons: font'
      append_line ':experimental:'
    end
    append_line %(:idprefix: #{@idprefix}).rstrip unless @idprefix == '_'
    append_line %(:idseparator: #{@idseparator}).rstrip unless @idseparator == '_'
    @attributes.each do |name, val|
      append_line %(:#{name}: #{val}).rstrip
    end
    false
  end
def process_info node title = text_at_css node , '> title' append_line %(= #{title}) authors = [ ] ( node . css 'author' ) . each do | author_node | author = if ( personname_node = ( author_node . at_css 'personname' ) ) text personname_node else [ ( text_at_css author_node , 'firstname' ) , ( text_at_css author_node , 'surname' ) ] . compact * ' ' end if ( email_node = ( author_node . at_css 'email' ) ) author = %(#{author} <#{text email_node}>) end authors << author unless author . empty? end append_line ( authors * '; ' ) unless authors . empty? date_line = nil if ( revnumber_node = node . at_css ( 'revhistory revnumber' , 'releaseinfo' ) ) date_line = %(v#{revnumber_node.text}, ) end if ( date_node = node . at_css ( '> date' , '> pubdate' ) ) append_line %(#{date_line}#{date_node.text}) end if node . name == 'bookinfo' || node . parent . name == 'book' || node . parent . name == 'chapter' append_line ':compat-mode:' if @compat_mode append_line ':doctype: book' append_line ':sectnums:' append_line ':toc: left' append_line ':icons: font' append_line ':experimental:' end append_line %(:idprefix: #{@idprefix}) . rstrip unless @idprefix == '_' append_line %(:idseparator: #{@idseparator}) . rstrip unless @idseparator == '_' @attributes . each do | name , val | append_line %(:#{name}: #{val}) . rstrip end false end
transfer node type constants from Nokogiri
transfer node type constants from Nokogiri
# FIXME need to detect DocBook 4.5 vs 5.0 to handle names properly
node
<not_specific>