relaton-bib 1.4.0 → 2.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/integration-tests.yml +54 -0
  3. data/.github/workflows/rake.yml +15 -0
  4. data/.github/workflows/release.yml +24 -0
  5. data/.gitignore +4 -1
  6. data/.rubocop.yml +3 -1
  7. data/CLAUDE.md +108 -0
  8. data/Gemfile +11 -0
  9. data/README.adoc +229 -314
  10. data/bin/console +1 -1
  11. data/docs/hash.adoc +132 -83
  12. data/lib/relaton/bib/converter/asciibib/to_asciibib.rb +663 -0
  13. data/lib/relaton/bib/converter/asciibib.rb +13 -0
  14. data/lib/relaton/bib/converter/bibtex/from_bibtex.rb +245 -0
  15. data/lib/relaton/bib/converter/bibtex/to_bibtex.rb +341 -0
  16. data/lib/relaton/bib/converter/bibtex.rb +23 -0
  17. data/lib/relaton/bib/converter/bibxml/from_rfcxml.rb +386 -0
  18. data/lib/relaton/bib/converter/bibxml/from_rfcxml_referencegroup.rb +71 -0
  19. data/lib/relaton/bib/converter/bibxml/to_rfcxml.rb +308 -0
  20. data/lib/relaton/bib/converter/bibxml/to_rfcxml_referencegroup.rb +52 -0
  21. data/lib/relaton/bib/converter/bibxml.rb +51 -0
  22. data/lib/relaton/bib/hash_parser_v1.rb +767 -0
  23. data/lib/relaton/bib/item_data.rb +229 -0
  24. data/lib/relaton/bib/model/abstract.rb +16 -0
  25. data/lib/relaton/bib/model/address.rb +22 -0
  26. data/lib/relaton/bib/model/affiliation.rb +16 -0
  27. data/lib/relaton/bib/model/bibdata.rb +9 -0
  28. data/lib/relaton/bib/model/bibdata_shared.rb +10 -0
  29. data/lib/relaton/bib/model/bibitem.rb +9 -0
  30. data/lib/relaton/bib/model/bibitem_shared.rb +10 -0
  31. data/lib/relaton/bib/model/contact.rb +14 -0
  32. data/lib/relaton/bib/model/contribution_info.rb +16 -0
  33. data/lib/relaton/bib/model/contributor.rb +29 -0
  34. data/lib/relaton/bib/model/copyright.rb +27 -0
  35. data/lib/relaton/bib/model/date.rb +29 -0
  36. data/lib/relaton/bib/model/depiction.rb +16 -0
  37. data/lib/relaton/bib/model/docidentifier.rb +34 -0
  38. data/lib/relaton/bib/model/doctype.rb +14 -0
  39. data/lib/relaton/bib/model/edition.rb +14 -0
  40. data/lib/relaton/bib/model/ext.rb +35 -0
  41. data/lib/relaton/bib/model/extent.rb +16 -0
  42. data/lib/relaton/bib/model/formattedref.rb +43 -0
  43. data/lib/relaton/bib/model/full_name_type.rb +64 -0
  44. data/lib/relaton/bib/model/fullname.rb +11 -0
  45. data/lib/relaton/bib/model/ics.rb +49 -0
  46. data/lib/relaton/bib/model/image.rb +28 -0
  47. data/lib/relaton/bib/model/item.rb +44 -0
  48. data/lib/relaton/bib/model/item_base.rb +20 -0
  49. data/lib/relaton/bib/model/item_shared.rb +88 -0
  50. data/lib/relaton/bib/model/keyword.rb +30 -0
  51. data/lib/relaton/bib/model/locality.rb +18 -0
  52. data/lib/relaton/bib/model/locality_stack.rb +14 -0
  53. data/lib/relaton/bib/model/localized_string.rb +48 -0
  54. data/lib/relaton/bib/model/localized_string_attrs.rb +24 -0
  55. data/lib/relaton/bib/model/logo.rb +14 -0
  56. data/lib/relaton/bib/model/medium.rb +22 -0
  57. data/lib/relaton/bib/model/note.rb +16 -0
  58. data/lib/relaton/bib/model/organization.rb +11 -0
  59. data/lib/relaton/bib/model/organization_type.rb +40 -0
  60. data/lib/relaton/bib/model/person.rb +36 -0
  61. data/lib/relaton/bib/model/phone.rb +14 -0
  62. data/lib/relaton/bib/model/place.rb +33 -0
  63. data/lib/relaton/bib/model/price.rb +14 -0
  64. data/lib/relaton/bib/model/relation.rb +41 -0
  65. data/lib/relaton/bib/model/series.rb +32 -0
  66. data/lib/relaton/bib/model/size.rb +23 -0
  67. data/lib/relaton/bib/model/source_locality_stack.rb +14 -0
  68. data/lib/relaton/bib/model/status.rb +27 -0
  69. data/lib/relaton/bib/model/structured_identifier.rb +48 -0
  70. data/lib/relaton/bib/model/subdivision.rb +16 -0
  71. data/lib/relaton/bib/model/title.rb +56 -0
  72. data/lib/relaton/bib/model/type/plain_date.rb +16 -0
  73. data/lib/relaton/bib/model/type/string_date.rb +48 -0
  74. data/lib/relaton/bib/model/uri.rb +18 -0
  75. data/lib/relaton/bib/model/validity.rb +16 -0
  76. data/lib/relaton/bib/model/version.rb +43 -0
  77. data/lib/relaton/bib/model_autoload.rb +85 -0
  78. data/lib/relaton/bib/namespace_helper.rb +21 -0
  79. data/lib/relaton/bib/sanitizer.rb +74 -0
  80. data/lib/relaton/bib/util.rb +18 -0
  81. data/lib/relaton/bib/version.rb +5 -0
  82. data/lib/relaton/bib/versions.json +35 -0
  83. data/lib/relaton/bib.rb +41 -0
  84. data/relaton-bib.gemspec +12 -16
  85. metadata +118 -129
  86. data/.github/workflows/macos.yml +0 -38
  87. data/.github/workflows/ubuntu.yml +0 -39
  88. data/.github/workflows/windows.yml +0 -41
  89. data/grammars/basicdoc.rng +0 -986
  90. data/grammars/biblio.rng +0 -1237
  91. data/grammars/isodoc.rng +0 -1613
  92. data/grammars/reqt.rng +0 -165
  93. data/lib/relaton_bib/bib_item_locality.rb +0 -107
  94. data/lib/relaton_bib/biblio_note.rb +0 -44
  95. data/lib/relaton_bib/biblio_version.rb +0 -49
  96. data/lib/relaton_bib/bibliographic_date.rb +0 -90
  97. data/lib/relaton_bib/bibliographic_item.rb +0 -726
  98. data/lib/relaton_bib/bibtex_parser.rb +0 -245
  99. data/lib/relaton_bib/classification.rb +0 -40
  100. data/lib/relaton_bib/contribution_info.rb +0 -109
  101. data/lib/relaton_bib/contributor.rb +0 -215
  102. data/lib/relaton_bib/copyright_association.rb +0 -77
  103. data/lib/relaton_bib/deep_dup.rb +0 -30
  104. data/lib/relaton_bib/document_identifier.rb +0 -95
  105. data/lib/relaton_bib/document_relation.rb +0 -94
  106. data/lib/relaton_bib/document_relation_collection.rb +0 -46
  107. data/lib/relaton_bib/document_status.rb +0 -93
  108. data/lib/relaton_bib/editorial_group.rb +0 -41
  109. data/lib/relaton_bib/formatted_ref.rb +0 -17
  110. data/lib/relaton_bib/formatted_string.rb +0 -55
  111. data/lib/relaton_bib/hash_converter.rb +0 -497
  112. data/lib/relaton_bib/hit.rb +0 -46
  113. data/lib/relaton_bib/hit_collection.rb +0 -73
  114. data/lib/relaton_bib/ics.rb +0 -37
  115. data/lib/relaton_bib/localized_string.rb +0 -93
  116. data/lib/relaton_bib/medium.rb +0 -44
  117. data/lib/relaton_bib/organization.rb +0 -135
  118. data/lib/relaton_bib/person.rb +0 -206
  119. data/lib/relaton_bib/place.rb +0 -49
  120. data/lib/relaton_bib/series.rb +0 -134
  121. data/lib/relaton_bib/structured_identifier.rb +0 -171
  122. data/lib/relaton_bib/technical_committee.rb +0 -36
  123. data/lib/relaton_bib/typed_title_string.rb +0 -96
  124. data/lib/relaton_bib/typed_uri.rb +0 -47
  125. data/lib/relaton_bib/validity.rb +0 -52
  126. data/lib/relaton_bib/version.rb +0 -3
  127. data/lib/relaton_bib/workers_pool.rb +0 -43
  128. data/lib/relaton_bib/workgroup.rb +0 -46
  129. data/lib/relaton_bib/xml_parser.rb +0 -463
  130. data/lib/relaton_bib.rb +0 -44
@@ -1,30 +0,0 @@
1
- class Object
2
- def duplicable?
3
- true
4
- end
5
-
6
- def deep_dup
7
- duplicable? ? dup : self
8
- end
9
- end
10
-
11
- class Array
12
- def deep_dup
13
- map(&:deep_dup)
14
- end
15
- end
16
-
17
- # class Hash
18
- # def deep_dup
19
- # hash = dup
20
- # each_pair do |key, value|
21
- # if key.frozen? && ::String === key
22
- # hash[key] = value.deep_dup
23
- # else
24
- # hash.delete(key)
25
- # hash[key.deep_dup] = value.deep_dup
26
- # end
27
- # end
28
- # hash
29
- # end
30
- # end
@@ -1,95 +0,0 @@
1
- module RelatonBib
2
- # Document identifier.
3
- class DocumentIdentifier
4
- # @return [String]
5
- attr_reader :id
6
-
7
- # @return [String, NilClass]
8
- attr_reader :type, :scope
9
-
10
- # @param id [String]
11
- # @param type [String, NilClass]
12
- # @param scoope [String, NilClass]
13
- def initialize(id:, type: nil, scope: nil)
14
- @id = id
15
- @type = type
16
- @scope = scope
17
- end
18
-
19
- # in docid manipulations, assume ISO as the default: id-part:year
20
- def remove_part
21
- case @type
22
- when "Chinese Standard" then @id.sub!(/\.\d+/, "")
23
- when "ISO", "IEC" then @id.sub!(/-[^:]+/, "")
24
- when "URN" then remove_urn_part
25
- end
26
- end
27
-
28
- def remove_date
29
- case @type
30
- when "Chinese Standard" then @id.sub!(/-[12]\d\d\d/, "")
31
- when "ISO", "IEC" then @id.sub!(/:[12]\d\d\d/, "")
32
- when "URN"
33
- @id.sub!(/^(urn:iec:std:[^:]+:[^:]+:)[^:]*/, '\1')
34
- end
35
- end
36
-
37
- def all_parts
38
- if type == "URN"
39
- @id.sub!(%r{^(urn:iec:std(?::[^:]*){4}).*}, '\1:ser')
40
- else
41
- @id += " (all parts)"
42
- end
43
- end
44
-
45
- #
46
- # Add docidentifier xml element
47
- #
48
- # @param [Nokogiri::XML::Builder] builder
49
- #
50
- def to_xml(builder)
51
- element = builder.docidentifier id
52
- element[:type] = type if type
53
- element[:scope] = scope if scope
54
- end
55
-
56
- # @return [Hash]
57
- def to_hash
58
- hash = { "id" => id }
59
- hash["type"] = type if type
60
- hash["scope"] = scope if scope
61
- hash
62
- end
63
-
64
- # @param prefix [String]
65
- # @param count [Integer] number of docids
66
- # @return [String]
67
- def to_asciibib(prefix = "", count = 1)
68
- pref = prefix.empty? ? prefix : prefix + "."
69
- out = count > 1 ? "#{pref}docid::\n" : ""
70
- out += "#{pref}docid.type:: #{type}\n" if type
71
- out += "#{pref}docid.scope:: #{scope}\n" if scope
72
- out += "#{pref}docid.id:: #{id}\n"
73
- out
74
- end
75
-
76
- private
77
-
78
- def remove_urn_part # rubocop:disable Metrics/MethodLength
79
- @id.sub!(%r{^
80
- (urn:iso:std:[^:]+ # ISO prefix and originator
81
- (?::(?:data|guide|isp|iwa|pas|r|tr|ts|tta)) # type
82
- ?:\d+) # docnumber
83
- (?::-[^:]+)? # partnumber
84
- (?::(draft|cancelled|stage-[^:]+))? # status
85
- (?::ed-\d+)?(?::v[^:]+)? # edition and version
86
- (?::\w{2}(?:,\w{2})*)? # langauge
87
- }x, '\1') # remove partnumber, status, version, and language
88
- @id.sub!(%r{^
89
- (urn:iec:std:[^:]+ # IEC prefix and originator
90
- :\d+) # docnumber
91
- (?:-[^:]+)? # partnumber
92
- }x, '\1') # remove partnumber
93
- end
94
- end
95
- end
@@ -1,94 +0,0 @@
1
- module RelatonBib
2
- # Documett relation
3
- class DocumentRelation
4
- include RelatonBib
5
-
6
- TYPES = %w[
7
- includes includedIn hasPart partOf merges mergedInto splits splitInto
8
- instance hasInstance exemplarOf hasExemplar manifestationOf
9
- hasManifestation reproductionOf hasReproduction reprintOf hasReprint
10
- expressionOf hasExpression translatedFrom hasTranslation arrangementOf
11
- hasArrangement abridgementOf hasAbridgement annotationOf hasAnnotation
12
- draftOf hasDraft editionOf hasEdition updates updatedBy derivedFrom
13
- derives describes describedBy catalogues cataloguedBy hasSuccessor
14
- successorOf adaptedFrom hasAdaptation adoptedFrom adoptedAs reviewOf
15
- hasReview commentaryOf hasCommentary related complements complementOf
16
- obsoletes obsoletedBy cited isCitedIn
17
- ].freeze
18
-
19
- # @return [String]
20
- attr_reader :type
21
-
22
- # @return [RelatonBib::FormattedString, NilClass]
23
- attr_reader :description
24
-
25
- # @return [String]
26
- # attr_reader :identifier, :url
27
-
28
- # @return [RelatonBib::BibliographicItem]
29
- attr_reader :bibitem
30
-
31
- # @return [Array<RelatonBib::Locality, RelatonBib::LocalityStack>]
32
- attr_reader :locality
33
-
34
- # @return [Array<RelatonBib::SourceLocality,
35
- # RelatonBib::SourceLocalityStack>]
36
- attr_reader :source_locality
37
-
38
- # @param type [String]
39
- # @parma description [RelatonBib::FormattedString, NilClass]
40
- # @param bibitem [RelatonBib::BibliographicItem,
41
- # RelatonIso::IsoBibliographicItem]
42
- # @param locality [Array<RelatonBib::Locality, RelatonBib::LocalityStack>]
43
- # @param source_locality [Array<RelatonBib::SourceLocality,
44
- # RelatonBib::SourceLocalityStack>]
45
- def initialize(type:, description: nil, bibitem:, locality: [],
46
- source_locality: [])
47
- type = "obsoletes" if type == "Now withdrawn"
48
- unless self.class::TYPES.include? type
49
- warn "[relaton-bib] WARNING: invalid relation type: #{type}"
50
- end
51
- @type = type
52
- @description = description
53
- @locality = locality
54
- @source_locality = source_locality
55
- @bibitem = bibitem
56
- end
57
-
58
- # rubocop:disable Metrics/AbcSize
59
-
60
- # @param builder [Nokogiri::XML::Builder]
61
- def to_xml(builder, **opts)
62
- opts.delete :bibdata
63
- opts.delete :note
64
- builder.relation(type: type) do
65
- builder.description { description.to_xml builder } if description
66
- bibitem.to_xml(builder, **opts.merge(embedded: true))
67
- locality.each { |l| l.to_xml builder }
68
- source_locality.each { |l| l.to_xml builder }
69
- end
70
- end
71
- # rubocop:enable Metrics/AbcSize
72
-
73
- # @return [Hash]
74
- def to_hash
75
- hash = { "type" => type, "bibitem" => bibitem.to_hash }
76
- hash["description"] = description.to_hash if description
77
- hash["locality"] = single_element_array(locality) if locality&.any?
78
- if source_locality&.any?
79
- hash["source_locality"] = single_element_array(source_locality)
80
- end
81
- hash
82
- end
83
-
84
- # @param prefix [String]
85
- # @return [String]
86
- def to_asciibib(prefix = "")
87
- pref = prefix.empty? ? prefix : prefix + "."
88
- out = "#{prefix}.type:: #{type}\n"
89
- out += description.to_asciibib "#{pref}desctiption" if description
90
- out += bibitem.to_asciibib "#{pref}bibitem" if bibitem
91
- out
92
- end
93
- end
94
- end
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "forwardable"
4
-
5
- module RelatonBib
6
- # Document relation collection
7
- class DocRelationCollection
8
- extend Forwardable
9
-
10
- def_delegators :@array, :<<, :[], :first, :last, :empty?, :any?, :size,
11
- :each, :detect, :map, :length
12
-
13
- # @param relation [Array<RelatonBib::DocumentRelation, Hash>]
14
- # @option relation [String] :type
15
- # @option relation [String] :identifier
16
- # @option relation [String, NIllClass] :url (nil)
17
- # @option relation [Array<RelatonBib::Locality,
18
- # RelatonBib::LocalityStack>] :locality
19
- # @option relation [Array<RelatonBib::SourceLocality,
20
- # RelatonBib::SourceLocalityStack>] :source_locality
21
- # @option relation [RelatonBib::BibliographicItem, NillClass] :bibitem (nil)
22
- def initialize(relation)
23
- @array = relation.map { |r| r.is_a?(Hash) ? DocumentRelation.new(r) : r }
24
- end
25
-
26
- # @todo We don't have replace type anymore. Suppose we should update this
27
- # method or delete it.
28
- #
29
- # @return [RelatonBib::DocRelationCollection]
30
- def replaces
31
- DocRelationCollection.new(@array.select { |r| r.type == "replace" })
32
- end
33
-
34
- # @param prefix [String]
35
- # @return [String]
36
- def to_asciibib(prefix = "")
37
- pref = prefix.empty? ? "relation" : prefix + ".relation"
38
- out = ""
39
- @array.each do |r|
40
- out += size > 1 ? "#{pref}::\n" : ""
41
- out += r.to_asciibib pref
42
- end
43
- out
44
- end
45
- end
46
- end
@@ -1,93 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "relaton_bib/localized_string"
4
-
5
- module RelatonBib
6
- # Document status.
7
- class DocumentStatus
8
- # @return [RelatonBib::DocumentStatus::Stage]
9
- attr_reader :stage
10
-
11
- # @return [RelatonBib::DocumentStatus::Stage, NilClass]
12
- attr_reader :substage
13
-
14
- # @return [String, NilClass]
15
- attr_reader :iteration
16
-
17
- # @param stage [String, Hash, RelatonBib::DocumentStatus::Stage]
18
- # @param substage [String, Hash, NilClass, RelatonBib::DocumentStatus::Stage]
19
- # @param iteration [String, NilClass]
20
- def initialize(stage:, substage: nil, iteration: nil)
21
- @stage = stage_new stage
22
- @substage = stage_new substage
23
- @iteration = iteration
24
- end
25
-
26
- # @param [Nokogiri::XML::Builder]
27
- def to_xml(builder)
28
- builder.status do
29
- # FormattedString.instance_method(:to_xml).bind(status).call builder
30
- builder.stage { |b| stage.to_xml b }
31
- builder.substage { |b| substage.to_xml b } if substage
32
- builder.iteration iteration unless iteration.to_s.empty?
33
- end
34
- end
35
-
36
- # @return [Hash]
37
- def to_hash
38
- hash = { "stage" => stage.to_hash }
39
- hash["substage"] = substage.to_hash if substage
40
- hash["iteration"] = iteration if iteration
41
- hash
42
- end
43
-
44
- # @param prefix [String]
45
- # @return [String]
46
- def to_asciibib(prefix = "")
47
- pref = prefix.empty? ? prefix : prefix + "."
48
- out = "#{pref}docstatus.stage:: #{stage.value}\n"
49
- out += "#{pref}docstatus.substage:: #{substage.value}\n" if substage
50
- out += "#{pref}docstatus.iteration:: #{iteration}\n" if iteration
51
- out
52
- end
53
-
54
- private
55
-
56
- # @param stg [RelatonBib::DocumentStatus::Stage, Hash, String, NilClass]
57
- # @return [RelatonBib::DocumentStatus::Stage]
58
- def stage_new(stg)
59
- if stg.is_a?(Stage) then stg
60
- elsif stg.is_a?(Hash) then Stage.new(stg)
61
- elsif stg.is_a?(String) then Stage.new(value: stg)
62
- end
63
- end
64
-
65
- class Stage
66
- # @return [String]
67
- attr_reader :value
68
-
69
- # @return [String, NilClass]
70
- attr_reader :abbreviation
71
-
72
- # @parma value [String]
73
- # @param abbreviation [String, NilClass]
74
- def initialize(value:, abbreviation: nil)
75
- @value = value
76
- @abbreviation = abbreviation
77
- end
78
-
79
- # @param [Nokogiri::XML::Builder]
80
- def to_xml(builder)
81
- builder.parent[:abbreviation] = abbreviation if abbreviation
82
- builder.text value
83
- end
84
-
85
- # @return [Hash]
86
- def to_hash
87
- hash = { "value" => value }
88
- hash["abbreviation"] = abbreviation if abbreviation
89
- hash
90
- end
91
- end
92
- end
93
- end
@@ -1,41 +0,0 @@
1
- require "relaton_bib/technical_committee"
2
-
3
- module RelatonBib
4
- class EditorialGroup
5
- include RelatonBib
6
-
7
- # @return [Array<RelatonBib::TechnicalCommittee>]
8
- attr_accessor :technical_committee
9
-
10
- # @param technical_committee [Array<RelatonBib::TecnicalCommittee>]
11
- def initialize(technical_committee)
12
- @technical_committee = technical_committee
13
- end
14
-
15
- # @param builder [Nokogigi::XML::Builder]
16
- def to_xml(builder)
17
- builder.editorialgroup do |b|
18
- technical_committee.each { |tc| tc.to_xml b }
19
- end
20
- end
21
-
22
- # @return [Hash]
23
- def to_hash
24
- single_element_array technical_committee
25
- end
26
-
27
- # @param prefix [String]
28
- # @return [String]
29
- def to_asciibib(prefix = "")
30
- pref = prefix.empty? ? "editorialgroup" : prefix + ".editorialgroup"
31
- technical_committee.map do |tc|
32
- tc.to_asciibib pref, technical_committee.size
33
- end.join
34
- end
35
-
36
- # @return [true]
37
- def presence?
38
- true
39
- end
40
- end
41
- end
@@ -1,17 +0,0 @@
1
- require "relaton_bib/formatted_string"
2
-
3
- module RelatonBib
4
- class FormattedRef < FormattedString
5
- # @param [Nokogiri::XML::Builder]
6
- def to_xml(builder)
7
- builder.formattedref { super }
8
- end
9
-
10
- # @param prefix [String]
11
- # @return [String]
12
- def to_asciibib(prefix = "")
13
- pref = prefix.empty? ? "formattedref" : prefix + ".formattedref"
14
- super pref
15
- end
16
- end
17
- end
@@ -1,55 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "relaton_bib/localized_string"
4
-
5
- module RelatonBib
6
- # Formatted string
7
- class FormattedString < LocalizedString
8
- FORMATS = %w[text/plain text/html application/docbook+xml
9
- application/tei+xml text/x-asciidoc text/markdown
10
- application/x-isodoc+xml].freeze
11
-
12
- # @return [String]
13
- attr_reader :format
14
-
15
- # @param content [String, Array<RelatonBib::LocalizedString>]
16
- # @param language [String, NilClass] language code Iso639
17
- # @param script [String, NilClass] script code Iso15924
18
- # @param format [String] the content type
19
- def initialize(content:, language: nil, script: nil, format: "text/plain")
20
- # if format && !FORMATS.include?(format)
21
- # raise ArgumentError, %{Format "#{format}" is invalid.}
22
- # end
23
-
24
- super(content, language, script)
25
- @format = format
26
- end
27
-
28
- # @param builder [Nokogiri::XML::Builder]
29
- def to_xml(builder)
30
- builder.parent["format"] = format if format
31
- super
32
- end
33
-
34
- # @return [Hash]
35
- def to_hash
36
- hash = super
37
- return hash unless format
38
-
39
- hash = { "content" => hash } unless hash.is_a? Hash
40
- hash["format"] = format
41
- hash
42
- end
43
-
44
- # @param prefix [String]
45
- # @param count [Integer] number of elements
46
- # @return [String]
47
- def to_asciibib(prefix = "", count = 1)
48
- pref = prefix.empty? ? prefix : prefix + "."
49
- # out = count > 1 ? "#{prefix}::\n" : ""
50
- out = super
51
- out += "#{pref}format:: #{format}\n" if format
52
- out
53
- end
54
- end
55
- end