metanorma-document 0.3.0 → 0.4.0

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 (183) hide show
  1. checksums.yaml +4 -4
  2. data/CLAUDE.md +3 -2
  3. data/Rakefile +30 -5
  4. data/frontend/dist/app.css +1 -0
  5. data/frontend/dist/app.iife.js +24 -0
  6. data/frontend/package-lock.json +7 -505
  7. data/frontend/tailwind.config.js +5 -0
  8. data/lib/metanorma/csa_document/root.rb +27 -0
  9. data/lib/metanorma/csa_document.rb +9 -0
  10. data/lib/metanorma/document/cli.rb +52 -0
  11. data/lib/metanorma/document/components/ancillary_blocks/sourcecode_body.rb +14 -0
  12. data/lib/metanorma/document/components/inline/comma_element.rb +3 -0
  13. data/lib/metanorma/document/components/inline/enum_comma_element.rb +3 -0
  14. data/lib/metanorma/document/components/inline/eref_element.rb +4 -1
  15. data/lib/metanorma/document/components/inline/fmt_termsource_element.rb +4 -2
  16. data/lib/metanorma/document/components/inline/math_element.rb +13 -7
  17. data/lib/metanorma/document/components/inline/vocabulary.rb +4 -0
  18. data/lib/metanorma/document/components/multi_paragraph/admonition_block.rb +6 -1
  19. data/lib/metanorma/document/components/paragraphs/paragraph_block.rb +3 -0
  20. data/lib/metanorma/document/components/reference_elements/callout.rb +3 -2
  21. data/lib/metanorma/document/components/tables/table_cell.rb +3 -0
  22. data/lib/metanorma/document/elements/input.rb +44 -0
  23. data/lib/metanorma/document/elements.rb +1 -0
  24. data/lib/metanorma/document/relaton/address.rb +5 -0
  25. data/lib/metanorma/document/relaton/affiliation.rb +3 -0
  26. data/lib/metanorma/document/relaton/bib_item_size.rb +8 -9
  27. data/lib/metanorma/document/relaton/bib_item_type.rb +3 -0
  28. data/lib/metanorma/document/relaton/bibliographic_date.rb +5 -0
  29. data/lib/metanorma/document/relaton/contact_method.rb +5 -0
  30. data/lib/metanorma/document/relaton/contribution_info.rb +6 -2
  31. data/lib/metanorma/document/relaton/contributor.rb +4 -0
  32. data/lib/metanorma/document/relaton/contributor_role.rb +3 -0
  33. data/lib/metanorma/document/relaton/copyright_association.rb +3 -0
  34. data/lib/metanorma/document/relaton/copyright_owner.rb +3 -0
  35. data/lib/metanorma/document/relaton/date_time.rb +3 -0
  36. data/lib/metanorma/document/relaton/document_identifier.rb +4 -0
  37. data/lib/metanorma/document/relaton/document_relation.rb +8 -0
  38. data/lib/metanorma/document/relaton/document_status.rb +4 -0
  39. data/lib/metanorma/document/relaton/formatted_address.rb +4 -0
  40. data/lib/metanorma/document/relaton/full_name.rb +14 -3
  41. data/lib/metanorma/document/relaton/keyword_type.rb +3 -0
  42. data/lib/metanorma/document/relaton/locality_stack.rb +6 -9
  43. data/lib/metanorma/document/relaton/localized_name.rb +8 -5
  44. data/lib/metanorma/document/relaton/logo_element.rb +5 -0
  45. data/lib/metanorma/document/relaton/medium_type.rb +5 -16
  46. data/lib/metanorma/document/relaton/org_identifier.rb +2 -0
  47. data/lib/metanorma/document/relaton/org_subdivision.rb +2 -0
  48. data/lib/metanorma/document/relaton/org_subdivision_identifier.rb +2 -0
  49. data/lib/metanorma/document/relaton/organization.rb +3 -0
  50. data/lib/metanorma/document/relaton/person.rb +7 -1
  51. data/lib/metanorma/document/relaton/person_identifier.rb +3 -0
  52. data/lib/metanorma/document/relaton/place_type.rb +5 -0
  53. data/lib/metanorma/document/relaton/region_element.rb +3 -9
  54. data/lib/metanorma/document/relaton/relaton_collection.rb +2 -0
  55. data/lib/metanorma/document/relaton/series_type.rb +7 -0
  56. data/lib/metanorma/document/relaton/typed_note.rb +4 -0
  57. data/lib/metanorma/document/relaton/typed_title_string.rb +4 -0
  58. data/lib/metanorma/document/relaton/typed_uri.rb +3 -8
  59. data/lib/metanorma/document/relaton/validity_type.rb +8 -10
  60. data/lib/metanorma/document/relaton/variant_full_name.rb +3 -0
  61. data/lib/metanorma/document/relaton/variant_org_name.rb +3 -0
  62. data/lib/metanorma/document/relaton/version_info.rb +5 -0
  63. data/lib/metanorma/document/relaton/vocab_id_type.rb +6 -12
  64. data/lib/metanorma/document/relaton.rb +0 -14
  65. data/lib/metanorma/document/version.rb +1 -1
  66. data/lib/metanorma/document.rb +1 -0
  67. data/lib/metanorma/html/base_renderer.rb +86 -234
  68. data/lib/metanorma/html/concerns/metadata_extraction.rb +61 -0
  69. data/lib/metanorma/html/concerns/presentation_validation.rb +61 -0
  70. data/lib/metanorma/html/concerns/svg_processing.rb +32 -0
  71. data/lib/metanorma/html/concerns/text_extraction.rb +93 -0
  72. data/lib/metanorma/html/concerns/toc_registry.rb +47 -0
  73. data/lib/metanorma/html/csa_renderer.rb +9 -0
  74. data/lib/metanorma/html/drops/figure_drop.rb +33 -10
  75. data/lib/metanorma/html/drops/sourcecode_drop.rb +3 -6
  76. data/lib/metanorma/html/flavor.rb +6 -1
  77. data/lib/metanorma/html/generator.rb +8 -1
  78. data/lib/metanorma/html/iso_renderer.rb +0 -142
  79. data/lib/metanorma/html/renderers/block_renderer.rb +10 -0
  80. data/lib/metanorma/html/renderers/element_order_traversal.rb +15 -1
  81. data/lib/metanorma/html/renderers/inline_renderer.rb +13 -75
  82. data/lib/metanorma/html/standard_renderer.rb +195 -35
  83. data/lib/metanorma/html.rb +1 -51
  84. data/lib/metanorma/iso_document/sections/iso_preface.rb +27 -13
  85. data/lib/metanorma/mirror/default_registry.rb +21 -0
  86. data/lib/metanorma/mirror/handlers/inline/catalog.rb +7 -12
  87. data/lib/metanorma/mirror/handlers/inline/rich_html_renderer.rb +2 -3
  88. data/lib/metanorma/mirror/handlers/sourcecode.rb +1 -1
  89. data/lib/metanorma/mirror/model/guide.rb +3 -2
  90. data/lib/metanorma/mirror/output/formats/inline_format.rb +64 -3
  91. data/lib/metanorma/mirror/output/pipeline.rb +1 -0
  92. data/lib/metanorma/mirror/output.rb +0 -2
  93. data/lib/metanorma/mirror/rewriter.rb +3 -1
  94. data/lib/metanorma/registers/setup.rb +10 -0
  95. data/lib/metanorma/standard_document/annotation_container.rb +2 -0
  96. data/lib/metanorma/standard_document/elements/input.rb +4 -25
  97. data/lib/metanorma/standard_document/metadata/metanorma_extension.rb +12 -2
  98. data/lib/metanorma/standard_document/metadata/presentation_metadata.rb +107 -0
  99. data/lib/metanorma/standard_document/metadata/semantic_metadata.rb +18 -0
  100. data/lib/metanorma/standard_document/metadata/unitsml/amount_of_substance.rb +19 -0
  101. data/lib/metanorma/standard_document/metadata/unitsml/base_quantity.rb +34 -0
  102. data/lib/metanorma/standard_document/metadata/unitsml/dimension.rb +39 -0
  103. data/lib/metanorma/standard_document/metadata/unitsml/dimension_set.rb +19 -0
  104. data/lib/metanorma/standard_document/metadata/unitsml/electric_current.rb +19 -0
  105. data/lib/metanorma/standard_document/metadata/unitsml/enumerated_root_unit.rb +23 -0
  106. data/lib/metanorma/standard_document/metadata/unitsml/length.rb +19 -0
  107. data/lib/metanorma/standard_document/metadata/unitsml/luminous_intensity.rb +19 -0
  108. data/lib/metanorma/standard_document/metadata/unitsml/mass.rb +19 -0
  109. data/lib/metanorma/standard_document/metadata/unitsml/namespace.rb +17 -0
  110. data/lib/metanorma/standard_document/metadata/unitsml/plane_angle.rb +19 -0
  111. data/lib/metanorma/standard_document/metadata/unitsml/prefix.rb +30 -0
  112. data/lib/metanorma/standard_document/metadata/unitsml/prefix_name.rb +21 -0
  113. data/lib/metanorma/standard_document/metadata/unitsml/prefix_set.rb +19 -0
  114. data/lib/metanorma/standard_document/metadata/unitsml/prefix_symbol.rb +21 -0
  115. data/lib/metanorma/standard_document/metadata/unitsml/quantity.rb +28 -0
  116. data/lib/metanorma/standard_document/metadata/unitsml/quantity_name.rb +21 -0
  117. data/lib/metanorma/standard_document/metadata/unitsml/quantity_set.rb +19 -0
  118. data/lib/metanorma/standard_document/metadata/unitsml/root_units.rb +19 -0
  119. data/lib/metanorma/standard_document/metadata/unitsml/thermodynamic_temperature.rb +19 -0
  120. data/lib/metanorma/standard_document/metadata/unitsml/time.rb +19 -0
  121. data/lib/metanorma/standard_document/metadata/unitsml/unit.rb +32 -0
  122. data/lib/metanorma/standard_document/metadata/unitsml/unit_name.rb +21 -0
  123. data/lib/metanorma/standard_document/metadata/unitsml/unit_set.rb +19 -0
  124. data/lib/metanorma/standard_document/metadata/unitsml/unit_symbol.rb +36 -0
  125. data/lib/metanorma/standard_document/metadata/unitsml/unit_system.rb +23 -0
  126. data/lib/metanorma/standard_document/metadata/unitsml/unitsml_root.rb +28 -0
  127. data/lib/metanorma/standard_document/metadata/unitsml.rb +39 -0
  128. data/lib/metanorma/standard_document/metadata.rb +4 -0
  129. data/lib/metanorma/standard_document/sections/misc_container.rb +8 -6
  130. data/lib/metanorma/standard_document/sections/sections.rb +7 -0
  131. data/lib/metanorma/un_document/blocks/un_admonition_block.rb +86 -0
  132. data/lib/metanorma/un_document/blocks.rb +9 -0
  133. data/lib/metanorma/un_document/root.rb +8 -0
  134. data/lib/metanorma/un_document/sections/un_abstract_section.rb +48 -0
  135. data/lib/metanorma/un_document/sections/un_preface.rb +19 -2
  136. data/lib/metanorma/un_document/sections.rb +1 -0
  137. data/lib/metanorma/un_document/un_text_element.rb +116 -0
  138. data/lib/metanorma/un_document.rb +2 -0
  139. data/script/benchmark_render.rb +35 -0
  140. data/tasks/roundtrip_samples.rake +1 -1
  141. metadata +63 -45
  142. data/.rubocop_todo.yml +0 -220
  143. data/TODO.finalize/01-split-multi-class-files.md +0 -8
  144. data/TODO.finalize/02-remove-data-dist-iso-document-frontend.md +0 -6
  145. data/TODO.finalize/03-align-frontend-iife-and-gha-build.md +0 -11
  146. data/TODO.finalize/04-theme-per-flavor-config-driven.md +0 -9
  147. data/TODO.finalize/05-migrate-all-html-to-liquid.md +0 -16
  148. data/TODO.finalize/06-integrate-pubid-library.md +0 -16
  149. data/TODO.finalize/07-replace-relaton-models-with-relaton-bib.md +0 -39
  150. data/TODO.finalize/08-refactor-renderer-architecture.md +0 -25
  151. data/TODO.finalize/09-eliminate-code-smells.md +0 -14
  152. data/TODO.finalize/10-comprehensive-spec-coverage.md +0 -24
  153. data/TODO.finalize/11-config-driven-flavor-metadata.md +0 -20
  154. data/TODO.finalize/12-add-frozen-string-literal.md +0 -6
  155. data/TODO.finalize/13-extract-composition-from-god-class.md +0 -96
  156. data/TODO.finalize/14-config-driven-section-ordering.md +0 -31
  157. data/TODO.finalize/15-theme-directories-per-flavor.md +0 -46
  158. data/TODO.finalize/16-theme-lutaml-model-schema.md +0 -44
  159. data/docs/html-renderer.adoc +0 -261
  160. data/lib/data/dist/iso_document/frontend/assets/index-mwzbzmnK.js +0 -22
  161. data/lib/data/dist/iso_document/frontend/assets/index-pGvKTNid.css +0 -1
  162. data/lib/data/dist/iso_document/frontend/assets/iso-red.svg +0 -53
  163. data/lib/data/dist/iso_document/frontend/index.html +0 -13
  164. data/lib/metanorma/document/relaton/bib_item_size_type.rb +0 -21
  165. data/lib/metanorma/document/relaton/bibliographic_date_type.rb +0 -22
  166. data/lib/metanorma/document/relaton/document_relation_type.rb +0 -31
  167. data/lib/metanorma/document/relaton/iso4217_code.rb +0 -17
  168. data/lib/metanorma/document/relaton/iso8601_date.rb +0 -17
  169. data/lib/metanorma/document/relaton/personal_identifier_type.rb +0 -21
  170. data/lib/metanorma/document/relaton/region_type.rb +0 -20
  171. data/lib/metanorma/document/relaton/series_type_type.rb +0 -21
  172. data/lib/metanorma/document/relaton/specific_locality_type.rb +0 -25
  173. data/lib/metanorma/document/relaton/title_type.rb +0 -21
  174. data/lib/metanorma/mirror/output/html_renderer.rb +0 -95
  175. data/lib/metanorma/mirror/output/html_renderers/block_renderers.rb +0 -178
  176. data/lib/metanorma/mirror/output/html_renderers/inline_renderer.rb +0 -61
  177. data/lib/metanorma/mirror/output/html_renderers/list_renderers.rb +0 -96
  178. data/lib/metanorma/mirror/output/html_renderers/mark_renderers.rb +0 -41
  179. data/lib/metanorma/mirror/output/html_renderers/section_renderers.rb +0 -129
  180. data/lib/metanorma/mirror/output/html_renderers/structural_renderers.rb +0 -80
  181. data/lib/metanorma/mirror/output/html_renderers/table_renderers.rb +0 -87
  182. data/lib/metanorma/mirror/output/html_renderers.rb +0 -76
  183. data/lib/metanorma/standard_document/annotation.rb +0 -37
@@ -1,10 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "relaton/bib"
4
+
3
5
  module Metanorma
4
6
  module Document
5
7
  module Relaton
6
8
  # The name of a person.
7
- class FullName < Lutaml::Model::Serializable
9
+ # Inherits relaton-bib's FullName, gaining the formatted-initials and
10
+ # abbreviation element mappings (formatted-initials was previously
11
+ # dropped on round-trip). The mappings below are re-declared with
12
+ # Metanorma's richer LocalizedString and variant wrapper — relaton-bib
13
+ # 2.2.0.pre.alpha.1 types note as a sanitized Note collection and
14
+ # inlines the variant name fields.
15
+ class FullName < ::Relaton::Bib::FullName
8
16
  attribute :prefix, Metanorma::Document::Components::DataTypes::LocalizedString,
9
17
  collection: true
10
18
  attribute :forename, Metanorma::Document::Components::DataTypes::LocalizedString,
@@ -14,17 +22,20 @@ module Metanorma
14
22
  attribute :surname, Metanorma::Document::Components::DataTypes::LocalizedString
15
23
  attribute :addition, Metanorma::Document::Components::DataTypes::LocalizedString,
16
24
  collection: true
17
- attribute :complete_name, Metanorma::Document::Components::DataTypes::LocalizedString
25
+ attribute :completename, Metanorma::Document::Components::DataTypes::LocalizedString
18
26
  attribute :note, Metanorma::Document::Components::DataTypes::LocalizedString
19
27
  attribute :variant, VariantFullName, collection: true
20
28
 
29
+ # Compatibility reader: relaton-bib names the attribute completename.
30
+ def complete_name = completename
31
+
21
32
  xml do
22
33
  map_element "prefix", to: :prefix
23
34
  map_element "forename", to: :forename
24
35
  map_element "initials", to: :initials
25
36
  map_element "surname", to: :surname
26
37
  map_element "addition", to: :addition
27
- map_element "completename", to: :complete_name
38
+ map_element "completename", to: :completename
28
39
  map_element "note", to: :note
29
40
  map_element "variant", to: :variant
30
41
  end
@@ -4,6 +4,9 @@ module Metanorma
4
4
  module Document
5
5
  module Relaton
6
6
  # Keyword for a bibliographic item.
7
+ # Keeps its own mapping: relaton-bib 2.2.0.pre.alpha.1 Keyword has no
8
+ # map_content — the text of <keyword>RoIP</keyword> (83 of 125 fixture
9
+ # keyword elements carry text) would serialize as <keyword/>.
7
10
  class KeywordType < Lutaml::Model::Serializable
8
11
  attribute :content, :string
9
12
  attribute :vocab, Metanorma::Document::Components::DataTypes::LocalizedString
@@ -1,18 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "relaton/bib"
4
+
3
5
  module Metanorma
4
6
  module Document
5
7
  module Relaton
6
8
  # Hierarchical arrangement of bibliographic localities.
7
- class LocalityStack < Lutaml::Model::Serializable
8
- attribute :connective, :string
9
- attribute :bib_locality, BibItemLocality, collection: true
10
-
11
- xml do
12
- element "localityStack"
13
- map_attribute "connective", to: :connective
14
- map_element "locality", to: :bib_locality
15
- end
9
+ class LocalityStack < ::Relaton::Bib::LocalityStack
10
+ # Compatibility alias: relaton-bib names the collection
11
+ # +locality+, this gem historically used +bib_locality+.
12
+ def bib_locality = locality
16
13
  end
17
14
  end
18
15
  end
@@ -1,19 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "relaton/bib"
4
+
3
5
  module Metanorma
4
6
  module Document
5
7
  module Relaton
6
8
  # A name element with optional language and script attributes.
7
- class LocalizedName < Lutaml::Model::Serializable
8
- attribute :language, :string
9
- attribute :script, :string
9
+ # Inherits relaton-bib's TypedLocalizedString (gaining the type and
10
+ # locale attribute mappings); content stays a collection under
11
+ # mixed_content — this gem's organization and subdivision names allow
12
+ # mixed text runs, which relaton-bib 2.2.0.pre.alpha.1's singular
13
+ # content would flatten.
14
+ class LocalizedName < ::Relaton::Bib::TypedLocalizedString
10
15
  attribute :content, :string, collection: true
11
16
 
12
17
  xml do
13
18
  element "name"
14
19
  mixed_content
15
- map_attribute "language", to: :language
16
- map_attribute "script", to: :script
17
20
  map_content to: :content
18
21
  end
19
22
  end
@@ -3,6 +3,11 @@
3
3
  module Metanorma
4
4
  module Document
5
5
  module Relaton
6
+ # Logo image of an organization, with its raw (e.g. inline SVG) payload.
7
+ # Keeps its own mapping: relaton-bib 2.2.0.pre.alpha.1 Logo maps an
8
+ # attribute-only Image, dropping the inline <svg> payloads (over a
9
+ # thousand <path> elements) fixtures carry under <logo><image>;
10
+ # map_all_content preserves them raw.
6
11
  class LogoElement < Lutaml::Model::Serializable
7
12
  attribute :type, :string
8
13
  attribute :content, :string
@@ -1,25 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "relaton/bib"
4
+
3
5
  module Metanorma
4
6
  module Document
5
7
  module Relaton
6
8
  # Information about the medium and transmission of a bibliographic item.
7
- class MediumType < Lutaml::Model::Serializable
8
- attribute :content, :string
9
- attribute :genre, :string
10
- attribute :form, :string
11
- attribute :carrier, :string
12
- attribute :size, :string
13
- attribute :scale, :string
14
-
15
- xml do
16
- map_attribute "content", to: :content
17
- map_attribute "genre", to: :genre
18
- map_attribute "form", to: :form
19
- map_attribute "carrier", to: :carrier
20
- map_attribute "size", to: :size
21
- map_attribute "scale", to: :scale
22
- end
9
+ # relaton-bib's element grammar matches metanorma biblio.rng; this gem's
10
+ # previous all-attribute mapping matched no valid metanorma document.
11
+ class MediumType < ::Relaton::Bib::Medium
23
12
  end
24
13
  end
25
14
  end
@@ -4,6 +4,8 @@ module Metanorma
4
4
  module Document
5
5
  module Relaton
6
6
  # An identifier of an organization according to an international identifier scheme.
7
+ # Keeps its own mapping: relaton-bib 2.2.0.pre.alpha.1
8
+ # OrganizationType::Identifier lacks the @id attribute carried by fixtures.
7
9
  class OrgIdentifier < Lutaml::Model::Serializable
8
10
  attribute :id, :string
9
11
  attribute :type, :string
@@ -4,6 +4,8 @@ module Metanorma
4
4
  module Document
5
5
  module Relaton
6
6
  # A subdivision of an organization (e.g. committee, subcommittee, workgroup).
7
+ # Keeps its own mapping: relaton-bib 2.2.0.pre.alpha.1 Subdivision lacks
8
+ # identifier/@id and fmt-identifier, both carried by fixtures.
7
9
  class OrgSubdivision < Lutaml::Model::Serializable
8
10
  attribute :type, :string
9
11
  attribute :subtype, :string
@@ -4,6 +4,8 @@ module Metanorma
4
4
  module Document
5
5
  module Relaton
6
6
  # An identifier of an organization subdivision.
7
+ # Keeps its own mapping: relaton-bib 2.2.0.pre.alpha.1
8
+ # OrganizationType::Identifier lacks the @id attribute carried by fixtures.
7
9
  class OrgSubdivisionIdentifier < Lutaml::Model::Serializable
8
10
  attribute :id, :string
9
11
  attribute :type, :string
@@ -3,6 +3,9 @@
3
3
  module Metanorma
4
4
  module Document
5
5
  module Relaton
6
+ # Keeps its own mapping: relaton-bib 2.2.0.pre.alpha.1 Organization has
7
+ # no variant/variant-subdivision, its identifier lacks the @id attribute,
8
+ # and its Subdivision has no fmt-identifier — all carried by fixtures.
6
9
  class Organization < Contributor
7
10
  attribute :name, LocalizedName, collection: true
8
11
  attribute :variant, VariantOrgName, collection: true
@@ -1,10 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "relaton/bib"
4
+
3
5
  module Metanorma
4
6
  module Document
5
7
  module Relaton
6
8
  # Person associated with a bibliographic item.
7
- class Person < Contributor
9
+ # Inherits relaton-bib's Person (gaining credential and address);
10
+ # all mappings are re-declared with Metanorma's richer model classes —
11
+ # relaton-bib 2.2.0.pre.alpha.1 sanitizes affiliation descriptions,
12
+ # has no contact wrapper, and types uri as a collection.
13
+ class Person < ::Relaton::Bib::Person
8
14
  attribute :name, FullName
9
15
  attribute :affiliation, Affiliation, collection: true
10
16
  attribute :identifier, PersonIdentifier, collection: true
@@ -4,6 +4,9 @@ module Metanorma
4
4
  module Document
5
5
  module Relaton
6
6
  # An identifier of a person according to an international identifier scheme.
7
+ # Keeps its own mapping: relaton-bib 2.2.0.pre.alpha.1 Person::Identifier
8
+ # maps a type attribute plus element content, not our type/value
9
+ # attribute pair (no fixture coverage justifies a shape change).
7
10
  class PersonIdentifier < Lutaml::Model::Serializable
8
11
  attribute :type, :string
9
12
  attribute :value, :string
@@ -3,6 +3,11 @@
3
3
  module Metanorma
4
4
  module Document
5
5
  module Relaton
6
+ # Geographic place of publication or production of a bibliographic item.
7
+ # Keeps its own mapping: relaton-bib 2.2.0.pre.alpha.1 Place has no text
8
+ # content and no +region+ attribute — the text of <place>Geneva</place>
9
+ # (160 of 228 fixture place elements carry text) would serialize as
10
+ # <place/>.
6
11
  class PlaceType < Lutaml::Model::Serializable
7
12
  attribute :region_attr, :string
8
13
  attribute :region, RegionElement
@@ -1,17 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "relaton/bib"
4
+
3
5
  module Metanorma
4
6
  module Document
5
7
  module Relaton
6
- class RegionElement < Lutaml::Model::Serializable
7
- attribute :iso, :string
8
- attribute :content, :string
9
-
10
- xml do
11
- element "region"
12
- map_attribute "iso", to: :iso
13
- map_content to: :content
14
- end
8
+ class RegionElement < ::Relaton::Bib::Place::RegionType
15
9
  end
16
10
  end
17
11
  end
@@ -4,6 +4,8 @@ module Metanorma
4
4
  module Document
5
5
  module Relaton
6
6
  # Used to present a group of bibliographic items as a single group.
7
+ # Keep-forever (wave-5 sweep): collection-level grouping with no
8
+ # relaton-bib 2.2.0.pre.alpha.1 counterpart; not a migration candidate.
7
9
  class RelatonCollection < Lutaml::Model::Serializable
8
10
  attribute :type, :string
9
11
  attribute :title, Metanorma::Document::Relaton::TypedTitleString,
@@ -4,6 +4,11 @@ module Metanorma
4
4
  module Document
5
5
  module Relaton
6
6
  # Series to which a bibliographic item belongs.
7
+ # Keeps its own mapping: relaton-bib 2.2.0.pre.alpha.1 maps partnumber/run
8
+ # as elements (ours are attributes; lutaml-model 0.8.17 cannot override an
9
+ # inherited element mapping with an attribute mapping without dropping the
10
+ # value on render), types title as a sanitized collection, and restricts
11
+ # type to main/alt while fixtures use stream/secondary/tertiary/intended.
7
12
  class SeriesType < Lutaml::Model::Serializable
8
13
  attribute :type, :string
9
14
  attribute :formattedref, Metanorma::Document::Components::DataTypes::FormattedString
@@ -11,6 +16,7 @@ module Metanorma
11
16
  attribute :place, Metanorma::Document::Components::DataTypes::LocalizedString
12
17
  attribute :organization, Metanorma::Document::Relaton::Organization
13
18
  attribute :abbrev, Metanorma::Document::Components::DataTypes::LocalizedString
19
+ attribute :abbreviation, Metanorma::Document::Components::DataTypes::LocalizedString
14
20
  attribute :from, Metanorma::Document::Relaton::DateTime
15
21
  attribute :to, Metanorma::Document::Relaton::DateTime
16
22
  attribute :number, :string
@@ -24,6 +30,7 @@ module Metanorma
24
30
  map_element "place", to: :place
25
31
  map_element "organization", to: :organization
26
32
  map_element "abbrev", to: :abbrev
33
+ map_element "abbreviation", to: :abbreviation
27
34
  map_element "from", to: :from
28
35
  map_element "to", to: :to
29
36
  map_element "number", to: :number
@@ -4,6 +4,10 @@ module Metanorma
4
4
  module Document
5
5
  module Relaton
6
6
  # A note associated with the bibliographic item.
7
+ # Keeps its own mapping: relaton-bib 2.2.0.pre.alpha.1 Note lacks the
8
+ # +format+ attribute and sanitizes content to a raw string — fixtures
9
+ # carry <note format="text/plain"> and structured <p id="...">
10
+ # ParagraphBlocks.
7
11
  class TypedNote < Lutaml::Model::Serializable
8
12
  attribute :type, :string
9
13
  attribute :format, :string
@@ -4,6 +4,10 @@ module Metanorma
4
4
  module Document
5
5
  module Relaton
6
6
  # A title of a bibliographic item, associated with a type of title.
7
+ # Keeps its own mapping: relaton-bib 2.2.0.pre.alpha.1 Title sanitizes
8
+ # span/semx/link/fmt-* out of the content at assignment time and offers
9
+ # no structured inline elements (em/strong/sub/sup/tt/fn/stem/variant)
10
+ # as queryable readers.
7
11
  class TypedTitleString < Lutaml::Model::Serializable
8
12
  attribute :type, :string
9
13
  attribute :format, :string
@@ -1,17 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "relaton/bib"
4
+
3
5
  module Metanorma
4
6
  module Document
5
7
  module Relaton
6
8
  # URI associated with a type.
7
- class TypedUri < Metanorma::Document::Components::DataTypes::Uri
8
- attribute :type, :string
9
- attribute :content, :string
10
-
11
- xml do
12
- map_attribute "type", to: :type
13
- map_content to: :content
14
- end
9
+ class TypedUri < ::Relaton::Bib::Uri
15
10
  end
16
11
  end
17
12
  end
@@ -1,21 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "relaton/bib"
4
+
3
5
  module Metanorma
4
6
  module Document
5
7
  module Relaton
6
8
  # The time interval for which a bibliographic item
7
9
  # is determined valid, and the associated revision date.
8
- class ValidityType < Lutaml::Model::Serializable
9
- attribute :validity_begins, :string
10
- attribute :validity_ends, :string
11
- attribute :revision, :string
10
+ # Element names are identical; relaton-bib types the values :date_time
11
+ # per biblio.rng ISO8601Date (this gem previously used :string).
12
+ class ValidityType < ::Relaton::Bib::Validity
13
+ # Compatibility readers: relaton-bib names them +begins+/+ends+.
14
+ def validity_begins = begins
12
15
 
13
- xml do
14
- element "validity"
15
- map_element "validityBegins", to: :validity_begins
16
- map_element "validityEnds", to: :validity_ends
17
- map_element "revision", to: :revision
18
- end
16
+ def validity_ends = ends
19
17
  end
20
18
  end
21
19
  end
@@ -4,6 +4,9 @@ module Metanorma
4
4
  module Document
5
5
  module Relaton
6
6
  # A variant name of a person.
7
+ # Keeps its own mapping: relaton-bib 2.2.0.pre.alpha.1 inlines the name
8
+ # fields under variant; ours wraps a FullName in content (no fixture
9
+ # coverage justifies a shape change).
7
10
  class VariantFullName < Lutaml::Model::Serializable
8
11
  attribute :type, :string
9
12
  attribute :content, Metanorma::Document::Relaton::FullName
@@ -4,6 +4,9 @@ module Metanorma
4
4
  module Document
5
5
  module Relaton
6
6
  # A variant name of an organization.
7
+ # Keep-forever (wave-5 sweep): relaton-bib 2.2.0.pre.alpha.1 inlines
8
+ # variant name fields and has no variant wrapper class; not a migration
9
+ # candidate.
7
10
  class VariantOrgName < Lutaml::Model::Serializable
8
11
  attribute :type, :string
9
12
  attribute :content, Metanorma::Document::Components::DataTypes::LocalizedString
@@ -4,6 +4,11 @@ module Metanorma
4
4
  module Document
5
5
  module Relaton
6
6
  # A version of the bibliographic item (within an edition). Can be used for drafts.
7
+ # Keeps its own mapping: relaton-bib 2.2.0.pre.alpha.1 Version folds
8
+ # draft and revision-date into a synthesized content string — its
9
+ # #revision_date and #draft readers return nil — while fixtures carry
10
+ # structured version elements (iso-is: revision-date) that must stay
11
+ # readable and round-trip as elements.
7
12
  class VersionInfo < Lutaml::Model::Serializable
8
13
  attribute :revision_date, :string
9
14
  attribute :draft, :string
@@ -1,21 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "relaton/bib"
4
+
3
5
  module Metanorma
4
6
  module Document
5
7
  module Relaton
6
8
  # Item in a controlled vocabulary.
7
- class VocabIdType < Lutaml::Model::Serializable
8
- attribute :type, :string
9
- attribute :uri, :string
10
- attribute :code, :string
11
- attribute :term, Metanorma::Document::Relaton::VocabIdType
12
-
13
- xml do
14
- map_attribute "type", to: :type
15
- map_attribute "uri", to: :uri
16
- map_attribute "code", to: :code
17
- map_element "term", to: :term
18
- end
9
+ # relaton-bib's vocabid matches metanorma biblio.rng: +code+ and +term+
10
+ # are child elements (this gem previously had +code+ as an attribute
11
+ # and a recursive +term+).
12
+ class VocabIdType < ::Relaton::Bib::Keyword::Vocabid
19
13
  end
20
14
  end
21
15
  end
@@ -10,11 +10,8 @@ module Metanorma
10
10
  autoload :Affiliation, "#{__dir__}/relaton/affiliation"
11
11
  autoload :BibItemLocality, "#{__dir__}/relaton/bib_item_locality"
12
12
  autoload :BibItemSize, "#{__dir__}/relaton/bib_item_size"
13
- autoload :BibItemSizeType, "#{__dir__}/relaton/bib_item_size_type"
14
13
  autoload :BibItemType, "#{__dir__}/relaton/bib_item_type"
15
14
  autoload :BibliographicDate, "#{__dir__}/relaton/bibliographic_date"
16
- autoload :BibliographicDateType,
17
- "#{__dir__}/relaton/bibliographic_date_type"
18
15
  autoload :ContactMethod, "#{__dir__}/relaton/contact_method"
19
16
  autoload :ContributionInfo, "#{__dir__}/relaton/contribution_info"
20
17
  autoload :Contributor, "#{__dir__}/relaton/contributor"
@@ -24,13 +21,9 @@ module Metanorma
24
21
  autoload :DateTime, "#{__dir__}/relaton/date_time"
25
22
  autoload :DocumentIdentifier, "#{__dir__}/relaton/document_identifier"
26
23
  autoload :DocumentRelation, "#{__dir__}/relaton/document_relation"
27
- autoload :DocumentRelationType,
28
- "#{__dir__}/relaton/document_relation_type"
29
24
  autoload :DocumentStatus, "#{__dir__}/relaton/document_status"
30
25
  autoload :Edition, "#{__dir__}/relaton/edition"
31
26
  autoload :FullName, "#{__dir__}/relaton/full_name"
32
- autoload :Iso4217Code, "#{__dir__}/relaton/iso4217_code"
33
- autoload :Iso8601Date, "#{__dir__}/relaton/iso8601_date"
34
27
  autoload :KeywordType, "#{__dir__}/relaton/keyword_type"
35
28
  autoload :LocalizedName, "#{__dir__}/relaton/localized_name"
36
29
  autoload :LogoElement, "#{__dir__}/relaton/logo_element"
@@ -43,19 +36,12 @@ module Metanorma
43
36
  autoload :Organization, "#{__dir__}/relaton/organization"
44
37
  autoload :Person, "#{__dir__}/relaton/person"
45
38
  autoload :PersonIdentifier, "#{__dir__}/relaton/person_identifier"
46
- autoload :PersonalIdentifierType,
47
- "#{__dir__}/relaton/personal_identifier_type"
48
39
  autoload :Phone, "#{__dir__}/relaton/phone"
49
40
  autoload :PlaceType, "#{__dir__}/relaton/place_type"
50
41
  autoload :PriceType, "#{__dir__}/relaton/price_type"
51
- autoload :RegionType, "#{__dir__}/relaton/region_type"
52
42
  autoload :RegionElement, "#{__dir__}/relaton/region_element"
53
43
  autoload :RelatonCollection, "#{__dir__}/relaton/relaton_collection"
54
44
  autoload :SeriesType, "#{__dir__}/relaton/series_type"
55
- autoload :SeriesTypeType, "#{__dir__}/relaton/series_type_type"
56
- autoload :SpecificLocalityType,
57
- "#{__dir__}/relaton/specific_locality_type"
58
- autoload :TitleType, "#{__dir__}/relaton/title_type"
59
45
  autoload :TypedNote, "#{__dir__}/relaton/typed_note"
60
46
  autoload :TypedTitleString, "#{__dir__}/relaton/typed_title_string"
61
47
  autoload :TypedUri, "#{__dir__}/relaton/typed_uri"
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Metanorma
4
4
  module Document
5
- VERSION = "0.3.0"
5
+ VERSION = "0.4.0"
6
6
  Version = VERSION
7
7
  end
8
8
  end
@@ -46,6 +46,7 @@ module Metanorma
46
46
  autoload :IhoDocument, "metanorma/iho_document"
47
47
  autoload :OimlDocument, "metanorma/oiml_document"
48
48
  autoload :CcDocument, "metanorma/cc_document"
49
+ autoload :CsaDocument, "metanorma/csa_document"
49
50
  autoload :BipmDocument, "metanorma/bipm_document"
50
51
  autoload :BsiDocument, "metanorma/bsi_document"
51
52
  autoload :GbDocument, "metanorma/gb_document"