Sha256: 7ae687f4450f9eb186bc526f432138449ced03753d81f8bb4bdb19fe3c93c2a0

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

require "citeproc/ruby/format"

module CiteProc
  module Ruby
    module Formats
      class Adoc < Format
        def apply_font_style
          output.replace "_#{output}_" if options[:'font-style'] == "italic"
        end

        # TODO
        # def apply_font_variant
        #   output.replace "*#{output}*" if options[:'font-variant'] == 'small-caps'
        # end

        def apply_font_weight
          output.replace "*#{output}*" if options[:'font-weight'] == "bold"
        end

        # TODO
        # def apply_text_decoration
        #   output.replace "*#{output}*" if options[:'text-decoration'] == 'underline'
        # end

        def apply_vertical_align
          output.replace "^#{output}^" if options[:"vertical-align"] == "sup"
          output.replace "~#{output}~" if options[:"vertical-align"] == "sub"
        end

        def apply_suffix
          options[:suffix] += " " if aligned_first_field?
          super
        end

        private

        def aligned_first_field?
          return false unless node.root.bibliography["second-field-align"]
          node.root.bibliography.layout.children.first == node
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
asciidoctor-bibliography-0.9.0 lib/citeproc/ruby/formats/adoc.rb
asciidoctor-bibliography-0.7.3 lib/citeproc/ruby/formats/adoc.rb
asciidoctor-bibliography-0.8.0 lib/citeproc/ruby/formats/adoc.rb