metanorma-nist 1.0.3 → 1.0.4

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: 2fe0b9d18da4d89a09e1c33a6299d1b7f222b00768421ac8a35d6cabae0fa2dd
4
- data.tar.gz: 2dd93732ce0b519a0b6b11c75f52295cfa3f0dde1d21eb2916dc0c6c35d66cda
3
+ metadata.gz: 9be11fbdb11ce260e1671031d3c1d3f463d0cfbc049b32dd36d362eeae5163bd
4
+ data.tar.gz: 346ed9adb971cb651e22b84f335ed6c1a75ec9f3ac4793300972375afe86d634
5
5
  SHA512:
6
- metadata.gz: d5e2dd3571dc44341fa1d4858221e0b1bb8d2107fd0f77a9bd30f28e73784a5a16b6387259d0302fff066798f034bbde36cebc336f4fafcb8918d737f809d97c
7
- data.tar.gz: de51bd7ceed4f8869c0d9bcdb3c5ad8b860090ffb1ed450ab0e3dc996df6f9ffa655b644ef90b1c2d5c1ecf13bb5a4fe4eb898ec29b64208d4c1e89ab51862c3
6
+ metadata.gz: 5a4b107d57c4a7ba95ad1f57c7fa25626819836cd312ed2693fc1da97b67e636613549ff4631ffc76ae7e5f8c51b8578eaa764f7ba38fba496261606d397c6fa
7
+ data.tar.gz: 3a022940e4cbad44ac9f1f400697f03815a87c131a1c7d9d651c2ef6ece75ba768dc9dc8e2fc2c1ea008918c99904a2972678bcab4f799b5c108aebeab0f2aa2
@@ -1,12 +1,11 @@
1
- # Auto-generated !!! Do not edit it manually
2
- # use ci-master https://github.com/metanorma/metanorma-build-scripts
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
3
  name: macos
4
4
 
5
5
  on:
6
6
  push:
7
7
  branches: [ master ]
8
8
  pull_request:
9
- branches: [ '**' ]
10
9
 
11
10
  jobs:
12
11
  test-macos:
@@ -1,12 +1,11 @@
1
- # Auto-generated !!! Do not edit it manually
2
- # use ci-master https://github.com/metanorma/metanorma-build-scripts
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
3
  name: ubuntu
4
4
 
5
5
  on:
6
6
  push:
7
7
  branches: [ master ]
8
8
  pull_request:
9
- branches: [ '**' ]
10
9
 
11
10
  jobs:
12
11
  test-linux:
@@ -25,7 +24,7 @@ jobs:
25
24
  architecture: 'x64'
26
25
  - name: Update gems
27
26
  run: |
28
- gem install bundler
27
+ gem install bundler
29
28
  bundle install --jobs 4 --retry 3
30
29
  - name: Use Node
31
30
  uses: actions/setup-node@v1
@@ -37,3 +36,15 @@ jobs:
37
36
  - name: Run specs
38
37
  run: |
39
38
  bundle exec rake
39
+ - name: Trigger dependent repositories
40
+ if: github.ref == 'refs/heads/master'
41
+ env:
42
+ GH_USERNAME: ${{ secrets.PAT_USERNAME }}
43
+ GH_ACCESS_TOKEN: ${{ secrets.PAT_TOKEN }}
44
+ run: |
45
+ curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
46
+ [[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
47
+ for repo in $DEPENDENT_REPOS
48
+ do
49
+ sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY
50
+ done
@@ -1,12 +1,11 @@
1
- # Auto-generated !!! Do not edit it manually
2
- # use ci-master https://github.com/metanorma/metanorma-build-scripts
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
3
  name: windows
4
4
 
5
5
  on:
6
6
  push:
7
7
  branches: [ master ]
8
8
  pull_request:
9
- branches: [ '**' ]
10
9
 
11
10
  jobs:
12
11
  test-windows:
@@ -26,7 +25,7 @@ jobs:
26
25
  - name: Update gems
27
26
  shell: pwsh
28
27
  run: |
29
- gem install bundler
28
+ gem install bundler
30
29
  bundle config --local path vendor/bundle
31
30
  bundle update
32
31
  bundle install --jobs 4 --retry 3
data/README.adoc CHANGED
@@ -1,8 +1,9 @@
1
1
  = metanorma-nist: Metanorma processor for the NIST SP 800 document classes
2
2
 
3
3
  image:https://img.shields.io/gem/v/metanorma-nist.svg["Gem Version", link="https://rubygems.org/gems/metanorma-nist"]
4
- image:https://travis-ci.com/metanorma/metanorma-nist.svg["Build Status", link="https://travis-ci.com/metanorma/metanorma-nist"]
5
- image:https://ci.appveyor.com/api/projects/status/vflfr333319tofbi?svg=true["Appveyor Build Status", link="https://ci.appveyor.com/project/metanorma/metanorma-nist"]
4
+ image:https://github.com/metanorma/metanorma-nist/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/metanorma/metanorma-nist/actions?workflow=macos"]
5
+ image:https://github.com/metanorma/metanorma-nist/workflows/ubuntu/badge.svg["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-nist/actions?workflow=ubuntu"]
6
+ image:https://github.com/metanorma/metanorma-nist/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/metanorma/metanorma-nist/actions?workflow=windows"]
6
7
  image:https://codeclimate.com/github/metanorma/metanorma-nist/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-nist"]
7
8
  image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-nist.svg["Pull Requests", link="https://github.com/metanorma/metanorma-nist/pulls"]
8
9
  image:https://img.shields.io/github/commits-since/metanorma/metanorma-nist/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-nist/releases"]
@@ -640,6 +641,27 @@ Glossaries are given as definition lists with role attribute `[.glossary]`:
640
641
  stem:[A= {x_1, x_2, ..., x_k}]:: The alphabet, i.e., the set of all possible symbols that a (digitized) noise source produces.
641
642
  ----
642
643
 
644
+ === References
645
+
646
+ Bibliographies in NIST are contained within annexes:
647
+
648
+ [source,asciidoctor]
649
+ ----
650
+ [appendix]
651
+ == References
652
+
653
+ LAWS, POLICIES, DIRECTIVES, REGULATIONS, MEMORANDA, STANDARDS, AND GUIDELINES
654
+
655
+ [bibliography]
656
+ === Legislation and Executive Orders
657
+ * [[[ref1,1]]] E-Government Act [includes FISMA] (P.L. 107-347), December 2002.
658
+ ----
659
+
660
+ Provided there is only one bibliography in the document, it is automatically titled _References_.
661
+
662
+ If an annex contains a single bibliography, then the annex and the bibliography are treated as equivalent:
663
+ the bibliography does not have a distinct title.
664
+
643
665
  === Document status
644
666
 
645
667
  The following table illustrates how transitions between stages of NIST documents are indicated
@@ -755,10 +777,4 @@ line breaks:
755
777
 
756
778
  == Examples
757
779
 
758
- ////
759
- * link:spec/examples/rfc6350.adoc[] is an Metanorma AsciiDoc version of https://tools.ietf.org/html/rfc6350[RFC 6350].
760
- * link:spec/examples/rfc6350.html[] is an HTML file generated from the Asciidoctor.
761
- * link:spec/examples/rfc6350.doc[] is a Word document generated from the Asciidoctor.
762
-
763
- ////
764
-
780
+ See https://gitlab.com/metanorma/mn-samples-nist (private repository)
@@ -703,21 +703,11 @@
703
703
  </define>
704
704
  <define name="TypedTitleString">
705
705
  <optional>
706
- <attribute name="type">
707
- <ref name="TitleType"/>
708
- </attribute>
706
+ <attribute name="type"/>
709
707
  </optional>
710
708
  <ref name="FormattedString"/>
711
709
  </define>
712
- <define name="TitleType">
713
- <choice>
714
- <value>alternative</value>
715
- <value>original</value>
716
- <value>unofficial</value>
717
- <value>subtitle</value>
718
- <value>main</value>
719
- </choice>
720
- </define>
710
+ <!-- TitleType = ( "alternative" | "original" | "unofficial" | "subtitle" | "main" ) -->
721
711
  <define name="TypedUri">
722
712
  <optional>
723
713
  <attribute name="type"/>
@@ -109,7 +109,7 @@ module Asciidoctor
109
109
  word_converter(node).convert filename unless node.attr("nodoc")
110
110
  pdf_converter(node).convert filename unless node.attr("nodoc")
111
111
  end
112
- @log.write(@filename + ".err") unless @novalid
112
+ @log.write(@localdir + @filename + ".err") unless @novalid
113
113
  @files_to_delete.each { |f| FileUtils.rm f }
114
114
  ret
115
115
  end
@@ -101,9 +101,7 @@
101
101
  <ref name="structuredidentifier"/>
102
102
  </zeroOrMore>
103
103
  </define>
104
- <define name="TitleType">
105
- <text/>
106
- </define>
104
+ <!-- TitleType = text -->
107
105
  <define name="sections">
108
106
  <element name="sections">
109
107
  <oneOrMore>
@@ -12,15 +12,7 @@
12
12
  <define name="DocumentType">
13
13
  <value>standard</value>
14
14
  </define>
15
- <define name="TitleType">
16
- <choice>
17
- <value>alternative</value>
18
- <value>original</value>
19
- <value>unofficial</value>
20
- <value>subtitle</value>
21
- <value>main</value>
22
- </choice>
23
- </define>
15
+ <!-- TitleType = ( "alternative" | "original" | "unofficial" | "subtitle" | "main" ) -->
24
16
  <define name="preface">
25
17
  <element name="preface">
26
18
  <optional>
@@ -208,7 +208,7 @@ module IsoDoc
208
208
  def bibliography_parse(node, out)
209
209
  title = node&.at(ns("./title"))&.text || ""
210
210
  out.div do |div|
211
- unless node.parent.name == "annex"
211
+ unless suppress_biblio_title(node)
212
212
  anchor(node['id'], :label, false) and
213
213
  clause_parse_title(node, div, node.at(ns("./title")), out) or
214
214
  div.h2 title, **{ class: "Section3" }
@@ -217,6 +217,16 @@ module IsoDoc
217
217
  end
218
218
  end
219
219
 
220
+ def suppress_biblio_title(node)
221
+ return false unless node.parent.name == "annex"
222
+ return false if node.parent.xpath("./references | ./clause | "\
223
+ "./terms | ./definitions").size > 1
224
+ title1 = node&.at(ns("./title"))&.text
225
+ return true unless title1
226
+ title2 = node&.parent&.at(ns("./title"))&.text
227
+ title1&.casecmp(title2) == 0
228
+ end
229
+
220
230
  def foreword(isoxml, out)
221
231
  f = isoxml.at(ns("//foreword")) || return
222
232
  out.div **attr_code(id: f["id"]) do |s|
@@ -37,10 +37,10 @@ module IsoDoc
37
37
  def author(ixml, _out)
38
38
  tc = ixml.at(ns("//bibdata/ext/editorialgroup/committee"))
39
39
  set(:tc, tc.text.upcase) if tc
40
- personal_authors(ixml)
41
40
  subdiv = ixml.at(ns("//bibdata/contributor[role/@type = 'publisher']/"\
42
41
  "organization/subdivision")) and
43
42
  set(:nist_subdiv, subdiv.text)
43
+ super
44
44
  end
45
45
 
46
46
  def version(ixml, _out)
@@ -86,7 +86,8 @@ module IsoDoc
86
86
  end
87
87
 
88
88
  def withdrawal_pending(ixml)
89
- d = ixml&.at(ns("//bibdata/date[@type = 'obsoleted']"))&.text or return
89
+ d = ixml&.at(ns("//bibdata/date[@type = 'obsoleted']"))&.text&.strip or return
90
+ d += "-01" if /^\d\d\d\d-\d\d$/.match(d)
90
91
  date = Date.parse(d) or return
91
92
  set(:withdrawal_pending, true) if date > Date.today
92
93
  end
@@ -109,18 +110,15 @@ module IsoDoc
109
110
  "title"))&.text and set(:subseries, subs)
110
111
  end
111
112
 
112
- def monthyr(isodate)
113
- return nil if isodate.nil?
114
- DateTime.parse(isodate).localize(:en).to_additional_s("yMMMM")
115
- end
116
-
117
113
  def mmddyyyy(isodate)
118
114
  return nil if isodate.nil?
115
+ isodate += "-01" if /^\d\d\d\d-\d\d$/.match(isodate)
119
116
  Date.parse(isodate).strftime("%m-%d-%Y")
120
117
  end
121
118
 
122
119
  def MMMddyyyy(isodate)
123
120
  return nil if isodate.nil?
121
+ isodate += "-01" if /^\d\d\d\d-\d\d$/.match(isodate)
124
122
  Date.parse(isodate).strftime("%B %d, %Y")
125
123
  end
126
124
 
@@ -93,7 +93,7 @@ module Iso690Render
93
93
  def self.standardidentifier(doc)
94
94
  ret = []
95
95
  doc.xpath("./docidentifier").each do |id|
96
- next if %w(nist-mr nist-long).include? id["type"]
96
+ next if %w(nist-mr nist-long metanorma rfc-anchor).include? id["type"]
97
97
  ret << standardidentifier1(id)
98
98
  end
99
99
  ret.join(". ")
@@ -207,7 +207,6 @@ module Iso690Render
207
207
  else
208
208
  ret += embedded ? wrap(creatornames(doc), "", "") : wrap(creatornames(doc), "", "")
209
209
  end
210
-
211
210
  if dr
212
211
  mdy = MMMddyyyy(date(doc)) and ret += wrap(mdy, " (", ")")
213
212
  else
@@ -54,6 +54,7 @@ module Iso690Render
54
54
 
55
55
  def self.MMMddyyyy(isodate)
56
56
  return nil if isodate.nil?
57
+ return isodate if isodate == "--"
57
58
  arr = isodate.split("-")
58
59
  date = if arr.size == 1 and (/^\d+$/.match isodate)
59
60
  Date.new(*arr.map(&:to_i)).strftime("%Y")
@@ -77,7 +77,8 @@ module IsoDoc
77
77
  annex_names1(c, "#{num}.#{i + 1}", 2)
78
78
  end
79
79
  clause.xpath(ns("./terms | ./term | ./references")).each_with_index do |c, i|
80
- annex_names1(c, "#{num}", 1)
80
+ suppress_biblio_title(c) ?
81
+ annex_names1(c, "#{num}", 1) : annex_names1(c, "#{num}.#{i + 1}", 2)
81
82
  end
82
83
  hierarchical_asset_names(clause, num)
83
84
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module NIST
3
- VERSION = "1.0.3"
3
+ VERSION = "1.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-nist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-20 00:00:00.000000000 Z
11
+ date: 2020-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities