Sha256: 0aff3cbd343e6af55aba4b1992a73b01d1843b0b3f843b633039c6c842935b9b

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 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 node.root.bibliography.layout.children.first == node if aligned_first_accessible?
          false
        end

        def aligned_first_accessible?
          !(node.root.is_a? CSL::Locale) && node.root.bibliography["second-field-align"]
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
asciidoctor-bibliography-0.10.3 lib/citeproc/ruby/formats/adoc.rb
asciidoctor-bibliography-0.10.2 lib/citeproc/ruby/formats/adoc.rb
asciidoctor-bibliography-0.10.1 lib/citeproc/ruby/formats/adoc.rb
asciidoctor-bibliography-0.10.0 lib/citeproc/ruby/formats/adoc.rb
asciidoctor-bibliography-0.9.2 lib/citeproc/ruby/formats/adoc.rb
asciidoctor-bibliography-0.9.1 lib/citeproc/ruby/formats/adoc.rb