Sha256: e3719598f378c21af892835b172301c88e2a80528c9800a8f9fc6c5c43eb7917

Contents?: true

Size: 480 Bytes

Versions: 2

Compression:

Stored size: 480 Bytes

Contents

module ReverseAdoc
  module Converters
    class Head < Base
      def to_coradoc(node, _state = {})
        title = extract_title(node)
        Coradoc::Element::Header.new(title)
      end

      def convert(node, state = {})
        Coradoc::Generator.gen_adoc(to_coradoc(node, state))
      end

      def extract_title(node)
        title = node.at("./title")
        return "(???)" if title.nil?

        title.text
      end
    end

    register :head, Head.new
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reverse_adoc-1.0.1 lib/reverse_adoc/converters/head.rb
reverse_adoc-1.0.0 lib/reverse_adoc/converters/head.rb