metanorma-ogc 1.4.2 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa7220c37ec4c4f57f175cc19ded9faa15b4cef238107d9dbf20fed3350e7964
4
- data.tar.gz: 652a56390a308dc6d52c991b6492fbc733275a87b64bdc3b7ebcfd33519e7743
3
+ metadata.gz: 2cb1583cace9a2d58cc458ee480be7385034abb7666d511bcbe1a228908258fe
4
+ data.tar.gz: 882469c7bf396171ad9cd81599d0f9f49c9b591a040968da758fb0d2d7fd600e
5
5
  SHA512:
6
- metadata.gz: a6374615ac10104cb610e08015f44df88f2ba8a2d11f9830dc91cc4055a881d240d50a54f2db3fb253de8ff00a1900cfc4a6e76db5867b939c15b9abf791db35
7
- data.tar.gz: e0c934e414bae2c2749033a9b62add64765d0adc44f72711f97c8f48eb1e15ccf311a5c46d7538cdaf5f91acfd39b2e13ab91432a41e593543090b19eb87aa71
6
+ metadata.gz: 114c8e43be8dfb2c3d4f088645111f93014b258881f1df9de256a3850e6853f2342acc3bfb8784e48f74e9524f2a3d94c33e0d8a1fc7d7939f76d9c32b4ec1e8
7
+ data.tar.gz: d070f02e1965aeb0c29d61a2010a90af3be5bd7614c31362d01befa59d212b26eb3b65479be5252caf5ab256511a4a66f2d3ed1b1f21b6db19d62aab2e239e87
@@ -624,6 +624,9 @@
624
624
  <choice>
625
625
  <ref name="PureTextElement"/>
626
626
  <ref name="stem"/>
627
+ <ref name="eref"/>
628
+ <ref name="xref"/>
629
+ <ref name="hyperlink"/>
627
630
  </choice>
628
631
  </zeroOrMore>
629
632
  </element>
@@ -634,6 +637,9 @@
634
637
  <choice>
635
638
  <ref name="PureTextElement"/>
636
639
  <ref name="stem"/>
640
+ <ref name="eref"/>
641
+ <ref name="xref"/>
642
+ <ref name="hyperlink"/>
637
643
  </choice>
638
644
  </zeroOrMore>
639
645
  </element>
@@ -641,7 +647,12 @@
641
647
  <define name="tt">
642
648
  <element name="tt">
643
649
  <zeroOrMore>
644
- <ref name="PureTextElement"/>
650
+ <choice>
651
+ <ref name="PureTextElement"/>
652
+ <ref name="eref"/>
653
+ <ref name="xref"/>
654
+ <ref name="hyperlink"/>
655
+ </choice>
645
656
  </zeroOrMore>
646
657
  </element>
647
658
  </define>
@@ -822,7 +833,9 @@
822
833
  <attribute name="alt"/>
823
834
  </optional>
824
835
  <ref name="CitationType"/>
825
- <text/>
836
+ <oneOrMore>
837
+ <ref name="PureTextElement"/>
838
+ </oneOrMore>
826
839
  </define>
827
840
  <define name="hyperlink">
828
841
  <element name="link">
@@ -835,7 +848,9 @@
835
848
  <optional>
836
849
  <attribute name="alt"/>
837
850
  </optional>
838
- <text/>
851
+ <oneOrMore>
852
+ <ref name="PureTextElement"/>
853
+ </oneOrMore>
839
854
  </element>
840
855
  </define>
841
856
  <define name="xref">
@@ -849,7 +864,9 @@
849
864
  <optional>
850
865
  <attribute name="alt"/>
851
866
  </optional>
852
- <text/>
867
+ <oneOrMore>
868
+ <ref name="PureTextElement"/>
869
+ </oneOrMore>
853
870
  </element>
854
871
  </define>
855
872
  <define name="fn">
@@ -74,23 +74,28 @@ module Asciidoctor
74
74
  end
75
75
 
76
76
  def requirement_metadata_component_tags
77
- %w(test-purpose test-method conditions part description reference
78
- requirement permission recommendation)
77
+ %w(test-purpose test-method test-method-type conditions part description
78
+ reference step requirement permission recommendation)
79
79
  end
80
80
 
81
- def requirement_metadata1(reqt, dlist)
82
- ins = super
81
+ def requirement_metadata1(reqt, dlist, ins)
82
+ ins1 = super
83
83
  dlist.xpath("./dt").each do |e|
84
- next unless requirement_metadata_component_tags.include? e.text
84
+ tag = e&.text&.gsub(/ /, "-")&.downcase
85
+ next unless requirement_metadata_component_tags.include? tag
85
86
 
86
- ins.next = requirement_metadata1_component(e)
87
- ins = ins.next
87
+ ins1.next = requirement_metadata1_component(e, tag)
88
+ ins1 = ins1.next
88
89
  end
89
90
  end
90
91
 
91
- def requirement_metadata1_component(term)
92
+ def requirement_metadata1_component(term, tag)
92
93
  val = term.at("./following::dd")
93
- val.name = term.text
94
+ val.name = tag
95
+ val.xpath("./dl").each do |d|
96
+ requirement_metadata1(val, d, d)
97
+ d.remove
98
+ end
94
99
  if %w(requirement permission
95
100
  recommendation).include?(term.text) && !val.text.empty?
96
101
  val["label"] = val.text.strip
@@ -109,8 +114,8 @@ module Asciidoctor
109
114
  end
110
115
 
111
116
  def requirement_metadata_to_component(reqt)
112
- reqt.xpath("./test-method | ./test-purpose | ./conditions | ./part | "\
113
- "./reference")
117
+ reqt.xpath(".//test-method | .//test-purpose | .//conditions | "\
118
+ ".//part | .//test-method-type | .//step | .//reference")
114
119
  .each do |c|
115
120
  c["class"] = c.name
116
121
  c.name = "component"
@@ -125,8 +130,10 @@ module Asciidoctor
125
130
  end
126
131
 
127
132
  def requirement_subparts_to_blocks(reqt)
128
- reqt.xpath("./component | ./description").each do |c|
129
- %w(p ol ul dl table).include?(c&.elements&.first&.name) and next
133
+ reqt.xpath(".//component | .//description").each do |c|
134
+ next if %w(p ol ul dl table component description)
135
+ .include?(c&.elements&.first&.name)
136
+
130
137
  c.children = "<p>#{c.children.to_xml}</p>"
131
138
  end
132
139
  end
@@ -140,6 +147,27 @@ module Asciidoctor
140
147
  t.remove
141
148
  end
142
149
  end
150
+
151
+ def requirement_cleanup(xmldoc)
152
+ requirement_type(xmldoc)
153
+ super
154
+ end
155
+
156
+ def requirement_type(xmldoc)
157
+ xmldoc.xpath(REQRECPER).each do |r|
158
+ next unless r["type"]
159
+
160
+ r["type"] = case r["type"]
161
+ when "requirement", "recommendation", "permission"
162
+ "general"
163
+ when "requirements_class" then "class"
164
+ when "conformance_test" then "verification"
165
+ when "conformance_class" then "conformanceclass"
166
+ when "abstract_test" then "abstracttest"
167
+ else r["type"]
168
+ end
169
+ end
170
+ end
143
171
  end
144
172
  end
145
173
  end
@@ -122,6 +122,16 @@ module Asciidoctor
122
122
  xml.hi { |s| s << text }
123
123
  end
124
124
 
125
+ def example(node)
126
+ role = node.role || node.attr("style")
127
+ if %w(requirements_class conformance_test conformance_class
128
+ abstract_test).include?(role)
129
+ node.set_attr("type", role)
130
+ return requirement(node, "requirement")
131
+ end
132
+ super
133
+ end
134
+
125
135
  def presentation_xml_converter(node)
126
136
  IsoDoc::Ogc::PresentationXMLConvert.new(html_extract_attributes(node))
127
137
  end