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_section node, special = nil
    append_blank_line
    if special
      append_line ':sectnums!:'
      append_blank_line
      append_line %([#{special}])
    end
    title_node = (node.at_css '> title') || (node.at_css '> info > title')
    title = if title_node
      if (subtitle_node = (node.at_css '> subtitle') || (node.at_css '> info > subtitle'))
        title_node.inner_html += %(: #{subtitle_node.inner_html})
      end
      text = format_text title_node
      text.shift(1)[0]
    else
      if special
        special.capitalize
      else
        warn %(No title found for section node: #{node})
        'Unknown Title!'
      end
    end
    if (id = (resolve_id node, normalize: @normalize_ids)) && id != (generate_id title)
      append_line %([[#{id}]])
    end
    append_ifdef_start_if_condition(title_node) if title_node
    append_line %(#{'=' * @level} #{unwrap_text title})
    lines.concat(text) unless text.nil? || text.empty?
    append_ifdef_end_if_condition(title_node) if title_node
    yield if block_given?
    if (abstract_node = (node.at_css '> info > abstract'))
      append_line
      append_line '[abstract]'
      append_line '--'
      abstract_node.elements.each do |el|
        append_line
        proceed el
        append_line
      end
      append_text '--'
    end
    @level += 1
    proceed node, :using_elements => true
    @level -= 1
    if special
      append_blank_line
      append_line ':sectnums:'
    end
    false
  end
def process_section node , special = nil append_blank_line if special append_line ':sectnums!:' append_blank_line append_line %([#{special}]) end title_node = ( node . at_css '> title' ) || ( node . at_css '> info > title' ) title = if title_node if ( subtitle_node = ( node . at_css '> subtitle' ) || ( node . at_css '> info > subtitle' ) ) title_node . inner_html += %(: #{subtitle_node.inner_html}) end text = format_text title_node text . shift ( 1 ) [ 0 ] else if special special . capitalize else warn %(No title found for section node: #{node}) 'Unknown Title!' end end if ( id = ( resolve_id node , normalize : @normalize_ids ) ) && id != ( generate_id title ) append_line %([[#{id}]]) end append_ifdef_start_if_condition ( title_node ) if title_node append_line %(#{'=' * @level} #{unwrap_text title}) lines . concat ( text ) unless text . nil? || text . empty? append_ifdef_end_if_condition ( title_node ) if title_node yield if block_given? if ( abstract_node = ( node . at_css '> info > abstract' ) ) append_line append_line '[abstract]' append_line '--' abstract_node . elements . each do | el | append_line proceed el append_line end append_text '--' end @level += 1 proceed node , :using_elements => true @level -= 1 if special append_blank_line append_line ':sectnums:' end false end
transfer node type constants from Nokogiri
transfer node type constants from Nokogiri
node
<not_specific>
special
<not_specific>