metanorma-nist 1.0.10 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +0 -1
  3. data/.github/workflows/ubuntu.yml +10 -7
  4. data/.github/workflows/windows.yml +0 -1
  5. data/Rakefile +2 -0
  6. data/lib/asciidoctor/nist/boilerplate.rb +2 -2
  7. data/lib/asciidoctor/nist/cleanup.rb +34 -4
  8. data/lib/asciidoctor/nist/converter.rb +17 -19
  9. data/lib/asciidoctor/nist/front.rb +27 -23
  10. data/lib/asciidoctor/nist/front_id.rb +1 -1
  11. data/lib/asciidoctor/nist/isodoc.rng +12 -6
  12. data/lib/asciidoctor/nist/validate.rb +16 -9
  13. data/lib/isodoc/nist/base_convert.rb +8 -47
  14. data/lib/isodoc/nist/html/_coverpage.css +243 -0
  15. data/lib/isodoc/nist/html/_coverpage.scss +1 -1
  16. data/lib/isodoc/nist/html/html_nist_titlepage.html +1 -1
  17. data/lib/isodoc/nist/html/htmlstyle.css +955 -0
  18. data/lib/isodoc/nist/html/nist.css +1055 -0
  19. data/lib/isodoc/nist/html/nist.scss +0 -1
  20. data/lib/isodoc/nist/html/nist_cswp.css +996 -0
  21. data/lib/isodoc/nist/html/nist_cswp.scss +0 -1
  22. data/lib/isodoc/nist/html/wordstyle.css +1440 -0
  23. data/lib/isodoc/nist/html/wordstyle.scss +0 -1
  24. data/lib/isodoc/nist/html/wordstyle_cswp.css +1119 -0
  25. data/lib/isodoc/nist/html/wordstyle_cswp.scss +0 -1
  26. data/lib/isodoc/nist/html_convert.rb +4 -9
  27. data/lib/isodoc/nist/i18n-en.yaml +3 -0
  28. data/lib/isodoc/nist/i18n.rb +10 -0
  29. data/lib/isodoc/nist/init.rb +37 -0
  30. data/lib/isodoc/nist/metadata_id.rb +1 -1
  31. data/lib/isodoc/nist/nist.cswp.xsl +2010 -2301
  32. data/lib/isodoc/nist/nist.sp.xsl +2824 -2902
  33. data/lib/isodoc/nist/pdf_convert.rb +4 -16
  34. data/lib/isodoc/nist/presentation_xml_convert.rb +80 -0
  35. data/lib/isodoc/nist/refs.rb +8 -19
  36. data/lib/isodoc/nist/render.rb +2 -1
  37. data/lib/isodoc/nist/render_dates.rb +0 -25
  38. data/lib/isodoc/nist/section.rb +9 -6
  39. data/lib/isodoc/nist/word_convert.rb +7 -19
  40. data/lib/isodoc/nist/word_convert_toc.rb +2 -2
  41. data/lib/isodoc/nist/{xrefs.rb → xref.rb} +2 -25
  42. data/lib/metanorma-nist.rb +2 -0
  43. data/lib/metanorma/nist/processor.rb +6 -8
  44. data/lib/metanorma/nist/version.rb +1 -1
  45. data/metanorma-nist.gemspec +3 -2
  46. metadata +34 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fdfccf7f80188c5fdb7b176e3f2e1ec2533218d878ffc2e8798a4ad3b9cd70f7
4
- data.tar.gz: d98180fcdd728e854e47df4f8ca07503c77de570ac3c7f41ab21c6ae0b516e87
3
+ metadata.gz: 0def1e8573338383bf4e456fc4fc092a232c08ef46b676facc570908ad9fd9aa
4
+ data.tar.gz: 820cf042c13235a0519ee6818573d9fb445bb6e0d368265a7e72753ea7e40c94
5
5
  SHA512:
6
- metadata.gz: 25231b4da1777b011ef5ac9eb9aa2c9691227882ca37fa59cc034a4bbf5a22b077bb59b512e1673488d7a497b36c304d508e8e65b45fd0deb5b3aa069304a9bc
7
- data.tar.gz: ba4697d24bb857a5468dd1dc02e4b0bf83cb8ea296c6fc08b205c855d8b9b4dd000a08bcba3f7871ce06ab5919dfeb758148f862464fbbc78ed6124b6d26aa7b
6
+ metadata.gz: 0c5a2abc6a91c220a19917f5b314a18fa06067263c391fbe4d97897d16461b11af49c61feaf8a737264c355627aa42a202981a1b8c40ed7fb37bb8c39791b2e0
7
+ data.tar.gz: 0fc41aabba065a26cef8e432bf32b2c5c2927e9a3826cf89c578905e9154b51085ca447463e8feddff9ed7f21ae32ed5f79b65981dee54921f86d976c0b4b40d
@@ -29,7 +29,6 @@ jobs:
29
29
  uses: actions/setup-ruby@v1
30
30
  with:
31
31
  ruby-version: ${{ matrix.ruby }}
32
- architecture: 'x64'
33
32
  - name: Update gems
34
33
  run: |
35
34
  sudo gem install bundler --force
@@ -31,7 +31,6 @@ jobs:
31
31
  uses: actions/setup-ruby@v1
32
32
  with:
33
33
  ruby-version: ${{ matrix.ruby }}
34
- architecture: 'x64'
35
34
  - name: Update gems
36
35
  run: |
37
36
  gem install bundler
@@ -39,15 +38,19 @@ jobs:
39
38
  - name: Run specs
40
39
  run: |
41
40
  bundle exec rake
42
- - name: Trigger dependent repositories
43
- if: github.ref == 'refs/heads/master' && matrix.ruby == '2.6'
41
+ - name: Trigger repositories
42
+ if: matrix.ruby == '2.6'
44
43
  env:
45
- GH_USERNAME: ${{ secrets.PAT_USERNAME }}
46
- GH_ACCESS_TOKEN: ${{ secrets.PAT_TOKEN }}
44
+ GH_USERNAME: metanorma-ci
45
+ GH_ACCESS_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
47
46
  run: |
48
47
  curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
49
48
  [[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
50
- for repo in $DEPENDENT_REPOS
49
+ CLIENT_PAYLOAD=$(cat <<EOF
50
+ "{ "ref": "${GITHUB_REF}", "repo": "${GITHUB_REPOSITORY}" }"
51
+ EOF
52
+ )
53
+ for repo in $REPOS
51
54
  do
52
- sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "{ \"ref\": \"${GITHUB_REF}\" }"
55
+ sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "$CLIENT_PAYLOAD"
53
56
  done
@@ -29,7 +29,6 @@ jobs:
29
29
  uses: actions/setup-ruby@v1
30
30
  with:
31
31
  ruby-version: ${{ matrix.ruby }}
32
- architecture: 'x64'
33
32
  - name: Update gems
34
33
  shell: pwsh
35
34
  run: |
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
+ require 'isodoc/gem_tasks'
3
4
 
5
+ IsoDoc::GemTasks.install
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
8
  task default: :spec
@@ -94,8 +94,8 @@ module Asciidoctor
94
94
 
95
95
  def boilerplate_isodoc(xmldoc)
96
96
  conv = super
97
- conv.labels = conv.labels.merge({nist_division: @nistdivision,
98
- nist_division_address: @nistdivisionaddress})
97
+ conv.i18n.set(:nist_division, @nistdivision)
98
+ conv.i18n.set(:nist_division_address, @nistdivisionaddress)
99
99
  conv
100
100
  end
101
101
 
@@ -3,9 +3,15 @@ module Asciidoctor
3
3
  class Converter < Standoc::Converter
4
4
  def cleanup(xmldoc)
5
5
  sourcecode_cleanup(xmldoc)
6
+ annex_rename(xmldoc)
6
7
  super
7
8
  end
8
9
 
10
+ def annex_rename(xmldoc)
11
+ return unless xmldoc.xpath("//references").size == 1
12
+ replace_title(xmldoc, "//annex[references]", @i18n&.normref, true)
13
+ end
14
+
9
15
  def sourcecode_cleanup(xmldoc)
10
16
  xmldoc.xpath("//sourcecode").each do |x|
11
17
  x.traverse do |n|
@@ -37,7 +43,7 @@ module Asciidoctor
37
43
  move_execsummary_into_preface(x, preface)
38
44
  end
39
45
 
40
- def move_clauses_into_preface1(x, preface)
46
+ def move_clauses_into_preface1(x, preface)
41
47
  x.xpath("//clause[@preface]").each do |c|
42
48
  c.delete("preface")
43
49
  title = c&.at("./title")&.text.downcase
@@ -45,9 +51,9 @@ module Asciidoctor
45
51
  c.name = "executivesummary" if title == "executive summary"
46
52
  preface.add_child c.remove
47
53
  end
48
- end
54
+ end
49
55
 
50
- def move_execsummary_into_preface(x, preface)
56
+ def move_execsummary_into_preface(x, preface)
51
57
  x.xpath("//clause[@executivesummary]").each do |c|
52
58
  c.delete("executivesummary")
53
59
  title = c&.at("./title")&.text.downcase
@@ -150,7 +156,7 @@ module Asciidoctor
150
156
  elsif metaid = bib&.at("./docidentifier[@type = 'NIST']")&.text
151
157
  key = metaid.sub(/-(\d+)/) {|m| sprintf "-%09d", ($1.to_i) }
152
158
  elsif metaid = bib&.at("./docidentifier[not(@type = 'DOI' or "\
153
- "@type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN')]")&.text
159
+ "@type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN')]")&.text
154
160
  key = metaid.sub(/-(\d+)/) {|m| sprintf "-%09d", ($1.to_i) }
155
161
  else # no usable docid
156
162
  key = "000000000" + bib["id"]
@@ -171,6 +177,30 @@ module Asciidoctor
171
177
  end
172
178
  acc
173
179
  end
180
+
181
+ def section_names_refs_cleanup(x)
182
+ replace_title(x, "//bibliography//references[@normative = 'true']",
183
+ @i18n&.normref, true)
184
+ replace_title(x, "//bibliography//references[@normative = 'false']",
185
+ @i18n&.bibliography, true)
186
+ end
187
+
188
+ def section_names_terms_cleanup(x)
189
+ replace_title(x, "//definitions[@type = 'symbols']", @i18n&.symbols)
190
+ replace_title(x, "//definitions[@type = 'abbreviated_terms']", @i18n&.abbrev)
191
+ replace_title(x, "//definitions[not(@type)]", @i18n&.symbolsabbrev)
192
+ replace_title(x, "//sections//terms#{SYMnoABBR} | //sections//clause[.//terms]#{SYMnoABBR}",
193
+ @i18n&.termsdefsymbols, true)
194
+ replace_title(x, "//sections//terms#{ABBRnoSYM} | //sections//clause[.//terms]#{ABBRnoSYM}",
195
+ @i18n&.termsdefabbrev, true)
196
+ replace_title(x, "//sections//terms#{SYMABBR} | //sections//clause[.//terms]#{SYMABBR}",
197
+ @i18n&.termsdefsymbolsabbrev, true)
198
+ replace_title(x, "//sections//terms#{NO_SYMABBR} | //sections//clause[.//terms]#{NO_SYMABBR}",
199
+ @i18n&.termsdefsymbolsabbrev, true)
200
+ replace_title(
201
+ x, "//sections//terms[not(.//definitions)] | //sections//clause[.//terms][not(.//definitions)]",
202
+ @i18n&.termsdef, true)
203
+ end
174
204
  end
175
205
  end
176
206
  end
@@ -97,21 +97,15 @@ module Asciidoctor
97
97
  super
98
98
  end
99
99
 
100
- def document(node)
101
- init(node)
102
- ret1 = makexml(node)
103
- ret = ret1.to_xml(indent: 2)
104
- unless node.attr("nodoc") || !node.attr("docfile")
105
- filename = node.attr("docfile").gsub(/\.adoc/, ".xml").
106
- gsub(%r{^.*/}, "")
107
- File.open(filename, "w:UTF-8") { |f| f.write(ret) }
108
- html_converter(node).convert filename unless node.attr("nodoc")
109
- word_converter(node).convert filename unless node.attr("nodoc")
110
- pdf_converter(node)&.convert filename unless node.attr("nodoc")
111
- end
112
- @log.write(@localdir + @filename + ".err") unless @novalid
113
- @files_to_delete.each { |f| FileUtils.rm f }
114
- ret
100
+ def outputs(node, ret)
101
+ File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
102
+ presentation_xml_converter(node).convert(@filename + ".xml")
103
+ html_converter(node).convert(@filename + ".presentation.xml",
104
+ nil, false, "#{@filename}.html")
105
+ doc_converter(node).convert(@filename + ".presentation.xml",
106
+ nil, false, "#{@filename}.doc")
107
+ pdf_converter(node)&.convert(@filename + ".presentation.xml",
108
+ nil, false, "#{@filename}.pdf")
115
109
  end
116
110
 
117
111
  def clause_parse(attrs, xml, node)
@@ -168,10 +162,10 @@ module Asciidoctor
168
162
  def bibliography_annex_parse(attrs, xml, node)
169
163
  attrs1 = attrs.merge(id: "_" + UUIDTools::UUID.random_create)
170
164
  xml.annex **attr_code(attrs1) do |xml_section|
171
- xml_section.title { |t| t << "Bibliography" }
165
+ xml_section.title { |t| t << node.title }
172
166
  @biblio = true
173
- xml.references **attr_code(attrs) do |xml_section|
174
- xml_section << node.content
167
+ xml.references **attr_code(attrs.merge(normative: true)) do |r|
168
+ r << node.content
175
169
  end
176
170
  end
177
171
  @biblio = false
@@ -203,11 +197,15 @@ module Asciidoctor
203
197
  super
204
198
  end
205
199
 
200
+ def presentation_xml_converter(node)
201
+ IsoDoc::NIST::PresentationXMLConvert.new(html_extract_attributes(node))
202
+ end
203
+
206
204
  def html_converter(node)
207
205
  IsoDoc::NIST::HtmlConvert.new(html_extract_attributes(node))
208
206
  end
209
207
 
210
- def word_converter(node)
208
+ def doc_converter(node)
211
209
  IsoDoc::NIST::WordConvert.new(doc_extract_attributes(node))
212
210
  end
213
211
 
@@ -27,31 +27,35 @@ module Asciidoctor
27
27
  end
28
28
  end
29
29
 
30
+ def asciidoc_sub(text)
31
+ Asciidoctor::Standoc::Utils::asciidoc_sub(text)
32
+ end
33
+
30
34
  def title_subtitle(node, t, at)
31
35
  return unless node.attr("title-sub")
32
36
  t.title(**attr_code(at.merge(type: "subtitle"))) do |t1|
33
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-sub"))
37
+ t1 << asciidoc_sub(node.attr("title-sub"))
34
38
  end
35
39
  node.attr("title-sub-short") and
36
40
  t.title(**attr_code(at.merge(type: "short-subtitle"))) do |t1|
37
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-sub-short"))
41
+ t1 << asciidoc_sub(node.attr("title-sub-short"))
38
42
  end
39
43
  end
40
44
 
41
45
  def title_document_class(node, t, at)
42
46
  return unless node.attr("title-document-class")
43
47
  t.title(**attr_code(at.merge(type: "document-class"))) do |t1|
44
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-document-class"))
48
+ t1 << asciidoc_sub(node.attr("title-document-class"))
45
49
  end
46
50
  end
47
51
 
48
52
  def title_main(node, t, at)
49
53
  t.title(**attr_code(at.merge(type: "main"))) do |t1|
50
- t1 << (Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-main")) || node.title)
54
+ t1 << (asciidoc_sub(node.attr("title-main")) || node.title)
51
55
  end
52
56
  node.attr("title-main-short") and
53
57
  t.title(**attr_code(at.merge(type: "short-title"))) do |t1|
54
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-main-short"))
58
+ t1 << asciidoc_sub(node.attr("title-main-short"))
55
59
  end
56
60
  end
57
61
 
@@ -72,7 +76,8 @@ module Asciidoctor
72
76
  xml.contributor do |c|
73
77
  c.role **{ type: "publisher" }
74
78
  c.organization do |a|
75
- a.name "NIST"
79
+ a.name "National Institute of Standards and Technology"
80
+ a.abbreviation "NIST"
76
81
  d = node.attr("nist-division") and a.subdivision d
77
82
  end
78
83
  end
@@ -86,9 +91,10 @@ module Asciidoctor
86
91
  node.attr("technical-committee") and
87
92
  a.committee(node.attr("technical-committee"))
88
93
  node.attr("subcommittee") and
89
- a.subcommittee(node.attr("subcommittee"),
90
- **attr_code(type: node.attr("subcommittee-type"),
91
- number: node.attr("subcommittee-number")))
94
+ a.subcommittee(
95
+ node.attr("subcommittee"),
96
+ **attr_code(type: node.attr("subcommittee-type"),
97
+ number: node.attr("subcommittee-number")))
92
98
  (node.attr("workgroup") || node.attr("workinggroup")) and
93
99
  a.workgroup(node.attr("workgroup") || node.attr("workinggroup"),
94
100
  **attr_code(type: node.attr("workgroup-type"),
@@ -112,7 +118,8 @@ module Asciidoctor
112
118
  c.from from
113
119
  c.owner do |owner|
114
120
  owner.organization do |o|
115
- o.name "NIST"
121
+ o.name "National Institute of Standards and Technology"
122
+ o.abbreviation "NIST"
116
123
  end
117
124
  end
118
125
  end
@@ -149,14 +156,13 @@ module Asciidoctor
149
156
  end
150
157
 
151
158
  def relaton_relation_descriptions
152
- super.merge({
153
- "supersedes" => "obsoletes",
154
- "superseded-by" => "obsoleted-by",
155
- })
159
+ super.merge({ "supersedes" => "obsoletes",
160
+ "superseded-by" => "obsoleted-by", })
156
161
  end
157
162
 
158
163
  def metadata_getrelation(node, xml, type, desc = nil)
159
- if type == "obsoleted-by" and desc.nil? and node.attr("superseding-status")
164
+ if type == "obsoleted-by" and desc.nil? and
165
+ node.attr("superseding-status")
160
166
  metadata_superseding_doc(node, xml)
161
167
  end
162
168
  super
@@ -166,10 +172,8 @@ module Asciidoctor
166
172
  xml.relation **{ type: "obsoletedBy" } do |r|
167
173
  r.bibitem **{ type: "standard" } do |b|
168
174
  metadata_superseding_titles(b, node)
169
- doi = node.attr("superseding-doi") and
170
- b.uri doi, **{ type: "doi" }
171
- url = node.attr("superseding-url") and
172
- b.uri url, **{ type: "uri" }
175
+ doi = node.attr("superseding-doi") and b.uri doi, **{ type: "doi" }
176
+ url = node.attr("superseding-url") and b.uri url, **{ type: "uri" }
173
177
  metadata_superseding_ids(b, xml)
174
178
  metadata_superseding_authors(b, node)
175
179
  metadata_superseding_dates(b, node)
@@ -205,19 +209,19 @@ module Asciidoctor
205
209
  def metadata_superseding_titles(b, node)
206
210
  if node.attr("superseding-title")
207
211
  b.title **{ type: "main" } do |t|
208
- t << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("superseding-title"))
212
+ t << asciidoc_sub(node.attr("superseding-title"))
209
213
  end
210
214
  node.attr("superseding-subtitle") and
211
215
  b.title **{ type: "subtitle" } do |t|
212
- t << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("superseding-subtitle"))
216
+ t << asciidoc_sub(node.attr("superseding-subtitle"))
213
217
  end
214
218
  else
215
219
  b.title **{ type: "main" } do |t|
216
- t << (Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-main")) || node.title)
220
+ t << (asciidoc_sub(node.attr("title-main")) || node.title)
217
221
  end
218
222
  node.attr("title-sub") and
219
223
  b.title **{ type: "subtitle" } do |t|
220
- t << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-sub"))
224
+ t << asciidoc_sub(node.attr("title-sub"))
221
225
  end
222
226
  end
223
227
  end
@@ -64,7 +64,7 @@ module Asciidoctor
64
64
  end
65
65
 
66
66
  def status_abbr(stage, iter)
67
- IsoDoc::NIST::Metadata.new(nil, nil, {}).status_abbr(stage, iter)
67
+ IsoDoc::NIST::Metadata.new(nil, nil, @i18n).status_abbr(stage, iter)
68
68
  end
69
69
 
70
70
  def add_id_parts(args, long)
@@ -922,6 +922,9 @@
922
922
  <optional>
923
923
  <attribute name="script"/>
924
924
  </optional>
925
+ <optional>
926
+ <attribute name="type"/>
927
+ </optional>
925
928
  <optional>
926
929
  <attribute name="obligation">
927
930
  <choice>
@@ -961,9 +964,6 @@
961
964
  </define>
962
965
  <define name="content-subsection">
963
966
  <element name="clause">
964
- <optional>
965
- <attribute name="type"/>
966
- </optional>
967
967
  <ref name="Content-Section"/>
968
968
  </element>
969
969
  </define>
@@ -992,6 +992,9 @@
992
992
  </choice>
993
993
  </attribute>
994
994
  </optional>
995
+ <optional>
996
+ <attribute name="type"/>
997
+ </optional>
995
998
  <optional>
996
999
  <ref name="section-title"/>
997
1000
  </optional>
@@ -1011,9 +1014,6 @@
1011
1014
  </define>
1012
1015
  <define name="clause">
1013
1016
  <element name="clause">
1014
- <optional>
1015
- <attribute name="type"/>
1016
- </optional>
1017
1017
  <ref name="Clause-Section"/>
1018
1018
  </element>
1019
1019
  </define>
@@ -1042,6 +1042,9 @@
1042
1042
  </choice>
1043
1043
  </attribute>
1044
1044
  </optional>
1045
+ <optional>
1046
+ <attribute name="type"/>
1047
+ </optional>
1045
1048
  <optional>
1046
1049
  <ref name="section-title"/>
1047
1050
  </optional>
@@ -1180,6 +1183,9 @@
1180
1183
  <optional>
1181
1184
  <attribute name="script"/>
1182
1185
  </optional>
1186
+ <optional>
1187
+ <attribute name="type"/>
1188
+ </optional>
1183
1189
  <optional>
1184
1190
  <attribute name="obligation">
1185
1191
  <choice>
@@ -21,26 +21,30 @@ module Asciidoctor
21
21
  def doctype_validate(xmldoc)
22
22
  doctype = xmldoc&.at("//bibdata/ext/doctype")&.text
23
23
  %w(standard).include? doctype or
24
- @log.add("Document Attributes", nil, "#{doctype} is not a recognised document type")
24
+ @log.add("Document Attributes", nil,
25
+ "#{doctype} is not a recognised document type")
25
26
  end
26
27
 
27
28
  def stage_validate(xmldoc)
28
29
  stage = xmldoc&.at("//bibdata/status/stage")&.text
29
30
  %w(draft-internal draft-wip draft-prelim draft-public draft-approval
30
31
  final final-review).include? stage or
31
- @log.add("Document Attributes", nil, "#{stage} is not a recognised stage")
32
+ @log.add("Document Attributes", nil,
33
+ "#{stage} is not a recognised stage")
32
34
  end
33
35
 
34
36
  def substage_validate(xmldoc)
35
37
  substage = xmldoc&.at("//bibdata/status/substage")&.text or return
36
38
  %w(active retired withdrawn).include? substage or
37
- @log.add("Document Attributes", nil, "#{substage} is not a recognised substage")
39
+ @log.add("Document Attributes", nil,
40
+ "#{substage} is not a recognised substage")
38
41
  end
39
42
 
40
43
  def iteration_validate(xmldoc)
41
44
  iteration = xmldoc&.at("//bibdata/status/iteration")&.text or return
42
45
  %w(final).include? iteration.downcase or /^\d+$/.match(iteration) or
43
- @log.add("Document Attributes", nil, "#{iteration} is not a recognised iteration")
46
+ @log.add("Document Attributes", nil,
47
+ "#{iteration} is not a recognised iteration")
44
48
  end
45
49
 
46
50
  def series_validate(xmldoc)
@@ -48,7 +52,8 @@ module Asciidoctor
48
52
  found = false
49
53
  SERIES.each { |_, v| found = true if v == series }
50
54
  found or
51
- @log.add("Document Attributes", nil, "#{series} is not a recognised series")
55
+ @log.add("Document Attributes", nil,
56
+ "#{series} is not a recognised series")
52
57
  end
53
58
 
54
59
  def validate(doc)
@@ -60,8 +65,9 @@ module Asciidoctor
60
65
  def introduction_validate(doc)
61
66
  intro = doc.at("//sections/clause/title")
62
67
  intro&.text == "Introduction" or
63
- @log.add("Style", intro, "First section of document body should be Introduction, "\
64
- "not #{intro&.text}")
68
+ @log.add("Style", intro,
69
+ "First section of document body should be Introduction, "\
70
+ "not #{intro&.text}")
65
71
  end
66
72
 
67
73
  REF_SECTIONS_TO_VALIDATE = "//references[not(parent::clause)]/title | "\
@@ -80,8 +86,9 @@ module Asciidoctor
80
86
  return if names == ["References"]
81
87
  return if names == ["Bibliography"]
82
88
  return if names == ["References", "Bibliography"]
83
- @log.add("Style", nil, "Reference clauses #{names.join(', ')} do not follow expected "\
84
- "pattern in NIST")
89
+ @log.add("Style", nil,
90
+ "Reference clauses #{names.join(', ')} do not follow "\
91
+ "expected pattern in NIST")
85
92
  end
86
93
  end
87
94
  end