Class: IsoBibItem::FormattedString

Inherits:
LocalizedString show all
Defined in:
lib/iso_bib_item/formatted_string.rb

Overview

Formatted string

Instance Attribute Summary collapse

Attributes inherited from LocalizedString

#content, #language, #script

Instance Method Summary collapse

Methods inherited from LocalizedString

#to_s

Constructor Details

#initialize(content:, language: nil, script: nil, type: 'plain') ⇒ FormattedString

Returns a new instance of FormattedString.

Parameters:

  • content (String)
  • language (String) (defaults to: nil)

    language code Iso639

  • script (String) (defaults to: nil)

    script code Iso15924

  • type (String) (defaults to: 'plain')

    the format type, default “plain” available types “plain”, “html”, “dockbook”, “tei”, “asciidoc”, “markdown”, “isodoc”



17
18
19
20
# File 'lib/iso_bib_item/formatted_string.rb', line 17

def initialize(content:, language: nil, script: nil, type: 'plain')
  super(content, language, script)
  @type = type
end

Instance Attribute Details

#typeString (readonly)

Returns:

  • (String)


9
10
11
# File 'lib/iso_bib_item/formatted_string.rb', line 9

def type
  @type
end

Instance Method Details

#to_xml(builder) ⇒ Object



22
23
24
25
# File 'lib/iso_bib_item/formatted_string.rb', line 22

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