metanorma-nist 1.3.1 → 1.3.2

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: 77b41b5dd747530f461f057cf1372802edb2607e6a7144c390347e4ee57f6d3c
4
- data.tar.gz: 7316d76679f0a51af953f434d3ef51aa8b68e165d4e5ca728f2c49f1b85f843d
3
+ metadata.gz: bd9a240ccb58e745abb276285bf1f48004d72a8f5a15413f39611773926fc9f5
4
+ data.tar.gz: 126d8a1e178ec82888a4ddaa6d10b0a589872424981df7e49409a72882a85241
5
5
  SHA512:
6
- metadata.gz: 8acbc8f62cebeff401b9e22130040857f87b4ab59aca4657ae9309e974dc955780052be44824b281d0ceb4dd39c4b0acf7c9df44a44ec3921eacf1945156e477
7
- data.tar.gz: ddd906a92cb5d6f5e67bae2f19b83da79d510f6d2eaa3b18a15e1fee272aca5799981ae42977bc5599b05cb514d2e09a3421aefbf5cedd7ab3e1cf5de4f145a2
6
+ metadata.gz: c7bd829e6baf2aaea5cfc577c8c0bc41cd8622a322a06bd551ca212467e53d768127fce8b2d12f40eeeaa7ad4d989254ee3bd555bd0e153197c04d2a63e2e0e0
7
+ data.tar.gz: 892c02adf47677f1b1133b818c235ba7d7ccee378490f3e3c6f416d7e39d9cd74b571a490e2b8cf6e77e954ce9fe3479962265bda536664b33a579c57dfb24f1
data/.rubocop.yml CHANGED
@@ -10,5 +10,3 @@ AllCops:
10
10
  DisplayCopNames: false
11
11
  StyleGuideCopsOnly: false
12
12
  TargetRubyVersion: 2.4
13
- Rails:
14
- Enabled: true
@@ -787,6 +787,7 @@
787
787
  <value>adapted</value>
788
788
  <value>vote-started</value>
789
789
  <value>vote-ended</value>
790
+ <value>announced</value>
790
791
  </choice>
791
792
  </define>
792
793
  <define name="bdate">
@@ -876,6 +876,18 @@
876
876
  </zeroOrMore>
877
877
  </element>
878
878
  </define>
879
+ <define name="pagebreak">
880
+ <element name="pagebreak">
881
+ <optional>
882
+ <attribute name="orientation">
883
+ <choice>
884
+ <value>landscape</value>
885
+ <value>portrait</value>
886
+ </choice>
887
+ </attribute>
888
+ </optional>
889
+ </element>
890
+ </define>
879
891
  </include>
880
892
  <!-- end overrides -->
881
893
  <define name="colgroup">
@@ -943,8 +955,170 @@
943
955
  <ref name="permission"/>
944
956
  <ref name="imagemap"/>
945
957
  <ref name="svgmap"/>
958
+ <ref name="inputform"/>
946
959
  </choice>
947
960
  </define>
961
+ <define name="inputform">
962
+ <element name="form">
963
+ <attribute name="id">
964
+ <data type="ID"/>
965
+ </attribute>
966
+ <attribute name="name"/>
967
+ <attribute name="action"/>
968
+ <zeroOrMore>
969
+ <choice>
970
+ <ref name="TextElement"/>
971
+ <ref name="FormInput"/>
972
+ </choice>
973
+ </zeroOrMore>
974
+ </element>
975
+ </define>
976
+ <define name="FormInput">
977
+ <choice>
978
+ <ref name="input"/>
979
+ <ref name="formlabel"/>
980
+ <ref name="select"/>
981
+ <ref name="textarea"/>
982
+ </choice>
983
+ </define>
984
+ <define name="InputType">
985
+ <choice>
986
+ <value>button</value>
987
+ <value>checkbox</value>
988
+ <value>date</value>
989
+ <value>file</value>
990
+ <value>password</value>
991
+ <value>radio</value>
992
+ <value>submit</value>
993
+ <value>text</value>
994
+ </choice>
995
+ </define>
996
+ <define name="input">
997
+ <element name="input">
998
+ <attribute name="type">
999
+ <ref name="InputType"/>
1000
+ </attribute>
1001
+ <optional>
1002
+ <attribute name="checked">
1003
+ <data type="boolean"/>
1004
+ </attribute>
1005
+ </optional>
1006
+ <optional>
1007
+ <attribute name="disabled">
1008
+ <data type="boolean"/>
1009
+ </attribute>
1010
+ </optional>
1011
+ <optional>
1012
+ <attribute name="readonly">
1013
+ <data type="boolean"/>
1014
+ </attribute>
1015
+ </optional>
1016
+ <optional>
1017
+ <attribute name="maxlength">
1018
+ <data type="int"/>
1019
+ </attribute>
1020
+ </optional>
1021
+ <optional>
1022
+ <attribute name="minlength">
1023
+ <data type="int"/>
1024
+ </attribute>
1025
+ </optional>
1026
+ <optional>
1027
+ <attribute name="name"/>
1028
+ </optional>
1029
+ <optional>
1030
+ <attribute name="value"/>
1031
+ </optional>
1032
+ <optional>
1033
+ <attribute name="id">
1034
+ <data type="ID"/>
1035
+ </attribute>
1036
+ </optional>
1037
+ </element>
1038
+ </define>
1039
+ <define name="formlabel">
1040
+ <element name="label">
1041
+ <attribute name="for">
1042
+ <data type="IDREF"/>
1043
+ </attribute>
1044
+ <zeroOrMore>
1045
+ <ref name="PureTextElement"/>
1046
+ </zeroOrMore>
1047
+ </element>
1048
+ </define>
1049
+ <define name="select">
1050
+ <element name="select">
1051
+ <optional>
1052
+ <attribute name="name"/>
1053
+ </optional>
1054
+ <optional>
1055
+ <attribute name="value"/>
1056
+ </optional>
1057
+ <optional>
1058
+ <attribute name="id">
1059
+ <data type="ID"/>
1060
+ </attribute>
1061
+ </optional>
1062
+ <optional>
1063
+ <attribute name="disabled">
1064
+ <data type="boolean"/>
1065
+ </attribute>
1066
+ </optional>
1067
+ <optional>
1068
+ <attribute name="multiple">
1069
+ <data type="boolean"/>
1070
+ </attribute>
1071
+ </optional>
1072
+ <optional>
1073
+ <attribute name="size">
1074
+ <data type="int"/>
1075
+ </attribute>
1076
+ </optional>
1077
+ <oneOrMore>
1078
+ <ref name="option"/>
1079
+ </oneOrMore>
1080
+ </element>
1081
+ </define>
1082
+ <define name="option">
1083
+ <element name="option">
1084
+ <optional>
1085
+ <attribute name="disabled">
1086
+ <data type="boolean"/>
1087
+ </attribute>
1088
+ </optional>
1089
+ <optional>
1090
+ <attribute name="value"/>
1091
+ </optional>
1092
+ <zeroOrMore>
1093
+ <ref name="PureTextElement"/>
1094
+ </zeroOrMore>
1095
+ </element>
1096
+ </define>
1097
+ <define name="textarea">
1098
+ <element name="textarea">
1099
+ <optional>
1100
+ <attribute name="name"/>
1101
+ </optional>
1102
+ <optional>
1103
+ <attribute name="value"/>
1104
+ </optional>
1105
+ <optional>
1106
+ <attribute name="id">
1107
+ <data type="ID"/>
1108
+ </attribute>
1109
+ </optional>
1110
+ <optional>
1111
+ <attribute name="rows">
1112
+ <data type="int"/>
1113
+ </attribute>
1114
+ </optional>
1115
+ <optional>
1116
+ <attribute name="cols">
1117
+ <data type="int"/>
1118
+ </attribute>
1119
+ </optional>
1120
+ </element>
1121
+ </define>
948
1122
  <define name="bibliography">
949
1123
  <element name="bibliography">
950
1124
  <oneOrMore>
@@ -1017,9 +1191,7 @@
1017
1191
  </define>
1018
1192
  <define name="IsoWorkgroup">
1019
1193
  <optional>
1020
- <attribute name="number">
1021
- <data type="int"/>
1022
- </attribute>
1194
+ <attribute name="number"/>
1023
1195
  </optional>
1024
1196
  <optional>
1025
1197
  <attribute name="type"/>
@@ -1,22 +1,23 @@
1
1
  require "isodoc"
2
2
  require "twitter_cldr"
3
- require_relative "./metadata_id.rb"
3
+ require_relative "./metadata_id"
4
4
 
5
5
  module IsoDoc
6
6
  module NIST
7
7
  class Metadata < IsoDoc::Metadata
8
8
  def initialize(lang, script, labels)
9
9
  super
10
- here = File.dirname(__FILE__)
11
- set(:logo_nist, File.expand_path(File.join(here, "html", "logo.png")))
12
- set(:logo_cswp, File.expand_path(File.join(here, "html", "logo_cswp.png")))
10
+ here = File.join(File.dirname(__FILE__), "html")
11
+ set(:logo_nist, File.expand_path(File.join(here, "logo.png")))
12
+ set(:logo_cswp,
13
+ File.expand_path(File.join(here, "logo_cswp.png")))
13
14
  set(:logo_commerce,
14
- File.expand_path(File.join(here, "html", "commerce-logo-color.png")))
15
+ File.expand_path(File.join(here, "commerce-logo-color.png")))
15
16
  set(:logo_commerce_word,
16
- File.expand_path(File.join(here, "html", "deptofcommerce.png")))
17
+ File.expand_path(File.join(here, "deptofcommerce.png")))
17
18
  end
18
19
 
19
- def title(ixml, out)
20
+ def title(ixml, _out)
20
21
  main = ixml&.at(ns("//bibdata/title[@type = 'main']"))&.text
21
22
  set(:doctitle, main)
22
23
  short = ixml&.at(ns("//bibdata/title[@type = 'short-title']"))&.text
@@ -27,7 +28,7 @@ module IsoDoc
27
28
  main = ixml&.at(ns("//bibdata/title[@type = 'subtitle']"))&.text
28
29
  set(:docsubtitle, main) if main
29
30
  short = ixml&.at(ns("//bibdata/title[@type = 'short-subtitle']"))&.text
30
- set(:docsubtitle_short, short || main) if (short || main)
31
+ set(:docsubtitle_short, short || main) if short || main
31
32
  main = ixml&.at(ns("//bibdata/title[@type = 'document-class']"))&.text
32
33
  set(:docclasstitle, main) if main
33
34
  end
@@ -37,7 +38,7 @@ module IsoDoc
37
38
  set(:tc, tc.text.upcase) if tc
38
39
  subdiv = ixml.at(ns("//bibdata/contributor[role/@type = 'publisher']/"\
39
40
  "organization/subdivision")) and
40
- set(:nist_subdiv, subdiv.text)
41
+ set(:nist_subdiv, subdiv.text)
41
42
  super
42
43
  end
43
44
 
@@ -55,6 +56,7 @@ module IsoDoc
55
56
  ixml.xpath(ns("//bibdata/date")).each do |d|
56
57
  val = Common::date_range(d)
57
58
  next if val == "XXX"
59
+
58
60
  set("#{d['type']}date_monthyear".to_sym, daterange_proc(val, :monthyr))
59
61
  set("#{d['type']}date_mmddyyyy".to_sym, daterange_proc(val, :mmddyyyy))
60
62
  set("#{d['type']}date_MMMddyyyy".to_sym, daterange_proc(val, :MMMddyyyy))
@@ -67,6 +69,7 @@ module IsoDoc
67
69
  date = most_recent_date1(ixml) || return
68
70
  val = Common::date_range(date)
69
71
  return if val == "XXX"
72
+
70
73
  set(:most_recent_date_monthyear, daterange_proc(val, :monthyr))
71
74
  set(:most_recent_date_mmddyyyy, daterange_proc(val, :mmddyyyy))
72
75
  set(:most_recent_date_MMMddyyyy, daterange_proc(val, :MMMddyyyy))
@@ -74,24 +77,27 @@ module IsoDoc
74
77
 
75
78
  def most_recent_date1(ixml)
76
79
  docstatus = ixml.at(ns("//bibdata/status/stage"))&.text
77
- /^draft/.match(docstatus) ?
80
+ if /^draft/.match?(docstatus)
78
81
  (ixml.at(ns("//bibdata/date[@type = 'circulated']")) ||
79
- ixml.at(ns("//version/revision-date"))) :
80
- ( ixml.at(ns("//bibdata/date[@type = 'issued']")))
82
+ ixml.at(ns("//version/revision-date")))
83
+ else
84
+ ixml.at(ns("//bibdata/date[@type = 'issued']"))
85
+ end
81
86
  end
82
87
 
83
88
  def withdrawal_pending(ixml)
84
- d = ixml&.at(ns("//bibdata/date[@type = 'obsoleted']"))&.text&.strip or return
85
- d += "-01" if /^\d\d\d\d-\d\d$/.match(d)
89
+ d = ixml&.at(ns("//bibdata/date[@type = 'obsoleted']"))&.text&.strip or
90
+ return
91
+ d += "-01" if /^\d\d\d\d-\d\d$/.match?(d)
86
92
  date = Date.parse(d) or return
87
93
  set(:withdrawal_pending, true) if date > Date.today
88
94
  end
89
95
 
90
- def daterange_proc(val, fn)
91
- m = /^(?<date1>[^&]+)(?<ndash>\&ndash;)?(?<date2>.*)$/.match val
92
- val_monthyear = self.send(fn, m[:date1])
96
+ def daterange_proc(val, format)
97
+ m = /^(?<date1>[^&]+)(?<ndash>&ndash;)?(?<date2>.*)$/.match val
98
+ val_monthyear = send(format, m[:date1])
93
99
  val_monthyear += "&ndash;" if m[:ndash]
94
- val_monthyear += self.send(fn, m[:date2]) unless m[:date2].empty?
100
+ val_monthyear += send(format, m[:date2]) unless m[:date2].empty?
95
101
  val_monthyear
96
102
  end
97
103
 
@@ -101,7 +107,7 @@ module IsoDoc
101
107
  set(:seriesabbr, seriesabbr) if seriesabbr
102
108
  subs = ixml.at(ns("//bibdata/series[@type = 'secondary']/title"))&.text
103
109
  abbr = ixml.at(ns("//bibdata/series[@type = 'secondary']/abbreviation"))&.text
104
- if (seriesabbr == "NIST CSTS")
110
+ if seriesabbr == "NIST CSTS"
105
111
  subs and set(:series, subs)
106
112
  abbr and set(:seriesabbr, abbr)
107
113
  else
@@ -112,7 +118,8 @@ module IsoDoc
112
118
 
113
119
  def mmddyyyy(isodate)
114
120
  return nil if isodate.nil?
115
- isodate += "-01" if /^\d\d\d\d-\d\d$/.match(isodate)
121
+
122
+ isodate += "-01" if /^\d\d\d\d-\d\d$/.match?(isodate)
116
123
  Date.parse(isodate).strftime("%m-%d-%Y")
117
124
  end
118
125
 
@@ -129,13 +136,16 @@ module IsoDoc
129
136
  super
130
137
  a = xml.at(ns("//bibdata/uri[@type = 'email']")) and set(:email, a.text)
131
138
  a = xml.at(ns("//bibdata/uri[@type = 'doi']")) and set(:doi, a.text)
132
- a = xml.at(ns("//bibdata/uri[@type = 'uri' or not(@type)]")) and set(:url, a.text)
139
+ a = xml.at(ns("//bibdata/uri[@type = 'uri' or not(@type)]")) and
140
+ set(:url, a.text)
133
141
  end
134
142
 
135
143
  def relations1(ixml, type)
136
144
  ret = []
137
- ixml.xpath(ns("//bibdata/relation[@type = '#{type}'][not(xmlns:description)] | "\
138
- "//bibdata/relation[description = '#{type}']")).each do |x|
145
+ ixml.xpath(ns("//bibdata/relation[@type = '#{type}']"\
146
+ "[not(xmlns:description)] | "\
147
+ "//bibdata/relation[description = '#{type}']"))
148
+ .each do |x|
139
149
  id = x&.at(ns(".//docidentifier"))&.text and ret << id
140
150
  end
141
151
  ret
@@ -156,6 +166,7 @@ module IsoDoc
156
166
  def superseding_doc(ixml)
157
167
  d = ixml.at(ns("//bibdata/relation[@type = 'obsoletedBy']/bibitem"))
158
168
  return unless d
169
+
159
170
  set(:superseding_status, status_print(d.at(ns("./status/stage"))&.text || "final"))
160
171
  superseding_iteration(d)
161
172
  docid = d.at(ns("./docidentifier[@type = 'NIST']"))&.text and
@@ -163,27 +174,35 @@ module IsoDoc
163
174
  docid_long = d.at(ns("./docidentifier[@type = 'nist-long']"))&.text and
164
175
  set(:superseding_docidentifier_long, docid_long)
165
176
  superseding_dates(d)
166
- doi = d.at(ns("./uri[@type = 'doi']"))&.text and set(:superseding_doi, doi)
167
- uri = d.at(ns("./uri[@type = 'uri']"))&.text and set(:superseding_uri, uri)
177
+ doi = d.at(ns("./uri[@type = 'doi']"))&.text and
178
+ set(:superseding_doi, doi)
179
+ uri = d.at(ns("./uri[@type = 'uri']"))&.text and
180
+ set(:superseding_uri, uri)
168
181
  superseding_titles(ixml, d)
169
182
  authors = d.xpath(ns("./contributor[role/@type = 'author']/person"))
170
- authors.empty? and authors = ixml.xpath(ns("//bibdata/contributor[role/@type = 'author']/person"))
183
+ authors.empty? and
184
+ authors = ixml.xpath(ns("//bibdata/contributor[role/@type = 'author']/person"))
171
185
  set(:superseding_authors, extract_person_names(authors))
172
186
  end
173
187
 
174
- def superseding_titles(ixml, d)
175
- if title = d.at(ns("./title[@type = 'main']"))&.text
176
- set(:superseding_title, d.at(ns("./title[@type = 'main']"))&.text)
177
- set(:superseding_subtitle, d.at(ns("./title[@type = 'subtitle']"))&.text)
188
+ def superseding_titles(ixml, newdoc)
189
+ if newdoc.at(ns("./title[@type = 'main']"))&.text
190
+ set(:superseding_title,
191
+ newdoc.at(ns("./title[@type = 'main']"))&.text)
192
+ set(:superseding_subtitle,
193
+ newdoc.at(ns("./title[@type = 'subtitle']"))&.text)
178
194
  else
179
- set(:superseding_title, ixml.at(ns("//bibdata/title[@type = 'main']"))&.text)
180
- set(:superseding_subtitle, ixml.at(ns("//bibdata/title[@type = 'subtitle']"))&.text)
195
+ set(:superseding_title,
196
+ ixml.at(ns("//bibdata/title[@type = 'main']"))&.text)
197
+ set(:superseding_subtitle,
198
+ ixml.at(ns("//bibdata/title[@type = 'subtitle']"))&.text)
181
199
  end
182
200
  end
183
201
 
184
- def superseding_iteration(d)
185
- return unless d.at(ns("./status/stage"))&.text == "draft-public"
186
- iter = d.at(ns("./status/iteration"))&.text || "1"
202
+ def superseding_iteration(newdoc)
203
+ return unless newdoc.at(ns("./status/stage"))&.text == "draft-public"
204
+
205
+ iter = newdoc.at(ns("./status/iteration"))&.text || "1"
187
206
  case iter.downcase
188
207
  when "1"
189
208
  set(:superseding_iteration_ordinal, "Initial")
@@ -192,21 +211,22 @@ module IsoDoc
192
211
  set(:superseding_iteration_ordinal, "Final")
193
212
  set(:superseding_iteration_code, "FPD")
194
213
  else
195
- set(:superseding_iteration_ordinal, iter.to_i.localize.to_rbnf_s("SpelloutRules", "spellout-ordinal"))
214
+ set(:superseding_iteration_ordinal,
215
+ iter.to_i.localize.to_rbnf_s("SpelloutRules", "spellout-ordinal"))
196
216
  set(:superseding_iteration_code, "#{iter}PD")
197
217
  end
198
218
  end
199
219
 
200
- def superseding_dates(d)
201
- if cdate = d.at(ns("./date[@type = 'circulated']/on"))&.text
220
+ def superseding_dates(newdoc)
221
+ if cdate = newdoc.at(ns("./date[@type = 'circulated']/on"))&.text
202
222
  set(:superseding_circulated_date, cdate)
203
223
  set(:superseding_circulated_date_monthyear, monthyr(cdate))
204
224
  end
205
- if cdate = d.at(ns("./date[@type = 'issued']/on"))&.text
225
+ if cdate = newdoc.at(ns("./date[@type = 'issued']/on"))&.text
206
226
  set(:superseding_issued_date, cdate)
207
227
  set(:superseding_issued_date_monthyear, monthyr(cdate))
208
228
  end
209
- if cdate = d.at(ns("./date[@type = 'updated']/on"))&.text
229
+ if cdate = newdoc.at(ns("./date[@type = 'updated']/on"))&.text
210
230
  set(:superseding_updated_date, cdate)
211
231
  set(:superseding_updated_date_monthyear, monthyr(cdate))
212
232
  set(:superseding_updated_date_MMMddyyyy, MMMddyyyy(cdate))
@@ -214,10 +234,12 @@ module IsoDoc
214
234
  end
215
235
 
216
236
  def note(xml, _out)
217
- note = xml.at(ns("//bibdata/note[@type = 'additional-note']"))&.text and set(:additional_note, note)
218
- note = xml.at(ns("//bibdata/note[@type = 'withdrawal-note']"))&.text and set(:withdrawal_note, note)
237
+ note = xml.at(ns("//bibdata/note[@type = 'additional-note']"))&.text and
238
+ set(:additional_note, note)
239
+ note = xml.at(ns("//bibdata/note[@type = 'withdrawal-note']"))&.text and
240
+ set(:withdrawal_note, note)
219
241
  note = xml.at(ns("//bibdata/note[@type = 'withdrawal-announcement-link']"))&.text and
220
- set(:withdrawal_announcement_link, note)
242
+ set(:withdrawal_announcement_link, note)
221
243
  super
222
244
  end
223
245
  end