Sha256: 8c52dc9c46ca182827d8638457be2676c14e67b0c8955ef8e53b1245adbc97ac

Contents?: true

Size: 715 Bytes

Versions: 24

Compression:

Stored size: 715 Bytes

Contents

# frozen_string_literal: true

require 'iso_bib_item/localized_string'

module IsoBibItem
  # Formatted string
  class FormattedString < LocalizedString
    # @return [String]
    attr_reader :type

    # @param content [String]
    # @param language [String] language code Iso639
    # @param script [String] script code Iso15924
    # @param type [String] the format type, default "plain"
    #   available types "plain", "html", "dockbook", "tei", "asciidoc",
    #   "markdown", "isodoc"
    def initialize(content:, language:, script:, type: 'plain')
      super(content, language, script)
      @type = type
    end

    def to_xml(builder)
      builder.parent['format'] = type
      super
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
iso-bib-item-0.1.3 lib/iso_bib_item/formatted_string.rb
iso-bib-item-0.1.2 lib/iso_bib_item/formatted_string.rb
iso-bib-item-0.1.1 lib/iso_bib_item/formatted_string.rb
iso-bib-item-0.1.0 lib/iso_bib_item/formatted_string.rb