metanorma-jis 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -154,6 +154,7 @@ module IsoDoc
154
154
  def display_order(docxml)
155
155
  i = 0
156
156
  i = display_order_xpath(docxml, "//preface/*", i)
157
+ i = display_order_at(docxml, "//sections/introduction", i)
157
158
  i = display_order_at(docxml, "//clause[@type = 'scope']", i)
158
159
  i = display_order_at(docxml, @xrefs.klass.norm_ref_xpath, i)
159
160
  i = display_order_at(docxml, "//sections/terms | " \
@@ -174,6 +175,27 @@ module IsoDoc
174
175
  elem.children = l10n("#{@i18n.source}: #{to_xml(elem.children).strip}")
175
176
  end
176
177
 
178
+ def toc_title_insert_pt(docxml)
179
+ ins = docxml.at(ns("//preface")) ||
180
+ docxml.at(ns("//sections | //annex | //bibliography"))
181
+ &.before("<preface> </preface>")
182
+ &.previous_element or return nil
183
+ ins.children.last.after(" ").next
184
+ end
185
+
186
+ def preface_rearrange(doc)
187
+ move_introduction(doc)
188
+ super
189
+ end
190
+
191
+ def move_introduction(doc)
192
+ source = doc.at(ns("//preface/introduction")) or return
193
+ dest = doc.at(ns("//sections")) ||
194
+ doc.at(ns("//preface")).after("<sections> </sections>").next_element
195
+ dest.children.empty? and dest.children = " "
196
+ dest.children.first.next = source
197
+ end
198
+
177
199
  include Init
178
200
  end
179
201
  end
@@ -99,24 +99,16 @@ module IsoDoc
99
99
  end
100
100
  end
101
101
 
102
- def preface(isoxml, out)
103
- isoxml.xpath(ns("//preface/clause | //preface/references | " \
104
- "//preface/definitions | //preface/terms")).each do |f|
105
- out.div **attr_code(class: "Section3", id: f["id"],
106
- type: f["type"]) do |div|
107
- clause_name(f, f&.at(ns("./title")), div, { class: "IntroTitle" })
108
- f.elements.each do |e|
109
- parse(e, div) unless e.name == "title"
110
- end
111
- end
112
- end
102
+ def preface_attrs(node)
103
+ { id: node["id"], type: node["type"],
104
+ class: node["type"] == "toc" ? "TOC" : "Section3" }
113
105
  end
114
106
 
115
- def introduction(isoxml, out)
116
- f = isoxml.at(ns("//introduction")) || return
117
- out.div class: "Section3", id: f["id"] do |div|
118
- clause_name(f, f.at(ns("./title")), div, { class: "IntroTitle" })
119
- f.elements.each do |e|
107
+ def introduction(clause, out)
108
+ out.div class: "Section3", id: clause["id"] do |div|
109
+ clause_name(clause, clause.at(ns("./title")), div,
110
+ { class: "IntroTitle" })
111
+ clause.elements.each do |e|
120
112
  parse(e, div) unless e.name == "title"
121
113
  end
122
114
  end
@@ -125,11 +117,7 @@ module IsoDoc
125
117
  def make_body2(body, docxml)
126
118
  body.div class: "WordSection2" do |div2|
127
119
  boilerplate docxml, div2
128
- preface_block docxml, div2
129
- abstract docxml, div2
130
- foreword docxml, div2
131
- preface docxml, div2
132
- acknowledgements docxml, div2
120
+ front docxml, div2
133
121
  div2.p { |p| p << "&#xa0;" } # placeholder
134
122
  end
135
123
  section_break(body)
@@ -138,7 +126,8 @@ module IsoDoc
138
126
  def middle(isoxml, out)
139
127
  middle_title(isoxml, out)
140
128
  middle_admonitions(isoxml, out)
141
- introduction isoxml, out
129
+ i = isoxml.at(ns("//sections/introduction")) and
130
+ introduction i, out
142
131
  scope isoxml, out, 0
143
132
  norm_ref isoxml, out, 0
144
133
  clause_etc isoxml, out, 0
@@ -183,6 +172,7 @@ module IsoDoc
183
172
 
184
173
  def commentary(isoxml, out)
185
174
  isoxml.xpath(ns("//annex[@commentary = 'true']")).each do |c|
175
+ out.span style: "mso-bookmark:PRECOMMENTARYPAGEREF"
186
176
  section_break(out)
187
177
  out.div class: "WordSectionCommentary" do |div|
188
178
  commentary_title(isoxml, div)
@@ -38,6 +38,29 @@ module Metanorma
38
38
  end
39
39
 
40
40
  def docidentifier_cleanup(xmldoc); end
41
+
42
+ def note_cleanup(xmldoc)
43
+ note_example_to_table(xmldoc)
44
+ super
45
+ clean_example_keep_separate(xmldoc)
46
+ end
47
+
48
+ def note_example_to_table(xmldoc)
49
+ xmldoc.xpath("//table").each do |t|
50
+ t.xpath("./following-sibling::*").each do |n|
51
+ %w(note example).include?(n.name) or break
52
+ n["keep-separate"] == "true" and break
53
+ n.parent = t
54
+ end
55
+ end
56
+ end
57
+
58
+ def clean_example_keep_separate(xmldoc)
59
+ xmldoc.xpath("//example[@keep-separate] | " \
60
+ "//termexample[@keep-separate]").each do |n|
61
+ n.delete("keep-separate")
62
+ end
63
+ end
41
64
  end
42
65
  end
43
66
  end
@@ -39,6 +39,11 @@ module Metanorma
39
39
  ret
40
40
  end
41
41
 
42
+ def example_attrs(node)
43
+ attr_code(id_unnum_attrs(node).merge(keep_attrs(node))
44
+ .merge("keep-separate": node.attr("keep-separate")))
45
+ end
46
+
42
47
  def html_converter(node)
43
48
  if node.nil?
44
49
  IsoDoc::JIS::HtmlConvert.new({})
@@ -17,6 +17,7 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
+ <!-- VERSION v1.2.2 -->
20
21
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
21
22
  <include href="reqt.rng"/>
22
23
  <include href="basicdoc.rng">
@@ -210,6 +211,9 @@
210
211
  <data type="boolean"/>
211
212
  </attribute>
212
213
  </optional>
214
+ <optional>
215
+ <attribute name="style"/>
216
+ </optional>
213
217
  <ref name="CitationType"/>
214
218
  <oneOrMore>
215
219
  <ref name="PureTextElement"/>
@@ -1349,15 +1353,19 @@
1349
1353
  </choice>
1350
1354
  </element>
1351
1355
  </define>
1356
+ <define name="Root-Attributes">
1357
+ <attribute name="version"/>
1358
+ <attribute name="schema-version"/>
1359
+ <attribute name="type">
1360
+ <choice>
1361
+ <value>semantic</value>
1362
+ <value>presentation</value>
1363
+ </choice>
1364
+ </attribute>
1365
+ </define>
1352
1366
  <define name="standard-document">
1353
1367
  <element name="standard-document">
1354
- <attribute name="version"/>
1355
- <attribute name="type">
1356
- <choice>
1357
- <value>semantic</value>
1358
- <value>presentation</value>
1359
- </choice>
1360
- </attribute>
1368
+ <ref name="Root-Attributes"/>
1361
1369
  <ref name="bibdata"/>
1362
1370
  <optional>
1363
1371
  <ref name="misccontainer"/>
@@ -2131,6 +2139,7 @@
2131
2139
  <choice>
2132
2140
  <value>identical</value>
2133
2141
  <value>modified</value>
2142
+ <value>adapted</value>
2134
2143
  <value>restyled</value>
2135
2144
  <value>context-added</value>
2136
2145
  <value>generalisation</value>
@@ -1,6 +1,9 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <!-- default namespace isostandard = "https://www.metanorma.com/ns/iso" -->
3
+ <!--
4
+ VERSION v1.2.1
5
+ default namespace isostandard = "https://www.metanorma.com/ns/iso"
6
+ -->
4
7
  <include href="isodoc.rng">
5
8
  <start>
6
9
  <ref name="iso-standard"/>
@@ -240,13 +243,7 @@
240
243
  -->
241
244
  <define name="iso-standard">
242
245
  <element name="iso-standard">
243
- <attribute name="version"/>
244
- <attribute name="type">
245
- <choice>
246
- <value>semantic</value>
247
- <value>presentation</value>
248
- </choice>
249
- </attribute>
246
+ <ref name="Root-Attributes"/>
250
247
  <ref name="bibdata"/>
251
248
  <zeroOrMore>
252
249
  <ref name="termdocsource"/>
@@ -1,6 +1,9 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <grammar ns="https://www.metanorma.org/ns/jis" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <!-- default namespace = "https://www.metanorma.com/ns/jis" -->
2
+ <grammar ns='https://www.metanorma.org/ns/jis' xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
+ <!--
4
+ VERSION v1.2.1
5
+ default namespace = "https://www.metanorma.com/ns/jis"
6
+ -->
4
7
  <include href="relaton-jis.rng"/>
5
8
  <include href="isostandard.rng">
6
9
  <start>
@@ -37,13 +40,7 @@
37
40
  -->
38
41
  <define name="jis-standard">
39
42
  <element name="jis-standard">
40
- <attribute name="version"/>
41
- <attribute name="type">
42
- <choice>
43
- <value>semantic</value>
44
- <value>presentation</value>
45
- </choice>
46
- </attribute>
43
+ <ref name="Root-Attributes"/>
47
44
  <ref name="bibdata"/>
48
45
  <zeroOrMore>
49
46
  <ref name="termdocsource"/>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module JIS
3
- VERSION = "0.0.4".freeze
3
+ VERSION = "0.0.6".freeze
4
4
  end
5
5
  end
6
6
 
@@ -31,6 +31,8 @@ Gem::Specification.new do |spec|
31
31
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
32
32
 
33
33
  spec.add_dependency "metanorma-iso", "~> 2.4.2"
34
+ #spec.add_dependency "relaton-bipm", "~> 1.14.8"
35
+ #spec.add_dependency "relaton-iho", "~> 1.14.3"
34
36
  spec.add_dependency "pubid-jis"
35
37
 
36
38
  spec.add_development_dependency "debug"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-jis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-10 00:00:00.000000000 Z
11
+ date: 2023-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso