metanorma-ieee 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +1 -1
  3. data/lib/html2doc/ieee/lists.rb +44 -0
  4. data/lib/html2doc/ieee/notes.rb +57 -0
  5. data/lib/html2doc/ieee.rb +4 -86
  6. data/lib/isodoc/ieee/base_convert.rb +56 -0
  7. data/lib/isodoc/ieee/html/header.html +1 -2
  8. data/lib/isodoc/ieee/html/html_ieee_titlepage.html +11 -0
  9. data/lib/isodoc/ieee/html/htmlstyle.css +2 -1
  10. data/lib/isodoc/ieee/html/htmlstyle.scss +1 -0
  11. data/lib/isodoc/ieee/html/ieee.css +23 -255
  12. data/lib/isodoc/ieee/html/ieee.scss +22 -239
  13. data/lib/isodoc/ieee/html/word_ieee_intro.html +1 -1
  14. data/lib/isodoc/ieee/html/wordstyle.css +20 -23
  15. data/lib/isodoc/ieee/html/wordstyle.scss +20 -17
  16. data/lib/isodoc/ieee/i18n-en.yaml +4 -0
  17. data/lib/isodoc/ieee/ieee.amendment.xsl +1835 -736
  18. data/lib/isodoc/ieee/ieee.standard.xsl +1835 -736
  19. data/lib/isodoc/ieee/metadata.rb +25 -4
  20. data/lib/isodoc/ieee/presentation_terms.rb +15 -2
  21. data/lib/isodoc/ieee/presentation_xml_convert.rb +85 -0
  22. data/lib/isodoc/ieee/word_authority.rb +54 -0
  23. data/lib/isodoc/ieee/word_cleanup.rb +55 -65
  24. data/lib/isodoc/ieee/word_cleanup_blocks.rb +151 -0
  25. data/lib/isodoc/ieee/word_convert.rb +86 -2
  26. data/lib/isodoc/ieee/xref.rb +31 -0
  27. data/lib/metanorma/ieee/boilerplate.xml +4 -4
  28. data/lib/metanorma/ieee/cleanup.rb +37 -73
  29. data/lib/metanorma/ieee/cleanup_ref.rb +117 -0
  30. data/lib/metanorma/ieee/front.rb +14 -10
  31. data/lib/metanorma/ieee/isodoc.rng +16 -0
  32. data/lib/metanorma/ieee/validate.rb +50 -6
  33. data/lib/metanorma/ieee/validate_section.rb +14 -7
  34. data/lib/metanorma/ieee/validate_style.rb +5 -1
  35. data/lib/metanorma/ieee/version.rb +1 -1
  36. data/lib/relaton/render/config.yml +44 -0
  37. data/lib/relaton/render/general.rb +13 -0
  38. metadata +8 -2
@@ -72,6 +72,37 @@ module IsoDoc
72
72
  )
73
73
  end
74
74
  end
75
+
76
+ def termnote_anchor_names(docxml)
77
+ docxml.xpath(ns("//*[termnote]")).each do |t|
78
+ c = Counter.new
79
+ sequence = UUIDTools::UUID.random_create.to_s
80
+ notes = t.xpath(ns("./termnote"))
81
+ notes.reject { |n| blank?(n["id"]) }.each do |n|
82
+ @anchors[n["id"]] =
83
+ anchor_struct("#{@labels['termnote']} #{increment_label(notes, n, c)}",
84
+ n,
85
+ @labels["note_xref"], "termnote", false)
86
+ .merge(sequence: sequence)
87
+ end
88
+ end
89
+ end
90
+
91
+ def note_anchor_names1(notes, counter)
92
+ sequence = UUIDTools::UUID.random_create.to_s
93
+ notes.each do |n|
94
+ next if @anchors[n["id"]] || blank?(n["id"])
95
+
96
+ @anchors[n["id"]] =
97
+ anchor_struct(increment_label(notes, n, counter), n,
98
+ @labels["note_xref"], "note", false)
99
+ .merge(sequence: sequence)
100
+ end
101
+ end
102
+
103
+ def annex_name_lbl(clause, num)
104
+ super.sub(%r{<br/>(.*)$}, "<br/><span class='obligation'>\\1</span>")
105
+ end
75
106
  end
76
107
  end
77
108
  end
@@ -280,7 +280,7 @@
280
280
  </clause>
281
281
 
282
282
  <clause>
283
- <table unnumbered="true">
283
+ <table unnumbered="true" id="_isbn_pdf_print">
284
284
  <tbody>
285
285
  <tr><td>PDF:</td> <td>ISBN {{ isbn_pdf }}</td> <td>{{ stdid_pdf}}</td></tr>
286
286
  <tr><td>Print:</td> <td>ISBN {{ isbn_print}}</td> <td>{{ stdid_print}}</td></tr>
@@ -289,9 +289,9 @@
289
289
  </clause>
290
290
 
291
291
  <clause>
292
- <p>IEEE prohibits discrimination, harassment, and bullying.</p>
293
- <p>For more information, visit <link target="https://www.ieee.org/about/corporate/governance/p9-26.html"/>.</p>
294
- <p>No part of this publication may be reproduced in any form, in an electronic retrieval system or otherwise, without the prior written permission of the publisher.</p>
292
+ <p><em>IEEE prohibits discrimination, harassment, and bullying.</em><br/>
293
+ <em>For more information, visit <link target="https://www.ieee.org/about/corporate/governance/p9-26.html"/>.</em><br/>
294
+ <em>No part of this publication may be reproduced in any form, in an electronic retrieval system or otherwise, without the prior written permission of the publisher.</em></p>
295
295
  </clause>
296
296
  </feedback-statement>
297
297
  </boilerplate>
@@ -1,25 +1,8 @@
1
+ require_relative "cleanup_ref"
2
+
1
3
  module Metanorma
2
4
  module IEEE
3
5
  class Converter < Standoc::Converter
4
- BIBLIO =
5
- "//bibliography/references[@normative = 'false'][not(@hidden)] | "\
6
- "//bibliography/clause[.//references[@normative = 'false']] | "\
7
- "//annex//references[@normative = 'false'][not(@hidden)]".freeze
8
-
9
- def boilerplate_cleanup(xmldoc)
10
- f = xmldoc.at(BIBLIO) and biblio_preface(f)
11
- super
12
- end
13
-
14
- def biblio_preface(ref)
15
- if ref.at("./note[@type = 'boilerplate']")
16
- unwrap_boilerplate_clauses(ref, ".")
17
- else
18
- pref = @i18n.biblio_pref
19
- ref.at("./title").next = "<p>#{pref}</p>"
20
- end
21
- end
22
-
23
6
  def initial_boilerplate(xml, isodoc)
24
7
  intro_boilerplate(xml, isodoc)
25
8
  super
@@ -29,7 +12,7 @@ module Metanorma
29
12
  return unless intro = xml.at("//introduction/title")
30
13
 
31
14
  template = <<~ADM
32
- This introduction is not part of P{{ docnumeric }}{% if draft %}/D{{ draft }}{% endif %}, {{ doctitle }}
15
+ This introduction is not part of P{{ docnumeric }}{% if draft %}/D{{ draft }}{% endif %}, {{ full_doctitle }}
33
16
  ADM
34
17
  adm = isodoc.populate_template(template)
35
18
  intro.next = "<admonition>#{adm}</admonition>"
@@ -70,59 +53,6 @@ module Metanorma
70
53
  ins << "<fn><p>#{@i18n.note_inform_fn}</p></fn>"
71
54
  end
72
55
 
73
- def sort_biblio(bib)
74
- bib.sort do |a, b|
75
- sort_biblio_key(a) <=> sort_biblio_key(b)
76
- end
77
- end
78
-
79
- OTHERIDS = "@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or "\
80
- "@type = 'ISBN'".freeze
81
-
82
- def sort_biblio_key(bib)
83
- id = bib.at("./docidentifier[not(#{OTHERIDS})]")
84
- title = bib.at("./title[@type = 'main']") ||
85
- bib.at("./title") || bib.at("./formattedref")
86
- "#{id&.text || 'ZZZZZ'} :: #{title&.text}"
87
- end
88
-
89
- def normref_cleanup(xmldoc)
90
- super
91
- normref_reorder(xmldoc)
92
- end
93
-
94
- def normref_reorder(xmldoc)
95
- xmldoc.xpath("//references[@normative = 'true']").each do |r|
96
- biblio_reorder1(r)
97
- end
98
- end
99
-
100
- # end of citeas generation
101
- def quotesource_cleanup(xmldoc)
102
- super
103
- trademark_ieee_erefs(xmldoc)
104
- end
105
-
106
- # Style manual 12.3.5
107
- def trademark_ieee_erefs(xmldoc)
108
- ieee = xmldoc.xpath("//references/bibitem")
109
- .each_with_object({}) do |b, m|
110
- n = b.at("./contributor[role/@type = 'publisher']/organization/name")
111
- n&.text == "Institute of Electrical and Electronics Engineers" and
112
- m[b["id"]] = true
113
- end
114
- trademark_ieee_erefs1(xmldoc, "//preface//eref", ieee)
115
- trademark_ieee_erefs1(xmldoc, "//sections//eref | //annex//eref", ieee)
116
- end
117
-
118
- def trademark_ieee_erefs1(xmldoc, path, ieee)
119
- xmldoc.xpath(path).each_with_object({}) do |e, m|
120
- ieee[e["bibitemid"]] or next
121
- m[e["bibitemid"]] or e["citeas"] += "\u2122"
122
- m[e["bibitemid"]] = true
123
- end
124
- end
125
-
126
56
  def termdef_cleanup(xmldoc)
127
57
  term_reorder(xmldoc)
128
58
  super
@@ -155,6 +85,40 @@ module Metanorma
155
85
  "./preferred/graphical-symbol/figure/@id")
156
86
  d.text.downcase
157
87
  end
88
+
89
+ def table_footnote_renumber1(fnote, idx, seen)
90
+ content = footnote_content(fnote)
91
+ idx += 1
92
+ if seen[content]
93
+ fnote.children = "<p>See Footnote #{seen[content]}.</p>"
94
+ else seen[content] = idx
95
+ end
96
+ fnote["reference"] = (idx - 1 + "a".ord).chr
97
+ fnote["table"] = true
98
+ [idx, seen]
99
+ end
100
+
101
+ def other_footnote_renumber1(fnote, idx, seen)
102
+ return [idx, seen] if fnote["table"]
103
+
104
+ content = footnote_content(fnote)
105
+ idx += 1
106
+ if seen[content]
107
+ fnote.children = "<p>See Footnote #{seen[content]}.</p>"
108
+ else seen[content] = idx
109
+ end
110
+ fnote["reference"] = idx.to_s
111
+ [idx, seen]
112
+ end
113
+
114
+ TERM_CLAUSE = "//sections//terms".freeze
115
+
116
+ def termdef_boilerplate_insert(xmldoc, isodoc, once = false)
117
+ once = true
118
+ super
119
+ end
120
+
121
+ def term_defs_boilerplate_cont(src, term, isodoc); end
158
122
  end
159
123
  end
160
124
  end
@@ -0,0 +1,117 @@
1
+ module Metanorma
2
+ module IEEE
3
+ class Converter < Standoc::Converter
4
+ BIBLIO =
5
+ "//bibliography/references[@normative = 'false'][not(@hidden)] | "\
6
+ "//bibliography/clause[.//references[@normative = 'false']] | "\
7
+ "//annex//references[@normative = 'false'][not(@hidden)]".freeze
8
+
9
+ def boilerplate_cleanup(xmldoc)
10
+ f = xmldoc.at(BIBLIO) and biblio_preface(f)
11
+ super
12
+ end
13
+
14
+ def biblio_preface(ref)
15
+ if ref.at("./note[@type = 'boilerplate']")
16
+ unwrap_boilerplate_clauses(ref, ".")
17
+ else
18
+ pref = @i18n.biblio_pref
19
+ ref.at("./title").next = "<p>#{pref}</p>"
20
+ end
21
+ end
22
+
23
+ def sort_biblio(bib)
24
+ bib.sort do |a, b|
25
+ sort_biblio_key(a) <=> sort_biblio_key(b)
26
+ end
27
+ end
28
+
29
+ OTHERIDS = "@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or "\
30
+ "@type = 'ISBN'".freeze
31
+
32
+ # Alphabetic by rendering: author surname or designation, followed by title
33
+ def sort_biblio_key(bib)
34
+ name = designator_or_name(bib)
35
+ title = bib.at("./title[@type = 'main']")&.text ||
36
+ bib.at("./title")&.text || bib.at("./formattedref")&.text
37
+ "#{name}. #{title}"
38
+ end
39
+
40
+ def designator_or_name(bib)
41
+ case bib["type"]
42
+ when "standard", "techreport"
43
+ n = bib.at("./docidentifier[@primary]") ||
44
+ bib.at("./docidentifier[not(#{OTHERIDS})]")
45
+ n&.text || "ZZZZ"
46
+ else
47
+ bib1 = bib.dup
48
+ bib1.add_namespace(nil, self.class::XML_NAMESPACE)
49
+ i = IsoDoc::IEEE::PresentationXMLConvert.new({ lang: @lang,
50
+ script: @script })
51
+ i.i18n_init(@lang, @script)
52
+ i.creatornames(bib1)
53
+ end
54
+ end
55
+
56
+ def normref_cleanup(xmldoc)
57
+ super
58
+ normref_reorder(xmldoc)
59
+ end
60
+
61
+ def normref_reorder(xmldoc)
62
+ xmldoc.xpath("//references[@normative = 'true']").each do |r|
63
+ biblio_reorder1(r)
64
+ end
65
+ end
66
+
67
+ # end of citeas generation
68
+ def quotesource_cleanup(xmldoc)
69
+ super
70
+ trademark_ieee_erefs(xmldoc)
71
+ end
72
+
73
+ # Style manual 12.3.5
74
+ def trademark_ieee_erefs(xmldoc)
75
+ ieee = xmldoc.xpath("//references/bibitem")
76
+ .each_with_object({}) do |b, m|
77
+ n = b.at("./contributor[role/@type = 'publisher']/organization/name")
78
+ n&.text == "Institute of Electrical and Electronics Engineers" and
79
+ m[b["id"]] = true
80
+ end
81
+ trademark_ieee_erefs1(xmldoc, "//preface//eref", ieee)
82
+ trademark_ieee_erefs1(xmldoc, "//sections//eref | //annex//eref", ieee)
83
+ end
84
+
85
+ def trademark_ieee_erefs1(xmldoc, path, ieee)
86
+ xmldoc.xpath(path).each_with_object({}) do |e, m|
87
+ ieee[e["bibitemid"]] or next
88
+ m[e["bibitemid"]] or e["citeas"] += "\u2122"
89
+ m[e["bibitemid"]] = true
90
+ end
91
+ end
92
+
93
+ def biblio_renumber(xmldoc)
94
+ i = 0
95
+ xmldoc.xpath("//references[not(@normative = 'true')]"\
96
+ "[not(@hidden = 'true')]").each do |r|
97
+ r.xpath("./bibitem[not(@hidden = 'true')]").each do |b|
98
+ i += 1
99
+ biblio_renumber1(b, i)
100
+ end
101
+ end
102
+ end
103
+
104
+ def biblio_renumber1(bib, idx)
105
+ docid = bib.at("./docidentifier[@type = 'metanorma' or "\
106
+ "@type = 'metanorma-ordinal']")
107
+ if /^\[?\d+\]?$/.match?(docid&.text)
108
+ docid.children = "[B#{idx}]"
109
+ elsif docid = bib.at("./docidentifier") || bib.at("./title[last()]") ||
110
+ bib.at("./formattedref")
111
+ docid.next =
112
+ "<docidentifier type='metanorma-ordinal'>[B#{idx}]</docidentifier>"
113
+ end
114
+ end
115
+ end
116
+ end
117
+ end
@@ -54,31 +54,31 @@ module Metanorma
54
54
  end
55
55
 
56
56
  def wg_members(node, xml)
57
- a = node.attr("wg_chair") and
57
+ a = node.attr("wg-chair") and
58
58
  metadata_editor(a, "Working Group Chair", xml)
59
- a = node.attr("wg_vicechair") and
59
+ a = node.attr("wg-vicechair") and
60
60
  metadata_editor(a, "Working Group Vice-Chair", xml)
61
- a = node.attr("wg_secretary") and
61
+ a = node.attr("wg-secretary") and
62
62
  metadata_editor(a, "Working Group Secretary", xml)
63
- a = node.attr("wg_members") and
63
+ a = node.attr("wg-members") and
64
64
  metadata_multi_editors(a, "Working Group Member", xml)
65
65
  end
66
66
 
67
67
  def bg_members(node, xml)
68
- a = node.attr("balloting_group_members") and
68
+ a = node.attr("balloting-group-members") and
69
69
  metadata_multi_editors(a, "Balloting Group Member", xml)
70
70
  end
71
71
 
72
72
  def std_board_members(node, xml)
73
- a = node.attr("std_board_chair") and
73
+ a = node.attr("std-board-chair") and
74
74
  metadata_editor(a, "Standards Board Chair", xml)
75
- a = node.attr("std_board_vicechair") and
75
+ a = node.attr("std-board-vicechair") and
76
76
  metadata_editor(a, "Standards Board Vice-Chair", xml)
77
- a = node.attr("std_board_pastchair") and
77
+ a = node.attr("std-board-pastchair") and
78
78
  metadata_editor(a, "Standards Board Past Chair", xml)
79
- a = node.attr("std_board_secretary") and
79
+ a = node.attr("std-board-secretary") and
80
80
  metadata_editor(a, "Standards Board Secretary", xml)
81
- a = node.attr("balloting_group_members") and
81
+ a = node.attr("balloting-group-members") and
82
82
  metadata_multi_editors(a, "Standards Board Member", xml)
83
83
  end
84
84
 
@@ -115,6 +115,10 @@ module Metanorma
115
115
  def org_abbrev
116
116
  { "Institute of Electrical and Electronic Engineers" => "IEEE" }
117
117
  end
118
+
119
+ def relaton_relations
120
+ super + %w(merges updates)
121
+ end
118
122
  end
119
123
  end
120
124
  end
@@ -69,6 +69,17 @@
69
69
  </zeroOrMore>
70
70
  </element>
71
71
  </define>
72
+ <define name="AdmonitionType">
73
+ <choice>
74
+ <value>warning</value>
75
+ <value>note</value>
76
+ <value>tip</value>
77
+ <value>important</value>
78
+ <value>caution</value>
79
+ <value>statement</value>
80
+ <value>editorial</value>
81
+ </choice>
82
+ </define>
72
83
  <define name="index">
73
84
  <element name="index">
74
85
  <optional>
@@ -116,6 +127,11 @@
116
127
  <data type="boolean"/>
117
128
  </attribute>
118
129
  </optional>
130
+ <optional>
131
+ <attribute name="suppress_identifier">
132
+ <data type="boolean"/>
133
+ </attribute>
134
+ </optional>
119
135
  <ref name="BibliographicItem"/>
120
136
  </element>
121
137
  </define>
@@ -14,9 +14,9 @@ module Metanorma
14
14
  super
15
15
  bibdata_validate(doc.root)
16
16
  title_validate(doc.root)
17
- locality_erefs_validate(doc.root)
17
+ locality_validate(doc.root)
18
18
  bibitem_validate(doc.root)
19
- listcount_validate(doc)
19
+ list_validate(doc)
20
20
  table_style(doc)
21
21
  figure_validate(doc)
22
22
  end
@@ -86,12 +86,26 @@ module Metanorma
86
86
  up upon versus via with within without a an the).include?(word)
87
87
  end
88
88
 
89
+ def locality_validate(root)
90
+ locality_range_validate(root)
91
+ locality_erefs_validate(root)
92
+ end
93
+
94
+ # Style manual 17.2 &c
95
+ def locality_range_validate(root)
96
+ root.xpath("//eref | xref").each do |e|
97
+ e.at(".//localityStack[@connective = 'from'] | .//referenceTo") and
98
+ @log.add("Style", e, "Cross-reference contains range, "\
99
+ "should be separate cross-references")
100
+ end
101
+ end
102
+
89
103
  # Style manual 12.3.2
90
104
  def locality_erefs_validate(root)
91
105
  root.xpath("//eref[descendant::locality]").each do |t|
92
106
  if !/[:-](\d+{4})$/.match?(t["citeas"])
93
107
  @log.add("Style", t,
94
- "undated reference #{t['citeas']} should not contain "\
108
+ "Undated reference #{t['citeas']} should not contain "\
95
109
  "specific elements")
96
110
  end
97
111
  end
@@ -110,9 +124,30 @@ module Metanorma
110
124
  end
111
125
  end
112
126
 
127
+ def list_validate(doc)
128
+ listcount_validate(doc)
129
+ listdepth_validate(doc)
130
+ end
131
+
132
+ # Template provision of styles
133
+ def listdepth_validate(doc)
134
+ doc.xpath("//ul[.//ul//ul]").each do |u|
135
+ next unless u.ancestors("ul").empty?
136
+
137
+ @log.add("Style", u,
138
+ "Use ordered lists for lists more than two levels deep.")
139
+ end
140
+ doc.xpath("//ol[.//ol//ol//ol//ol//ol]").each do |u|
141
+ next unless u.ancestors("ol").empty?
142
+
143
+ @log.add("Style", u,
144
+ "Ordered lists should not be more than five levels deep.")
145
+ end
146
+ end
147
+
113
148
  # Style manual 13.3
114
149
  def listcount_validate(doc)
115
- doc.xpath("//clause | //annex").each do |c|
150
+ doc.xpath("//sections//clause | //annex").each do |c|
116
151
  next if c.xpath(".//ol").empty?
117
152
 
118
153
  ols = c.xpath(".//ol") -
@@ -127,6 +162,7 @@ module Metanorma
127
162
  def figure_validate(xmldoc)
128
163
  xrefs = xrefs(xmldoc)
129
164
  figure_name_validate(xmldoc, xrefs)
165
+ figure_name_style_validate(xmldoc)
130
166
  table_figure_name_validate(xmldoc, xrefs)
131
167
  table_figure_quantity_validate(xmldoc)
132
168
  end
@@ -159,10 +195,18 @@ module Metanorma
159
195
  num = xrefs.anchor(f["id"], :label)
160
196
  File.basename(i["src"], ".*") == "#{pref}_fig#{num}" or
161
197
  @log.add("Style", i,
162
- "image name #{i['src']} is expected to be #{pref}_fig#{num}")
198
+ "Image name #{i['src']} is expected to be #{pref}_fig#{num}")
163
199
  end
164
200
  end
165
201
 
202
+ # Style manual 17.2
203
+ def figure_name_style_validate(docxml)
204
+ docxml.xpath("//figure/name").each do |td|
205
+ style_regex(/^(?<num>\p{Lower}\s*)/, "figure heading should be capitalised",
206
+ td, td.text)
207
+ end
208
+ end
209
+
166
210
  def table_figure_name_validate(xmldoc, xrefs)
167
211
  xmldoc.xpath("//table[.//figure]").each do |t|
168
212
  xmldoc.xpath(".//figure").each do |f|
@@ -172,7 +216,7 @@ module Metanorma
172
216
  num = tablefigurenumber(t, f, xrefs)
173
217
  File.basename(i["src"]) == num or
174
218
  @log.add("Style", i,
175
- "image name #{i['src']} is expected to be #{num}")
219
+ "Image name #{i['src']} is expected to be #{num}")
176
220
  end
177
221
  end
178
222
  end
@@ -58,6 +58,7 @@ module Metanorma
58
58
  names, n = sections_sequence_validate_start(root)
59
59
  names, n = sections_sequence_validate_body(names, n)
60
60
  sections_sequence_validate_end(names, n)
61
+ bibliography_validate(root)
61
62
  end
62
63
 
63
64
  def sections_sequence_validate_start(root)
@@ -86,13 +87,6 @@ module Metanorma
86
87
  elem&.at("./self::references[@normative = 'true']") ||
87
88
  @log.add("Style", nil, "Document must include (references) "\
88
89
  "Normative References")
89
- elem = names&.shift
90
- elem&.at("./self::references[@normative = 'false']") ||
91
- @log.add("Style", elem,
92
- "Final section must be (references) Bibliography")
93
- names.empty? ||
94
- @log.add("Style", elem,
95
- "There are sections after the final Bibliography")
96
90
  end
97
91
 
98
92
  # Style manual 13.1
@@ -114,6 +108,19 @@ module Metanorma
114
108
  @log.add("Style", nil, "#{location}: subclause is only child")
115
109
  end
116
110
  end
111
+
112
+ # Style manual 19.1
113
+ def bibliography_validate(root)
114
+ bib = root.at("//references[@normative = 'false']") or return
115
+ if annex = bib.at(".//ancestor::annex")
116
+ prec = annex.xpath("./preceding-sibling::annex")
117
+ foll = annex.xpath("./following-sibling::annex")
118
+ valid = prec.empty? || foll.empty?
119
+ else valid = false
120
+ end
121
+ valid or @log.add("Style", bib, "Bibliography must be either the first "\
122
+ "or the last document annex")
123
+ end
117
124
  end
118
125
  end
119
126
  end
@@ -68,13 +68,17 @@ module Metanorma
68
68
  "unit is needed on both value and tolerance", node, text)
69
69
  end
70
70
 
71
- # Style manual 16.3.2
71
+ # Style manual 16.2, 16.3.2
72
72
  def table_style(docxml)
73
73
  docxml.xpath("//td").each do |td|
74
74
  style_regex(/^(?<num>[\u2212-]?[0-9]{5,}[.0-9]*|-?[0-9]+\.[0-9]{5,})$/,
75
75
  "number in table not broken up in threes", td, td.text)
76
76
  end
77
77
  docxml.xpath("//table").each { |t| table_style_columns(t) }
78
+ docxml.xpath("//table/name | //th").each do |td|
79
+ style_regex(/^(?<num>\p{Lower}\S*)/, "table heading should be capitalised",
80
+ td, td.text)
81
+ end
78
82
  end
79
83
 
80
84
  # deliberately doing naive, ignoring rowspan
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IEEE
3
- VERSION = "0.0.1".freeze
3
+ VERSION = "0.0.2".freeze
4
4
  end
5
5
  end
@@ -0,0 +1,44 @@
1
+ nametemplate:
2
+ one: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }} ,_{{initials[0] | join: '. '}}.{% endif %}"
3
+ two: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }} ,_{{initials[0] | join: '. '}}.{% endif %} , {{ labels['and'] }} {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{initials[1] | join: '. '}}. {{surname[1] }}{% endif %}"
4
+ more: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }} ,_{{initials[0] | join: '. '}}.{% endif %} , {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{initials[1] | join: '. '}}. {{surname[1] }}{% endif %} , {{ labels['and'] }} {% if nonpersonal[2] %}{{ nonpersonal[2] }}{% else %}{{initials[2] | join: '. '}}. {{surname[2] }}{% endif %}"
5
+ extenttemplate:
6
+ misc: "{{ volume }}, {{issue}}, {{ page }}, {{ duration }}"
7
+ template:
8
+ # skip standardidentifier, it is inserted in front of formattedref within metanorma
9
+ standard: "{{ title }}."
10
+ techreport: standard
11
+ article: "{{creatornames}}, “{{title}},” <em>{{ series }}</em>, {{ extent }}, {{ date }}, {{ labels['viewed'] }}_{{date_accessed}}, {{ uri }} ."
12
+ book: "{{creatornames}}, <em>{{title}}</em>, {{ edition }}, {{place}}: {{publisher}}, {{date}}, {{ labels['viewed'] }}_{{date_accessed}}, {{ uri }} ."
13
+ booklet: book
14
+ manual: book
15
+ proceedings: book
16
+ inproceedings: "{{ creatornames }}, “{{ title }},” <em>{{host_title}}</em>, {{place}}, {{extent}}, {{date}}, {{ labels['viewed'] }}_{{date_accessed}}, {{ uri }} ."
17
+ inbook: "{{ creatornames }}, “{{ title }},” {{ labels['in'] }} {{ host_creatornames}} ({{ host_role}}) : <em>{{host_title}}</em>, {{place}}: {{publisher}}, {{date}}, {{extent}}, {{ labels['viewed'] }}_{{date_accessed}}, {{ uri }} ."
18
+ incollection: inbook
19
+ thesis: "{{ creatornames }} , “{{ title }}.” {{ medium | capitalize }}, {{ publisher }}, {{ date }}, {{ labels['viewed'] }}_{{date_accessed}}, {{ uri }} ."
20
+ unpublished: thesis
21
+ misc: thesis
22
+ website: thesis
23
+ webresource: thesis
24
+ software: thesis
25
+ dataset: thesis
26
+ map: thesis
27
+ audiovisual: thesis
28
+ film: thesis
29
+ video: thesis
30
+ broadcast: thesis
31
+ graphic_work: thesis
32
+ music: thesis
33
+ performance: thesis
34
+ patent: thesis
35
+ archival: thesis
36
+ social_media: thesis
37
+ alert: thesis
38
+ message: thesis
39
+ conversation: thesis
40
+ internal: thesis
41
+
42
+
43
+
44
+
@@ -0,0 +1,13 @@
1
+ require "relaton-render"
2
+
3
+ module Relaton
4
+ module Render
5
+ module IEEE
6
+ class General < ::Relaton::Render::IsoDoc::General
7
+ def config_loc
8
+ YAML.load_file(File.join(File.dirname(__FILE__), "config.yml"))
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end