sts 0.5.1 → 0.5.3
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.
- checksums.yaml +4 -4
- data/.gitmodules +3 -0
- data/.rubocop.yml +3 -0
- data/.rubocop_todo.yml +17 -3
- data/CLAUDE.md +72 -0
- data/Gemfile +1 -1
- data/lib/sts/content_groups/helpers.rb +27 -0
- data/lib/sts/enum_values.rb +17 -0
- data/lib/sts/iso_sts/app.rb +26 -1
- data/lib/sts/iso_sts/app_group.rb +1 -0
- data/lib/sts/iso_sts/array.rb +1 -0
- data/lib/sts/iso_sts/back.rb +1 -0
- data/lib/sts/iso_sts/body.rb +4 -0
- data/lib/sts/iso_sts/bold.rb +23 -11
- data/lib/sts/iso_sts/caption.rb +1 -0
- data/lib/sts/iso_sts/content_groups/highlight_elements.rb +285 -0
- data/lib/sts/iso_sts/def.rb +1 -0
- data/lib/sts/iso_sts/def_item.rb +1 -0
- data/lib/sts/iso_sts/def_list.rb +1 -0
- data/lib/sts/iso_sts/disp_formula.rb +5 -1
- data/lib/sts/iso_sts/document_identification.rb +1 -0
- data/lib/sts/iso_sts/fig.rb +1 -0
- data/lib/sts/iso_sts/fn.rb +1 -0
- data/lib/sts/iso_sts/fn_group.rb +1 -0
- data/lib/sts/iso_sts/front.rb +3 -0
- data/lib/sts/iso_sts/graphic.rb +5 -0
- data/lib/sts/iso_sts/inline_formula.rb +1 -1
- data/lib/sts/iso_sts/iso_meta.rb +2 -1
- data/lib/sts/iso_sts/italic.rb +23 -11
- data/lib/sts/iso_sts/list.rb +1 -0
- data/lib/sts/iso_sts/list_item.rb +7 -4
- data/lib/sts/iso_sts/mathml2/math.rb +20 -18
- data/lib/sts/iso_sts/mixed_citation.rb +34 -10
- data/lib/sts/iso_sts/nat_meta.rb +1 -0
- data/lib/sts/iso_sts/non_normative_example.rb +5 -0
- data/lib/sts/iso_sts/non_normative_note.rb +1 -0
- data/lib/sts/iso_sts/paragraph.rb +32 -20
- data/lib/sts/iso_sts/permissions.rb +1 -0
- data/lib/sts/iso_sts/preformat.rb +8 -5
- data/lib/sts/iso_sts/ref.rb +1 -0
- data/lib/sts/iso_sts/ref_list.rb +1 -0
- data/lib/sts/iso_sts/reg_meta.rb +1 -0
- data/lib/sts/iso_sts/sec.rb +10 -0
- data/lib/sts/iso_sts/standard.rb +6 -0
- data/lib/sts/iso_sts/standard_cross_reference.rb +1 -0
- data/lib/sts/iso_sts/standard_identification.rb +1 -0
- data/lib/sts/iso_sts/std.rb +4 -4
- data/lib/sts/iso_sts/styled_content.rb +17 -15
- data/lib/sts/iso_sts/table.rb +1 -0
- data/lib/sts/iso_sts/table_wrap.rb +1 -0
- data/lib/sts/iso_sts/table_wrap_foot.rb +1 -0
- data/lib/sts/iso_sts/td.rb +32 -14
- data/lib/sts/iso_sts/term.rb +1 -1
- data/lib/sts/iso_sts/term_sec.rb +1 -0
- data/lib/sts/iso_sts/th.rb +32 -14
- data/lib/sts/iso_sts/title.rb +15 -7
- data/lib/sts/iso_sts/title_wrap.rb +1 -0
- data/lib/sts/iso_sts/tr.rb +1 -0
- data/lib/sts/iso_sts.rb +2 -0
- data/lib/sts/{niso_sts/mathml.rb → mathml.rb} +1 -3
- data/lib/sts/namespaces.rb +1 -0
- data/lib/sts/niso_sts/abstract.rb +1 -0
- data/lib/sts/niso_sts/ack.rb +1 -1
- data/lib/sts/niso_sts/address.rb +1 -0
- data/lib/sts/niso_sts/adoption.rb +1 -1
- data/lib/sts/niso_sts/adoption_front.rb +1 -0
- data/lib/sts/niso_sts/alternatives.rb +1 -4
- data/lib/sts/niso_sts/annotation.rb +1 -3
- data/lib/sts/niso_sts/app.rb +14 -1
- data/lib/sts/niso_sts/app_group.rb +5 -0
- data/lib/sts/niso_sts/author_comment.rb +1 -3
- data/lib/sts/niso_sts/author_notes.rb +1 -1
- data/lib/sts/niso_sts/award_group.rb +1 -0
- data/lib/sts/niso_sts/back.rb +5 -4
- data/lib/sts/niso_sts/bio.rb +1 -3
- data/lib/sts/niso_sts/body.rb +36 -0
- data/lib/sts/niso_sts/boxed_text.rb +5 -1
- data/lib/sts/niso_sts/break.rb +11 -0
- data/lib/sts/niso_sts/caption.rb +7 -1
- data/lib/sts/niso_sts/chem_struct_wrap.rb +1 -0
- data/lib/sts/niso_sts/citation_alternatives.rb +1 -0
- data/lib/sts/niso_sts/collab.rb +8 -0
- data/lib/sts/niso_sts/conference.rb +1 -0
- data/lib/sts/niso_sts/content_groups/body_elements.rb +50 -0
- data/lib/sts/niso_sts/content_groups/citation_elements.rb +74 -0
- data/lib/sts/niso_sts/content_groups/emphasized_text.rb +67 -0
- data/lib/sts/niso_sts/content_groups/highlight_elements.rb +51 -0
- data/lib/sts/niso_sts/content_groups/inside_cell.rb +116 -0
- data/lib/sts/niso_sts/content_groups/p_elements.rb +41 -0
- data/lib/sts/niso_sts/content_groups/para_level.rb +67 -0
- data/lib/sts/niso_sts/content_groups/styled_content_elements.rb +93 -0
- data/lib/sts/niso_sts/content_groups/table_group_attributes.rb +62 -0
- data/lib/sts/niso_sts/content_groups.rb +8 -0
- data/lib/sts/niso_sts/contrib.rb +1 -0
- data/lib/sts/niso_sts/contrib_group.rb +1 -0
- data/lib/sts/niso_sts/counts.rb +1 -0
- data/lib/sts/niso_sts/custom_meta.rb +1 -0
- data/lib/sts/niso_sts/date.rb +1 -0
- data/lib/sts/niso_sts/def_item.rb +9 -0
- data/lib/sts/niso_sts/def_list.rb +6 -1
- data/lib/sts/niso_sts/disp_formula_group.rb +3 -4
- data/lib/sts/niso_sts/disp_quote.rb +1 -1
- data/lib/sts/niso_sts/display_formula.rb +12 -0
- data/lib/sts/niso_sts/document_identification.rb +1 -0
- data/lib/sts/niso_sts/editing_instruction.rb +1 -3
- data/lib/sts/niso_sts/element_citation.rb +1 -1
- data/lib/sts/niso_sts/ext_link.rb +16 -2
- data/lib/sts/niso_sts/fig_group.rb +1 -0
- data/lib/sts/niso_sts/figure.rb +14 -1
- data/lib/sts/niso_sts/floats_group.rb +1 -4
- data/lib/sts/niso_sts/fn.rb +2 -1
- data/lib/sts/niso_sts/front.rb +1 -0
- data/lib/sts/niso_sts/funding_group.rb +1 -0
- data/lib/sts/niso_sts/glossary.rb +1 -1
- data/lib/sts/niso_sts/graphic.rb +2 -0
- data/lib/sts/niso_sts/ics.rb +2 -0
- data/lib/sts/niso_sts/index_term.rb +1 -0
- data/lib/sts/niso_sts/inline_formula.rb +11 -0
- data/lib/sts/niso_sts/institution_wrap.rb +1 -0
- data/lib/sts/niso_sts/kwd_group.rb +1 -0
- data/lib/sts/niso_sts/label.rb +3 -2
- data/lib/sts/niso_sts/list.rb +7 -2
- data/lib/sts/niso_sts/list_item.rb +7 -2
- data/lib/sts/niso_sts/media.rb +1 -0
- data/lib/sts/niso_sts/meta_note.rb +1 -1
- data/lib/sts/niso_sts/metadata_iso.rb +1 -1
- data/lib/sts/niso_sts/metadata_std.rb +16 -6
- data/lib/sts/niso_sts/milestone_end.rb +1 -3
- data/lib/sts/niso_sts/milestone_start.rb +1 -3
- data/lib/sts/niso_sts/mixed_citation.rb +22 -0
- data/lib/sts/niso_sts/monospace.rb +9 -0
- data/lib/sts/niso_sts/name.rb +1 -0
- data/lib/sts/niso_sts/nat_meta.rb +1 -0
- data/lib/sts/niso_sts/nested_kwd.rb +1 -0
- data/lib/sts/niso_sts/nlm_citation.rb +1 -1
- data/lib/sts/niso_sts/non_normative_example.rb +15 -2
- data/lib/sts/niso_sts/non_normative_note.rb +12 -2
- data/lib/sts/niso_sts/normative_example.rb +1 -1
- data/lib/sts/niso_sts/normative_note.rb +1 -1
- data/lib/sts/niso_sts/note.rb +1 -1
- data/lib/sts/niso_sts/notes.rb +1 -1
- data/lib/sts/niso_sts/notes_group.rb +1 -0
- data/lib/sts/niso_sts/open_access.rb +1 -4
- data/lib/sts/niso_sts/paragraph.rb +37 -7
- data/lib/sts/niso_sts/permissions.rb +1 -0
- data/lib/sts/niso_sts/preformat.rb +15 -0
- data/lib/sts/niso_sts/private_char.rb +1 -3
- data/lib/sts/niso_sts/pub_date.rb +2 -0
- data/lib/sts/niso_sts/publisher.rb +1 -0
- data/lib/sts/niso_sts/reference.rb +1 -0
- data/lib/sts/niso_sts/reference_list.rb +6 -1
- data/lib/sts/niso_sts/reference_standard.rb +2 -0
- data/lib/sts/niso_sts/reg_meta.rb +1 -0
- data/lib/sts/niso_sts/release_date.rb +9 -6
- data/lib/sts/niso_sts/ruby.rb +1 -0
- data/lib/sts/niso_sts/section.rb +39 -4
- data/lib/sts/niso_sts/speech.rb +1 -1
- data/lib/sts/niso_sts/standard.rb +3 -0
- data/lib/sts/niso_sts/standard_identification.rb +1 -1
- data/lib/sts/niso_sts/statement.rb +1 -1
- data/lib/sts/niso_sts/std_doc_meta.rb +1 -0
- data/lib/sts/niso_sts/std_org.rb +1 -0
- data/lib/sts/niso_sts/styled_content.rb +37 -0
- data/lib/sts/niso_sts/sub.rb +11 -0
- data/lib/sts/niso_sts/subj_group.rb +1 -0
- data/lib/sts/niso_sts/sup.rb +13 -0
- data/lib/sts/niso_sts/supplementary_material.rb +1 -0
- data/lib/sts/niso_sts/term_display.rb +1 -0
- data/lib/sts/niso_sts/term_section.rb +3 -3
- data/lib/sts/niso_sts/title.rb +20 -0
- data/lib/sts/niso_sts/trans_abstract.rb +1 -0
- data/lib/sts/niso_sts/underline.rb +5 -0
- data/lib/sts/niso_sts/uri.rb +2 -0
- data/lib/sts/niso_sts/verse_group.rb +1 -1
- data/lib/sts/niso_sts/volume_issue_group.rb +1 -4
- data/lib/sts/tbx_iso_tml/bold.rb +28 -2
- data/lib/sts/tbx_iso_tml/col.rb +10 -0
- data/lib/sts/tbx_iso_tml/definition.rb +16 -2
- data/lib/sts/tbx_iso_tml/example.rb +9 -1
- data/lib/sts/tbx_iso_tml/fn.rb +3 -2
- data/lib/sts/tbx_iso_tml/italic.rb +25 -2
- data/lib/sts/tbx_iso_tml/msup.rb +2 -1
- data/lib/sts/tbx_iso_tml/note.rb +11 -7
- data/lib/sts/tbx_iso_tml/source.rb +4 -0
- data/lib/sts/tbx_iso_tml/table.rb +1 -0
- data/lib/sts/tbx_iso_tml/table_wrap.rb +3 -0
- data/lib/sts/tbx_iso_tml/table_wrap_foot.rb +1 -0
- data/lib/sts/tbx_iso_tml/tbody.rb +9 -1
- data/lib/sts/tbx_iso_tml/td.rb +22 -8
- data/lib/sts/tbx_iso_tml/term.rb +9 -5
- data/lib/sts/tbx_iso_tml/tfoot.rb +5 -1
- data/lib/sts/tbx_iso_tml/th.rb +27 -6
- data/lib/sts/tbx_iso_tml/thead.rb +9 -1
- data/lib/sts/tbx_iso_tml/tr.rb +16 -0
- data/lib/sts/version.rb +1 -1
- data/lib/sts.rb +10 -0
- metadata +19 -3
|
@@ -9,13 +9,15 @@ module Sts
|
|
|
9
9
|
attribute :xml_lang, :string
|
|
10
10
|
attribute :originator, :string
|
|
11
11
|
attribute :label, ::Sts::IsoSts::Label
|
|
12
|
-
attribute :math, ::
|
|
12
|
+
attribute :math, Mml::V3::Math
|
|
13
13
|
attribute :bold, ::Sts::IsoSts::Bold
|
|
14
14
|
attribute :italic, ::Sts::IsoSts::Italic
|
|
15
15
|
attribute :non_normative_note, ::Sts::IsoSts::NonNormativeNote
|
|
16
16
|
attribute :non_normative_example, ::Sts::IsoSts::NonNormativeExample
|
|
17
17
|
attribute :styled_content, ::Sts::IsoSts::StyledContent
|
|
18
18
|
attribute :preformat, ::Sts::IsoSts::Preformat
|
|
19
|
+
attribute :graphic, ::Sts::IsoSts::Graphic, collection: true
|
|
20
|
+
attribute :tex_math, ::Sts::NisoSts::TexMath
|
|
19
21
|
|
|
20
22
|
xml do
|
|
21
23
|
element "disp-formula"
|
|
@@ -34,6 +36,8 @@ module Sts
|
|
|
34
36
|
map_element "non-normative-example", to: :non_normative_example
|
|
35
37
|
map_element "styled-content", to: :styled_content
|
|
36
38
|
map_element "preformat", to: :preformat
|
|
39
|
+
map_element "graphic", to: :graphic
|
|
40
|
+
map_element "tex-math", to: :tex_math
|
|
37
41
|
end
|
|
38
42
|
end
|
|
39
43
|
end
|
data/lib/sts/iso_sts/fig.rb
CHANGED
data/lib/sts/iso_sts/fn.rb
CHANGED
data/lib/sts/iso_sts/fn_group.rb
CHANGED
data/lib/sts/iso_sts/front.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
module Sts
|
|
4
4
|
module IsoSts
|
|
5
5
|
class Front < Lutaml::Model::Serializable
|
|
6
|
+
attribute :std_meta, ::Sts::NisoSts::MetadataStd
|
|
6
7
|
attribute :iso_meta, ::Sts::IsoSts::IsoMeta
|
|
7
8
|
attribute :reg_meta, ::Sts::IsoSts::RegMeta, collection: true
|
|
8
9
|
attribute :nat_meta, ::Sts::IsoSts::NatMeta, collection: true
|
|
@@ -10,7 +11,9 @@ module Sts
|
|
|
10
11
|
|
|
11
12
|
xml do
|
|
12
13
|
element "front"
|
|
14
|
+
ordered
|
|
13
15
|
|
|
16
|
+
map_element "std-meta", to: :std_meta
|
|
14
17
|
map_element "iso-meta", to: :iso_meta
|
|
15
18
|
map_element "reg-meta", to: :reg_meta
|
|
16
19
|
map_element "nat-meta", to: :nat_meta
|
data/lib/sts/iso_sts/graphic.rb
CHANGED
|
@@ -12,6 +12,8 @@ module Sts
|
|
|
12
12
|
attribute :mimetype, :string
|
|
13
13
|
attribute :mime_subtype, :string
|
|
14
14
|
attribute :xlink_href, :string
|
|
15
|
+
attribute :xlink_type, :string
|
|
16
|
+
attribute :graphic_type, :string
|
|
15
17
|
attribute :label, ::Sts::IsoSts::Label
|
|
16
18
|
attribute :caption, ::Sts::IsoSts::Caption
|
|
17
19
|
attribute :alt_text, ::Sts::NisoSts::AltText
|
|
@@ -19,6 +21,7 @@ module Sts
|
|
|
19
21
|
|
|
20
22
|
xml do
|
|
21
23
|
element "graphic"
|
|
24
|
+
ordered
|
|
22
25
|
|
|
23
26
|
map_attribute "id", to: :id
|
|
24
27
|
map_attribute "position", to: :position
|
|
@@ -29,6 +32,8 @@ module Sts
|
|
|
29
32
|
map_attribute "mimetype", to: :mimetype
|
|
30
33
|
map_attribute "mime-subtype", to: :mime_subtype
|
|
31
34
|
map_attribute "xlink:href", to: :xlink_href
|
|
35
|
+
map_attribute "xlink:type", to: :xlink_type
|
|
36
|
+
map_attribute "type", to: :graphic_type
|
|
32
37
|
|
|
33
38
|
map_element "label", to: :label
|
|
34
39
|
map_element "caption", to: :caption
|
|
@@ -7,7 +7,7 @@ module Sts
|
|
|
7
7
|
attribute :content_type, :string
|
|
8
8
|
attribute :specific_use, :string
|
|
9
9
|
attribute :xml_lang, :string
|
|
10
|
-
attribute :math, ::
|
|
10
|
+
attribute :math, Mml::V3::Math
|
|
11
11
|
attribute :bold, ::Sts::IsoSts::Bold
|
|
12
12
|
attribute :italic, ::Sts::IsoSts::Italic
|
|
13
13
|
attribute :inline_formula, ::Sts::IsoSts::InlineFormula
|
data/lib/sts/iso_sts/iso_meta.rb
CHANGED
|
@@ -11,7 +11,7 @@ module Sts
|
|
|
11
11
|
collection: true
|
|
12
12
|
attribute :std_ref, ::Sts::IsoSts::StdRef, collection: true
|
|
13
13
|
attribute :doc_ref, ::Sts::IsoSts::DocRef
|
|
14
|
-
attribute :release_date, ::Sts::IsoSts::ReleaseDate
|
|
14
|
+
attribute :release_date, ::Sts::IsoSts::ReleaseDate, collection: true
|
|
15
15
|
attribute :comm_ref, ::Sts::IsoSts::CommRef
|
|
16
16
|
attribute :secretariat, ::Sts::IsoSts::Secretariat, collection: true
|
|
17
17
|
attribute :ics, ::Sts::NisoSts::Ics, collection: true
|
|
@@ -27,6 +27,7 @@ module Sts
|
|
|
27
27
|
|
|
28
28
|
xml do
|
|
29
29
|
element "iso-meta"
|
|
30
|
+
ordered
|
|
30
31
|
|
|
31
32
|
map_attribute "id", to: :id
|
|
32
33
|
|
data/lib/sts/iso_sts/italic.rb
CHANGED
|
@@ -6,17 +6,23 @@ module Sts
|
|
|
6
6
|
attribute :id, :string
|
|
7
7
|
attribute :specific_use, :string
|
|
8
8
|
attribute :content, :string, collection: true
|
|
9
|
-
attribute :bold, ::Sts::IsoSts::Bold
|
|
10
|
-
attribute :italic, ::Sts::IsoSts::Italic
|
|
11
|
-
attribute :sub, ::Sts::NisoSts::Sub
|
|
12
|
-
attribute :sup, ::Sts::NisoSts::Sup
|
|
13
|
-
attribute :xref, ::Sts::TbxIsoTml::Xref
|
|
14
|
-
attribute :ext_link, ::Sts::NisoSts::ExtLink
|
|
15
|
-
attribute :uri, ::Sts::NisoSts::Uri
|
|
16
|
-
attribute :inline_formula, ::Sts::IsoSts::InlineFormula
|
|
17
|
-
attribute :named_content, ::Sts::NisoSts::NamedContent
|
|
18
|
-
attribute :styled_content, ::Sts::IsoSts::StyledContent
|
|
19
|
-
attribute :break, ::Sts::IsoSts::Break
|
|
9
|
+
attribute :bold, ::Sts::IsoSts::Bold, collection: true
|
|
10
|
+
attribute :italic, ::Sts::IsoSts::Italic, collection: true
|
|
11
|
+
attribute :sub, ::Sts::NisoSts::Sub, collection: true
|
|
12
|
+
attribute :sup, ::Sts::NisoSts::Sup, collection: true
|
|
13
|
+
attribute :xref, ::Sts::TbxIsoTml::Xref, collection: true
|
|
14
|
+
attribute :ext_link, ::Sts::NisoSts::ExtLink, collection: true
|
|
15
|
+
attribute :uri, ::Sts::NisoSts::Uri, collection: true
|
|
16
|
+
attribute :inline_formula, ::Sts::IsoSts::InlineFormula, collection: true
|
|
17
|
+
attribute :named_content, ::Sts::NisoSts::NamedContent, collection: true
|
|
18
|
+
attribute :styled_content, ::Sts::IsoSts::StyledContent, collection: true
|
|
19
|
+
attribute :break, ::Sts::IsoSts::Break, collection: true
|
|
20
|
+
attribute :std_ref, ::Sts::IsoSts::StdRef, collection: true
|
|
21
|
+
attribute :monospace, ::Sts::NisoSts::Monospace, collection: true
|
|
22
|
+
attribute :sc, ::Sts::NisoSts::Sc, collection: true
|
|
23
|
+
attribute :strike, ::Sts::NisoSts::Strike, collection: true
|
|
24
|
+
attribute :underline, ::Sts::NisoSts::Underline, collection: true
|
|
25
|
+
attribute :fn, ::Sts::TbxIsoTml::Fn, collection: true
|
|
20
26
|
|
|
21
27
|
xml do
|
|
22
28
|
element "italic"
|
|
@@ -38,6 +44,12 @@ module Sts
|
|
|
38
44
|
map_element "named-content", to: :named_content
|
|
39
45
|
map_element "styled-content", to: :styled_content
|
|
40
46
|
map_element "break", to: :break
|
|
47
|
+
map_element "std-ref", to: :std_ref
|
|
48
|
+
map_element "monospace", to: :monospace
|
|
49
|
+
map_element "sc", to: :sc
|
|
50
|
+
map_element "strike", to: :strike
|
|
51
|
+
map_element "underline", to: :underline
|
|
52
|
+
map_element "fn", to: :fn
|
|
41
53
|
end
|
|
42
54
|
end
|
|
43
55
|
end
|
data/lib/sts/iso_sts/list.rb
CHANGED
|
@@ -8,13 +8,16 @@ module Sts
|
|
|
8
8
|
attribute :xml_lang, :string
|
|
9
9
|
attribute :label, ::Sts::IsoSts::Label
|
|
10
10
|
attribute :paragraph, ::Sts::IsoSts::Paragraph, collection: true
|
|
11
|
-
attribute :non_normative_note, ::Sts::IsoSts::NonNormativeNote
|
|
12
|
-
|
|
13
|
-
attribute :
|
|
14
|
-
|
|
11
|
+
attribute :non_normative_note, ::Sts::IsoSts::NonNormativeNote,
|
|
12
|
+
collection: true
|
|
13
|
+
attribute :non_normative_example, ::Sts::IsoSts::NonNormativeExample,
|
|
14
|
+
collection: true
|
|
15
|
+
attribute :def_list, ::Sts::IsoSts::DefList, collection: true
|
|
16
|
+
attribute :list, ::Sts::IsoSts::List, collection: true
|
|
15
17
|
|
|
16
18
|
xml do
|
|
17
19
|
element "list-item"
|
|
20
|
+
ordered
|
|
18
21
|
|
|
19
22
|
map_attribute "id", to: :id
|
|
20
23
|
map_attribute "specific-use", to: :specific_use
|
|
@@ -18,22 +18,16 @@ module Sts
|
|
|
18
18
|
map_content to: :content
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
MATH_NS = "http://www.w3.org/1998/Math/MathML"
|
|
22
|
+
|
|
21
23
|
def to_xml(*)
|
|
22
|
-
|
|
23
|
-
Nokogiri::XML(content, &:strict).root.to_xml
|
|
24
|
-
elsif @original_xml
|
|
25
|
-
@original_xml
|
|
26
|
-
else
|
|
27
|
-
%{<math xmlns="#{::Sts::Namespaces::MathmlNamespace.uri}"/>}
|
|
28
|
-
end
|
|
24
|
+
@original_xml || %{<math xmlns="#{MATH_NS}"/>}
|
|
29
25
|
end
|
|
30
26
|
|
|
31
|
-
MATH_XPATH = ".//*[local-name()='math']"
|
|
32
|
-
MATH_NS_XPATH = ".//math[@xmlns='http://www.w3.org/1998/Math/MathML']"
|
|
33
|
-
MATH_ML_XPATH = ".//mml:math"
|
|
34
|
-
|
|
35
27
|
def self.from_xml(input)
|
|
36
|
-
|
|
28
|
+
input_str = input.respond_to?(:read) ? input.read : input.to_s
|
|
29
|
+
|
|
30
|
+
doc = parse_with_namespace(input_str)
|
|
37
31
|
math_element = find_math_element(doc)
|
|
38
32
|
return new if math_element.nil?
|
|
39
33
|
|
|
@@ -45,13 +39,21 @@ module Sts
|
|
|
45
39
|
math
|
|
46
40
|
end
|
|
47
41
|
|
|
42
|
+
def self.parse_with_namespace(xml_str)
|
|
43
|
+
# Detect namespace-prefixed math elements and wrap to resolve prefixes
|
|
44
|
+
if xml_str.include?("<mml:") || xml_str.match?(/<\w+:math[\s>]/)
|
|
45
|
+
wrapped = "<wrapper xmlns:mml=\"#{MATH_NS}\">#{xml_str}</wrapper>"
|
|
46
|
+
Nokogiri::XML(wrapped)
|
|
47
|
+
else
|
|
48
|
+
Nokogiri::XML(xml_str)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
private_class_method :parse_with_namespace
|
|
52
|
+
|
|
48
53
|
def self.find_math_element(doc)
|
|
49
|
-
doc.at_xpath(
|
|
50
|
-
doc.at_xpath(
|
|
51
|
-
|
|
52
|
-
"mml" => "http://www.w3.org/1998/Math/MathML",
|
|
53
|
-
) ||
|
|
54
|
-
doc.at_xpath(MATH_XPATH)
|
|
54
|
+
doc.at_xpath("//math[@xmlns='#{MATH_NS}']") ||
|
|
55
|
+
doc.at_xpath(".//mml:math", "mml" => MATH_NS) ||
|
|
56
|
+
doc.at_xpath(".//*[local-name()='math']")
|
|
55
57
|
end
|
|
56
58
|
private_class_method :find_math_element
|
|
57
59
|
|
|
@@ -10,18 +10,30 @@ module Sts
|
|
|
10
10
|
attribute :specific_use, :string
|
|
11
11
|
attribute :xml_lang, :string
|
|
12
12
|
attribute :content, :string, collection: true
|
|
13
|
-
attribute :bold, ::Sts::IsoSts::Bold
|
|
14
|
-
attribute :italic, ::Sts::IsoSts::Italic
|
|
15
|
-
attribute :sub, ::Sts::NisoSts::Sub
|
|
16
|
-
attribute :sup, ::Sts::NisoSts::Sup
|
|
17
|
-
attribute :std, ::Sts::IsoSts::Std
|
|
18
|
-
attribute :ext_link, ::Sts::NisoSts::ExtLink
|
|
13
|
+
attribute :bold, ::Sts::IsoSts::Bold, collection: true
|
|
14
|
+
attribute :italic, ::Sts::IsoSts::Italic, collection: true
|
|
15
|
+
attribute :sub, ::Sts::NisoSts::Sub, collection: true
|
|
16
|
+
attribute :sup, ::Sts::NisoSts::Sup, collection: true
|
|
17
|
+
attribute :std, ::Sts::IsoSts::Std, collection: true
|
|
18
|
+
attribute :ext_link, ::Sts::NisoSts::ExtLink, collection: true
|
|
19
19
|
attribute :uri, ::Sts::NisoSts::Uri, collection: true
|
|
20
|
-
attribute :named_content, ::Sts::NisoSts::NamedContent
|
|
21
|
-
attribute :styled_content, ::Sts::IsoSts::StyledContent
|
|
22
|
-
attribute :fn, ::Sts::TbxIsoTml::Fn
|
|
23
|
-
attribute :xref, ::Sts::TbxIsoTml::Xref
|
|
20
|
+
attribute :named_content, ::Sts::NisoSts::NamedContent, collection: true
|
|
21
|
+
attribute :styled_content, ::Sts::IsoSts::StyledContent, collection: true
|
|
22
|
+
attribute :fn, ::Sts::TbxIsoTml::Fn, collection: true
|
|
23
|
+
attribute :xref, ::Sts::TbxIsoTml::Xref, collection: true
|
|
24
24
|
attribute :break, ::Sts::IsoSts::Break, collection: true
|
|
25
|
+
attribute :person_group, ::Sts::NisoSts::PersonGroup, collection: true
|
|
26
|
+
attribute :collab, ::Sts::NisoSts::Collab, collection: true
|
|
27
|
+
attribute :year, ::Sts::NisoSts::Year, collection: true
|
|
28
|
+
attribute :source, ::Sts::NisoSts::Source
|
|
29
|
+
attribute :article_title, ::Sts::NisoSts::ArticleTitle
|
|
30
|
+
attribute :volume, ::Sts::NisoSts::Volume
|
|
31
|
+
attribute :issue, ::Sts::NisoSts::Issue
|
|
32
|
+
attribute :fpage, ::Sts::NisoSts::Fpage
|
|
33
|
+
attribute :lpage, ::Sts::NisoSts::Lpage
|
|
34
|
+
attribute :page_range, ::Sts::NisoSts::PageRange
|
|
35
|
+
attribute :publisher, ::Sts::NisoSts::Publisher
|
|
36
|
+
attribute :pub_id, ::Sts::NisoSts::PubId, collection: true
|
|
25
37
|
|
|
26
38
|
xml do
|
|
27
39
|
element "mixed-citation"
|
|
@@ -48,6 +60,18 @@ module Sts
|
|
|
48
60
|
map_element "fn", to: :fn
|
|
49
61
|
map_element "xref", to: :xref
|
|
50
62
|
map_element "break", to: :break
|
|
63
|
+
map_element "person-group", to: :person_group
|
|
64
|
+
map_element "collab", to: :collab
|
|
65
|
+
map_element "year", to: :year
|
|
66
|
+
map_element "source", to: :source
|
|
67
|
+
map_element "article-title", to: :article_title
|
|
68
|
+
map_element "volume", to: :volume
|
|
69
|
+
map_element "issue", to: :issue
|
|
70
|
+
map_element "fpage", to: :fpage
|
|
71
|
+
map_element "lpage", to: :lpage
|
|
72
|
+
map_element "page-range", to: :page_range
|
|
73
|
+
map_element "publisher", to: :publisher
|
|
74
|
+
map_element "pub-id", to: :pub_id
|
|
51
75
|
end
|
|
52
76
|
end
|
|
53
77
|
end
|
data/lib/sts/iso_sts/nat_meta.rb
CHANGED
|
@@ -9,9 +9,12 @@ module Sts
|
|
|
9
9
|
attribute :paragraph, ::Sts::IsoSts::Paragraph, collection: true
|
|
10
10
|
attribute :list, ::Sts::IsoSts::List, collection: true
|
|
11
11
|
attribute :def_list, ::Sts::IsoSts::DefList, collection: true
|
|
12
|
+
attribute :preformat, ::Sts::IsoSts::Preformat, collection: true
|
|
13
|
+
attribute :styled_content, ::Sts::IsoSts::StyledContent, collection: true
|
|
12
14
|
|
|
13
15
|
xml do
|
|
14
16
|
element "non-normative-example"
|
|
17
|
+
ordered
|
|
15
18
|
|
|
16
19
|
map_attribute "id", to: :id
|
|
17
20
|
map_attribute "originator", to: :originator
|
|
@@ -20,6 +23,8 @@ module Sts
|
|
|
20
23
|
map_element "p", to: :paragraph
|
|
21
24
|
map_element "list", to: :list
|
|
22
25
|
map_element "def-list", to: :def_list
|
|
26
|
+
map_element "preformat", to: :preformat
|
|
27
|
+
map_element "styled-content", to: :styled_content
|
|
23
28
|
end
|
|
24
29
|
end
|
|
25
30
|
end
|
|
@@ -10,29 +10,36 @@ module Sts
|
|
|
10
10
|
attribute :originator, :string
|
|
11
11
|
attribute :style_type, :string
|
|
12
12
|
attribute :content, :string, collection: true
|
|
13
|
-
attribute :bold, ::Sts::IsoSts::Bold
|
|
14
|
-
attribute :italic, ::Sts::IsoSts::Italic
|
|
15
|
-
attribute :xref, ::Sts::TbxIsoTml::Xref
|
|
16
|
-
attribute :ext_link, ::Sts::NisoSts::ExtLink
|
|
17
|
-
attribute :uri, ::Sts::NisoSts::Uri
|
|
18
|
-
attribute :inline_formula, ::Sts::IsoSts::InlineFormula
|
|
19
|
-
attribute :disp_formula, ::Sts::IsoSts::DispFormula
|
|
20
|
-
attribute :std, ::Sts::IsoSts::Std
|
|
21
|
-
attribute :list, ::Sts::IsoSts::List
|
|
22
|
-
attribute :def_list, ::Sts::IsoSts::DefList
|
|
23
|
-
attribute :non_normative_note, ::Sts::IsoSts::NonNormativeNote
|
|
24
|
-
|
|
25
|
-
attribute :
|
|
13
|
+
attribute :bold, ::Sts::IsoSts::Bold, collection: true
|
|
14
|
+
attribute :italic, ::Sts::IsoSts::Italic, collection: true
|
|
15
|
+
attribute :xref, ::Sts::TbxIsoTml::Xref, collection: true
|
|
16
|
+
attribute :ext_link, ::Sts::NisoSts::ExtLink, collection: true
|
|
17
|
+
attribute :uri, ::Sts::NisoSts::Uri, collection: true
|
|
18
|
+
attribute :inline_formula, ::Sts::IsoSts::InlineFormula, collection: true
|
|
19
|
+
attribute :disp_formula, ::Sts::IsoSts::DispFormula, collection: true
|
|
20
|
+
attribute :std, ::Sts::IsoSts::Std, collection: true
|
|
21
|
+
attribute :list, ::Sts::IsoSts::List, collection: true
|
|
22
|
+
attribute :def_list, ::Sts::IsoSts::DefList, collection: true
|
|
23
|
+
attribute :non_normative_note, ::Sts::IsoSts::NonNormativeNote,
|
|
24
|
+
collection: true
|
|
25
|
+
attribute :non_normative_example, ::Sts::IsoSts::NonNormativeExample,
|
|
26
|
+
collection: true
|
|
27
|
+
attribute :fn, ::Sts::TbxIsoTml::Fn, collection: true
|
|
26
28
|
attribute :styled_content, ::Sts::IsoSts::StyledContent, collection: true
|
|
27
|
-
attribute :graphic, ::Sts::IsoSts::Graphic
|
|
28
|
-
attribute :math, ::
|
|
29
|
-
attribute :break, ::Sts::IsoSts::Break
|
|
29
|
+
attribute :graphic, ::Sts::IsoSts::Graphic, collection: true
|
|
30
|
+
attribute :math, Mml::V3::Math, collection: true
|
|
31
|
+
attribute :break, ::Sts::IsoSts::Break, collection: true
|
|
30
32
|
attribute :sub, ::Sts::NisoSts::Sub, collection: true
|
|
31
33
|
attribute :sup, ::Sts::NisoSts::Sup, collection: true
|
|
32
|
-
attribute :monospace, ::Sts::NisoSts::Monospace
|
|
33
|
-
attribute :sc, ::Sts::NisoSts::Sc
|
|
34
|
-
attribute :strike, ::Sts::NisoSts::Strike
|
|
35
|
-
attribute :underline, ::Sts::NisoSts::Underline
|
|
34
|
+
attribute :monospace, ::Sts::NisoSts::Monospace, collection: true
|
|
35
|
+
attribute :sc, ::Sts::NisoSts::Sc, collection: true
|
|
36
|
+
attribute :strike, ::Sts::NisoSts::Strike, collection: true
|
|
37
|
+
attribute :underline, ::Sts::NisoSts::Underline, collection: true
|
|
38
|
+
attribute :array, ::Sts::IsoSts::Array, collection: true
|
|
39
|
+
attribute :fig, ::Sts::IsoSts::Fig, collection: true
|
|
40
|
+
attribute :table_wrap, ::Sts::TbxIsoTml::TableWrap, collection: true
|
|
41
|
+
attribute :preformat, ::Sts::IsoSts::Preformat, collection: true
|
|
42
|
+
attribute :term, ::Sts::TbxIsoTml::Term, collection: true
|
|
36
43
|
|
|
37
44
|
xml do # rubocop:disable Metrics/BlockLength
|
|
38
45
|
element "p"
|
|
@@ -70,6 +77,11 @@ module Sts
|
|
|
70
77
|
map_element "sc", to: :sc
|
|
71
78
|
map_element "strike", to: :strike
|
|
72
79
|
map_element "underline", to: :underline
|
|
80
|
+
map_element "array", to: :array
|
|
81
|
+
map_element "fig", to: :fig
|
|
82
|
+
map_element "table-wrap", to: :table_wrap
|
|
83
|
+
map_element "preformat", to: :preformat
|
|
84
|
+
map_element "term", to: :term
|
|
73
85
|
end
|
|
74
86
|
end
|
|
75
87
|
end
|
|
@@ -10,12 +10,14 @@ module Sts
|
|
|
10
10
|
attribute :xml_lang, :string
|
|
11
11
|
attribute :preformat_type, :string
|
|
12
12
|
attribute :originator, :string
|
|
13
|
+
attribute :xml_space, :string
|
|
13
14
|
attribute :content, :string, collection: true
|
|
14
|
-
attribute :bold, ::Sts::IsoSts::Bold
|
|
15
|
-
attribute :italic, ::Sts::IsoSts::Italic
|
|
16
|
-
attribute :
|
|
17
|
-
attribute :
|
|
18
|
-
attribute :
|
|
15
|
+
attribute :bold, ::Sts::IsoSts::Bold, collection: true
|
|
16
|
+
attribute :italic, ::Sts::IsoSts::Italic, collection: true
|
|
17
|
+
attribute :underline, ::Sts::NisoSts::Underline, collection: true
|
|
18
|
+
attribute :ext_link, ::Sts::NisoSts::ExtLink, collection: true
|
|
19
|
+
attribute :uri, ::Sts::NisoSts::Uri, collection: true
|
|
20
|
+
attribute :styled_content, ::Sts::IsoSts::StyledContent, collection: true
|
|
19
21
|
|
|
20
22
|
xml do
|
|
21
23
|
element "preformat"
|
|
@@ -28,6 +30,7 @@ module Sts
|
|
|
28
30
|
map_attribute "xml:lang", to: :xml_lang
|
|
29
31
|
map_attribute "preformat-type", to: :preformat_type
|
|
30
32
|
map_attribute "originator", to: :originator
|
|
33
|
+
map_attribute "xml:space", to: :xml_space
|
|
31
34
|
|
|
32
35
|
map_content to: :content
|
|
33
36
|
|
data/lib/sts/iso_sts/ref.rb
CHANGED
data/lib/sts/iso_sts/ref_list.rb
CHANGED
data/lib/sts/iso_sts/reg_meta.rb
CHANGED
data/lib/sts/iso_sts/sec.rb
CHANGED
|
@@ -33,9 +33,15 @@ module Sts
|
|
|
33
33
|
attribute :uri, ::Sts::NisoSts::Uri, collection: true
|
|
34
34
|
attribute :sec, ::Sts::IsoSts::Sec, collection: true
|
|
35
35
|
attribute :term_sec, ::Sts::IsoSts::TermSec, collection: true
|
|
36
|
+
attribute :disp_quote, ::Sts::NisoSts::DispQuote, collection: true
|
|
37
|
+
attribute :fn, ::Sts::TbxIsoTml::Fn, collection: true
|
|
38
|
+
attribute :editing_instruction, ::Sts::NisoSts::EditingInstruction,
|
|
39
|
+
collection: true
|
|
40
|
+
attribute :boxed_text, ::Sts::NisoSts::BoxedText, collection: true
|
|
36
41
|
|
|
37
42
|
xml do # rubocop:disable Metrics/BlockLength
|
|
38
43
|
element "sec"
|
|
44
|
+
ordered
|
|
39
45
|
|
|
40
46
|
map_attribute "id", to: :id
|
|
41
47
|
map_attribute "lang", to: :xml_lang
|
|
@@ -66,6 +72,10 @@ module Sts
|
|
|
66
72
|
map_element "uri", to: :uri
|
|
67
73
|
map_element "sec", to: :sec
|
|
68
74
|
map_element "term-sec", to: :term_sec
|
|
75
|
+
map_element "disp-quote", to: :disp_quote
|
|
76
|
+
map_element "fn", to: :fn
|
|
77
|
+
map_element "editing-instruction", to: :editing_instruction
|
|
78
|
+
map_element "boxed-text", to: :boxed_text
|
|
69
79
|
end
|
|
70
80
|
end
|
|
71
81
|
end
|
data/lib/sts/iso_sts/standard.rb
CHANGED
|
@@ -13,6 +13,12 @@ module Sts
|
|
|
13
13
|
|
|
14
14
|
xml do
|
|
15
15
|
element "standard"
|
|
16
|
+
ordered
|
|
17
|
+
namespace_scope [
|
|
18
|
+
::Sts::Namespaces::MathmlNamespace,
|
|
19
|
+
::Sts::Namespaces::TbxNamespace,
|
|
20
|
+
::Lutaml::Xml::W3c::XlinkNamespace,
|
|
21
|
+
]
|
|
16
22
|
map_attribute "id", to: :id
|
|
17
23
|
map_attribute "lang", to: :lang
|
|
18
24
|
map_attribute "dtd-version", to: :dtd_version
|
data/lib/sts/iso_sts/std.rb
CHANGED
|
@@ -8,12 +8,12 @@ module Sts
|
|
|
8
8
|
attribute :content_type, :string
|
|
9
9
|
attribute :specific_use, :string
|
|
10
10
|
attribute :xml_lang, :string
|
|
11
|
-
attribute :std_ref, ::Sts::IsoSts::StdRef
|
|
11
|
+
attribute :std_ref, ::Sts::IsoSts::StdRef, collection: true
|
|
12
12
|
attribute :title, ::Sts::IsoSts::Title
|
|
13
13
|
attribute :fn, ::Sts::TbxIsoTml::Fn, collection: true
|
|
14
|
-
attribute :xref, ::Sts::TbxIsoTml::Xref
|
|
15
|
-
attribute :bold, ::Sts::IsoSts::Bold
|
|
16
|
-
attribute :italic, ::Sts::IsoSts::Italic
|
|
14
|
+
attribute :xref, ::Sts::TbxIsoTml::Xref, collection: true
|
|
15
|
+
attribute :bold, ::Sts::IsoSts::Bold, collection: true
|
|
16
|
+
attribute :italic, ::Sts::IsoSts::Italic, collection: true
|
|
17
17
|
attribute :named_content, ::Sts::NisoSts::NamedContent
|
|
18
18
|
attribute :content, :string, collection: true
|
|
19
19
|
xml do
|
|
@@ -11,21 +11,22 @@ module Sts
|
|
|
11
11
|
attribute :content, :string, collection: true
|
|
12
12
|
attribute :bold, ::Sts::IsoSts::Bold, collection: true
|
|
13
13
|
attribute :italic, ::Sts::IsoSts::Italic, collection: true
|
|
14
|
-
attribute :sub, ::Sts::NisoSts::Sub
|
|
15
|
-
attribute :sup, ::Sts::NisoSts::Sup
|
|
16
|
-
attribute :xref, ::Sts::TbxIsoTml::Xref
|
|
17
|
-
attribute :ext_link, ::Sts::NisoSts::ExtLink
|
|
18
|
-
attribute :uri, ::Sts::NisoSts::Uri
|
|
19
|
-
attribute :inline_formula, ::Sts::IsoSts::InlineFormula
|
|
20
|
-
attribute :disp_formula, ::Sts::IsoSts::DispFormula
|
|
21
|
-
attribute :std, ::Sts::IsoSts::Std
|
|
22
|
-
attribute :named_content, ::Sts::NisoSts::NamedContent
|
|
23
|
-
attribute :monospace, ::Sts::NisoSts::Monospace
|
|
24
|
-
attribute :sc, ::Sts::NisoSts::Sc
|
|
25
|
-
attribute :strike, ::Sts::NisoSts::Strike
|
|
26
|
-
attribute :underline, ::Sts::NisoSts::Underline
|
|
27
|
-
attribute :ruby, ::Sts::NisoSts::Ruby
|
|
28
|
-
attribute :break, ::Sts::IsoSts::Break
|
|
14
|
+
attribute :sub, ::Sts::NisoSts::Sub, collection: true
|
|
15
|
+
attribute :sup, ::Sts::NisoSts::Sup, collection: true
|
|
16
|
+
attribute :xref, ::Sts::TbxIsoTml::Xref, collection: true
|
|
17
|
+
attribute :ext_link, ::Sts::NisoSts::ExtLink, collection: true
|
|
18
|
+
attribute :uri, ::Sts::NisoSts::Uri, collection: true
|
|
19
|
+
attribute :inline_formula, ::Sts::IsoSts::InlineFormula, collection: true
|
|
20
|
+
attribute :disp_formula, ::Sts::IsoSts::DispFormula, collection: true
|
|
21
|
+
attribute :std, ::Sts::IsoSts::Std, collection: true
|
|
22
|
+
attribute :named_content, ::Sts::NisoSts::NamedContent, collection: true
|
|
23
|
+
attribute :monospace, ::Sts::NisoSts::Monospace, collection: true
|
|
24
|
+
attribute :sc, ::Sts::NisoSts::Sc, collection: true
|
|
25
|
+
attribute :strike, ::Sts::NisoSts::Strike, collection: true
|
|
26
|
+
attribute :underline, ::Sts::NisoSts::Underline, collection: true
|
|
27
|
+
attribute :ruby, ::Sts::NisoSts::Ruby, collection: true
|
|
28
|
+
attribute :break, ::Sts::IsoSts::Break, collection: true
|
|
29
|
+
attribute :styled_content, ::Sts::IsoSts::StyledContent, collection: true
|
|
29
30
|
|
|
30
31
|
xml do
|
|
31
32
|
element "styled-content"
|
|
@@ -56,6 +57,7 @@ module Sts
|
|
|
56
57
|
map_element "underline", to: :underline
|
|
57
58
|
map_element "ruby", to: :ruby
|
|
58
59
|
map_element "break", to: :break
|
|
60
|
+
map_element "styled-content", to: :styled_content
|
|
59
61
|
end
|
|
60
62
|
end
|
|
61
63
|
end
|
data/lib/sts/iso_sts/table.rb
CHANGED