metanorma-nist 1.1.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) 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 +7 -4
  9. data/lib/asciidoctor/nist/front.rb +37 -42
  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 +5 -66
  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 -5
  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 +2200 -2318
  32. data/lib/isodoc/nist/nist.sp.xsl +2981 -2886
  33. data/lib/isodoc/nist/pdf_convert.rb +0 -1
  34. data/lib/isodoc/nist/presentation_xml_convert.rb +71 -1
  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 -15
  40. data/lib/isodoc/nist/word_convert_toc.rb +2 -2
  41. data/lib/isodoc/nist/xref.rb +1 -24
  42. data/lib/metanorma/nist/processor.rb +0 -4
  43. data/lib/metanorma/nist/version.rb +1 -1
  44. data/metanorma-nist.gemspec +3 -2
  45. metadata +28 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '05109623d4ab89934b15717692765c6c29015007695efad9ea8258b81d1e956c'
4
- data.tar.gz: f848bb3f40e50382a2bfeca5f2bd89a78d06d7808bbb3aa4e01d3ce88a8cb87e
3
+ metadata.gz: 1495072b5486784814d43bda0e9352fbc4945952571260b0226025aa69025ccd
4
+ data.tar.gz: e90d93ae0853e166cd1b36f954e8ab13b56b3ec87d3a78e347eefa063e05267f
5
5
  SHA512:
6
- metadata.gz: 5b3e0c43ab7a515b8dcba5a6c988254d361934a87091dca35a9134b3d51833c463126695bc2ebee8a3c1430b309210fd08adc8efec6e1ddce727dd2a9c96ad28
7
- data.tar.gz: edc0d9b4b5aa9b8fe2c98a7369cfec29a44a93a3b4808dfb95b8eb618aa6ff7ada7e0110190bb84cf35355fbcb4497c84827ddbd0eb540aeba2a3389525fd20d
6
+ metadata.gz: 99c3f28c3399dff97c470d7f88207abd2631c023177068b1b6e5076d31500ded0e748a51c0d29bc5bbb73eec2771676b7860af368994125a00737e7474aba744
7
+ data.tar.gz: 99d118cfd090a5a479f3e496874207ddd6530ac93b83f015fcfa1411b6723373ccc6dd6cb80a633e279a237f655f20af957f9c8250031447f6be72f9972baeb7
@@ -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
@@ -100,9 +100,12 @@ module Asciidoctor
100
100
  def outputs(node, ret)
101
101
  File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
102
102
  presentation_xml_converter(node).convert(@filename + ".xml")
103
- html_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.html")
104
- doc_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.doc")
105
- pdf_converter(node)&.convert(@filename + ".presentation.xml", nil, false, "#{@filename}.pdf")
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")
106
109
  end
107
110
 
108
111
  def clause_parse(attrs, xml, node)
@@ -159,7 +162,7 @@ module Asciidoctor
159
162
  def bibliography_annex_parse(attrs, xml, node)
160
163
  attrs1 = attrs.merge(id: "_" + UUIDTools::UUID.random_create)
161
164
  xml.annex **attr_code(attrs1) do |xml_section|
162
- xml_section.title { |t| t << "Bibliography" }
165
+ xml_section.title { |t| t << node.title }
163
166
  @biblio = true
164
167
  xml.references **attr_code(attrs.merge(normative: true)) do |r|
165
168
  r << node.content
@@ -5,9 +5,6 @@ require_relative "./front_id.rb"
5
5
 
6
6
  module Asciidoctor
7
7
  module NIST
8
- # A {Converter} implementation that generates RSD output, and a document
9
- # schema encapsulation of the document for validation
10
-
11
8
  class Converter < Standoc::Converter
12
9
  def doctype(node)
13
10
  node.attr("doctype") || "sp-800"
@@ -27,31 +24,35 @@ module Asciidoctor
27
24
  end
28
25
  end
29
26
 
27
+ def asciidoc_sub(text)
28
+ Asciidoctor::Standoc::Utils::asciidoc_sub(text)
29
+ end
30
+
30
31
  def title_subtitle(node, t, at)
31
32
  return unless node.attr("title-sub")
32
33
  t.title(**attr_code(at.merge(type: "subtitle"))) do |t1|
33
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-sub"))
34
+ t1 << asciidoc_sub(node.attr("title-sub"))
34
35
  end
35
36
  node.attr("title-sub-short") and
36
37
  t.title(**attr_code(at.merge(type: "short-subtitle"))) do |t1|
37
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-sub-short"))
38
+ t1 << asciidoc_sub(node.attr("title-sub-short"))
38
39
  end
39
40
  end
40
41
 
41
42
  def title_document_class(node, t, at)
42
43
  return unless node.attr("title-document-class")
43
44
  t.title(**attr_code(at.merge(type: "document-class"))) do |t1|
44
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-document-class"))
45
+ t1 << asciidoc_sub(node.attr("title-document-class"))
45
46
  end
46
47
  end
47
48
 
48
49
  def title_main(node, t, at)
49
50
  t.title(**attr_code(at.merge(type: "main"))) do |t1|
50
- t1 << (Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-main")) || node.title)
51
+ t1 << (asciidoc_sub(node.attr("title-main")) || node.title)
51
52
  end
52
53
  node.attr("title-main-short") and
53
54
  t.title(**attr_code(at.merge(type: "short-title"))) do |t1|
54
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-main-short"))
55
+ t1 << asciidoc_sub(node.attr("title-main-short"))
55
56
  end
56
57
  end
57
58
 
@@ -68,12 +69,21 @@ module Asciidoctor
68
69
  personal_author(node, xml)
69
70
  end
70
71
 
72
+ def default_publisher
73
+ "National Institute of Standards and Technology"
74
+ end
75
+
71
76
  def metadata_publisher(node, xml)
72
- xml.contributor do |c|
73
- c.role **{ type: "publisher" }
74
- c.organization do |a|
75
- a.name "NIST"
76
- d = node.attr("nist-division") and a.subdivision d
77
+ publishers = node.attr("publisher") || default_publisher
78
+ csv_split(publishers)&.each do |p|
79
+ xml.contributor do |c|
80
+ c.role **{ type: "publisher" }
81
+ c.organization do |a|
82
+ a.name p
83
+ if p == default_publisher
84
+ d = node.attr("nist-division") and a.subdivision d
85
+ end
86
+ end
77
87
  end
78
88
  end
79
89
  end
@@ -86,9 +96,10 @@ module Asciidoctor
86
96
  node.attr("technical-committee") and
87
97
  a.committee(node.attr("technical-committee"))
88
98
  node.attr("subcommittee") and
89
- a.subcommittee(node.attr("subcommittee"),
90
- **attr_code(type: node.attr("subcommittee-type"),
91
- number: node.attr("subcommittee-number")))
99
+ a.subcommittee(
100
+ node.attr("subcommittee"),
101
+ **attr_code(type: node.attr("subcommittee-type"),
102
+ number: node.attr("subcommittee-number")))
92
103
  (node.attr("workgroup") || node.attr("workinggroup")) and
93
104
  a.workgroup(node.attr("workgroup") || node.attr("workinggroup"),
94
105
  **attr_code(type: node.attr("workgroup-type"),
@@ -105,19 +116,6 @@ module Asciidoctor
105
116
  end
106
117
  end
107
118
 
108
- def metadata_copyright(node, xml)
109
- from = node.attr("copyright-year") || node.attr("copyrightyear") ||
110
- Date.today.year
111
- xml.copyright do |c|
112
- c.from from
113
- c.owner do |owner|
114
- owner.organization do |o|
115
- o.name "NIST"
116
- end
117
- end
118
- end
119
- end
120
-
121
119
  def metadata_source(node, xml)
122
120
  super
123
121
  node.attr("doc-email") && xml.uri(node.attr("doc-email"), type: "email")
@@ -149,14 +147,13 @@ module Asciidoctor
149
147
  end
150
148
 
151
149
  def relaton_relation_descriptions
152
- super.merge({
153
- "supersedes" => "obsoletes",
154
- "superseded-by" => "obsoleted-by",
155
- })
150
+ super.merge({ "supersedes" => "obsoletes",
151
+ "superseded-by" => "obsoleted-by", })
156
152
  end
157
153
 
158
154
  def metadata_getrelation(node, xml, type, desc = nil)
159
- if type == "obsoleted-by" and desc.nil? and node.attr("superseding-status")
155
+ if type == "obsoleted-by" and desc.nil? and
156
+ node.attr("superseding-status")
160
157
  metadata_superseding_doc(node, xml)
161
158
  end
162
159
  super
@@ -166,10 +163,8 @@ module Asciidoctor
166
163
  xml.relation **{ type: "obsoletedBy" } do |r|
167
164
  r.bibitem **{ type: "standard" } do |b|
168
165
  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" }
166
+ doi = node.attr("superseding-doi") and b.uri doi, **{ type: "doi" }
167
+ url = node.attr("superseding-url") and b.uri url, **{ type: "uri" }
173
168
  metadata_superseding_ids(b, xml)
174
169
  metadata_superseding_authors(b, node)
175
170
  metadata_superseding_dates(b, node)
@@ -205,19 +200,19 @@ module Asciidoctor
205
200
  def metadata_superseding_titles(b, node)
206
201
  if node.attr("superseding-title")
207
202
  b.title **{ type: "main" } do |t|
208
- t << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("superseding-title"))
203
+ t << asciidoc_sub(node.attr("superseding-title"))
209
204
  end
210
205
  node.attr("superseding-subtitle") and
211
206
  b.title **{ type: "subtitle" } do |t|
212
- t << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("superseding-subtitle"))
207
+ t << asciidoc_sub(node.attr("superseding-subtitle"))
213
208
  end
214
209
  else
215
210
  b.title **{ type: "main" } do |t|
216
- t << (Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-main")) || node.title)
211
+ t << (asciidoc_sub(node.attr("title-main")) || node.title)
217
212
  end
218
213
  node.attr("title-sub") and
219
214
  b.title **{ type: "subtitle" } do |t|
220
- t << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-sub"))
215
+ t << asciidoc_sub(node.attr("title-sub"))
221
216
  end
222
217
  end
223
218
  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