Sha256: 225093a32e1cc07d1c4f08ff7565bffcd595ca2041bad7331d0b3e2fa8bc438c

Contents?: true

Size: 731 Bytes

Versions: 2

Compression:

Stored size: 731 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: nil, script: nil, type: 'plain')
      super(content, language, script)
      @type = type
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iso-bib-item-0.4.5 lib/iso_bib_item/formatted_string.rb
iso-bib-item-0.4.4 lib/iso_bib_item/formatted_string.rb