metanorma-nist 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -396,7 +396,7 @@ AABkcnMvZG93bnJldi54bWxQSwUGAAAAAAQABADzAAAAkwUAAAAA
396
396
  </td>
397
397
  <td width="323" valign="top" style='width:242.25pt;padding:0cm 5.4pt 0cm 5.4pt'>
398
398
  <p class="Default" style='margin-top:6.0pt;margin-right:0cm;margin-bottom:
399
- 6.0pt;margin-left:0cm'><span lang="EN-US" style='font-size:12.0pt;font-family:"Times New Roman",serif;color:black;mso-themecolor:text1'>{% if superseded_date %}{{ obsoleteddate_MMMddyyyy}}{% else %}{{ obsoleteddate_MMMddyyyy}}{% endif %}<o:p></o:p></span></p>
399
+ 6.0pt;margin-left:0cm'><span lang="EN-US" style='font-size:12.0pt;font-family:"Times New Roman",serif;color:black;mso-themecolor:text1'>{% if superseded_date %}{{ supersededdate_MMMddyyyy}}{% else %}{{ obsoleteddate_MMMddyyyy}}{% endif %}<o:p></o:p></span></p>
400
400
  </td>
401
401
  </tr>
402
402
  <tr style='mso-yfti-irow:2;mso-yfti-lastrow:yes'>
@@ -409,7 +409,7 @@ AABkcnMvZG93bnJldi54bWxQSwUGAAAAAAQABADzAAAAkwUAAAAA
409
409
  </td>
410
410
  <td width="323" valign="top" style='width:242.25pt;padding:0cm 5.4pt 0cm 5.4pt'>
411
411
  <p class="Default" style='margin-top:6.0pt;margin-right:0cm;margin-bottom:
412
- 6.0pt;margin-left:0cm'><span lang="EN-US" style='font-size:12.0pt;font-family:"Times New Roman",serif;color:black;mso-themecolor:text1'>{{circulateddate_MMMddyyyy}}<o:p></o:p></span></p>
412
+ 6.0pt;margin-left:0cm'><span lang="EN-US" style='font-size:12.0pt;font-family:"Times New Roman",serif;color:black;mso-themecolor:text1'>{{issueddate_MMMddyyyy}}<o:p></o:p></span></p>
413
413
  </td>
414
414
  </tr>
415
415
  </table>
@@ -51,6 +51,15 @@ module IsoDoc
51
51
  HEAD
52
52
  end
53
53
 
54
+ def toclevel
55
+ <<~HEAD.freeze
56
+ function toclevel() { var i; var text = "";
57
+ for(i = 1; i <= #{@htmlToClevels}; i++) {
58
+ if (i > 1) { text += ","; } text += "h" + i + ":not(:empty):not(.TermNum):not(.AbstractTitle):not(.IntroTitle):not(.ForewordTitle)"; }
59
+ return text;}
60
+ HEAD
61
+ end
62
+
54
63
  def make_body(xml, docxml)
55
64
  body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72", "xml:lang": "EN-US", class: "container" }
56
65
  xml.body **body_attr do |body|
@@ -67,6 +76,7 @@ module IsoDoc
67
76
  def authority_cleanup(docxml)
68
77
  dest = docxml.at("//div[@id = 'authority']") || return
69
78
  auth = docxml.at("//div[@class = 'authority']") || return
79
+ auth.xpath(".//h1 | .//h2").each { |h| h["class"] = "IntroTitle" }
70
80
  dest.replace(auth.remove)
71
81
  a = docxml.at("//div[@id = 'authority1']") and a["class"] = "authority1"
72
82
  a = docxml.at("//div[@id = 'authority2']") and a["class"] = "authority2"
@@ -10,9 +10,9 @@ module IsoDoc
10
10
 
11
11
  def iter_abbr(stage, iter)
12
12
  return "F" if iter&.downcase == "final" &&
13
- %w(draft-wip draft-prelim draft-public).include?(stage)
13
+ %w(draft-wip draft-prelim draft-public draft-approval).include?(stage)
14
14
  case stage
15
- when "draft-wip", "draft-prelim"
15
+ when "draft-wip", "draft-prelim", "dradt-internal", "draft-approval"
16
16
  iter || ""
17
17
  when "draft-public"
18
18
  iter ||= "1"
@@ -24,10 +24,11 @@ module IsoDoc
24
24
 
25
25
  def stage_abbr(stage, iter)
26
26
  case stage
27
- when "draft-internal" then "Internal"
27
+ when "draft-internal" then "#{iter_abbr(stage, iter)}ID"
28
28
  when "draft-wip" then "#{iter_abbr(stage, iter)}WD"
29
29
  when "draft-prelim" then "#{iter_abbr(stage, iter)}PreD"
30
30
  when "draft-public" then "#{iter_abbr(stage, iter)}PD"
31
+ when "draft-approval" then "#{iter_abbr(stage, iter)}AD"
31
32
  else
32
33
  nil
33
34
  end
@@ -50,7 +51,7 @@ module IsoDoc
50
51
  end
51
52
 
52
53
  def author(ixml, _out)
53
- tc = ixml.at(ns("//bibdata/editorialgroup/committee"))
54
+ tc = ixml.at(ns("//bibdata/ext/editorialgroup/committee"))
54
55
  set(:tc, tc.text.upcase) if tc
55
56
  personal_authors(ixml)
56
57
  subdiv = ixml.at(ns("//bibdata/contributor[role/@type = 'publisher']/"\
@@ -59,7 +60,7 @@ module IsoDoc
59
60
  end
60
61
 
61
62
  def docid(ixml, _out)
62
- docid = ixml.at(ns("//bibdata/docidentifier[@type = 'nist']"))&.text
63
+ docid = ixml.at(ns("//bibdata/docidentifier[@type = 'NIST']"))&.text
63
64
  docid_long = ixml.at(ns("//bibdata/docidentifier"\
64
65
  "[@type = 'nist-long']"))&.text
65
66
  docnumber = ixml.at(ns("//bibdata/docnumber"))&.text
@@ -88,16 +89,6 @@ module IsoDoc
88
89
  prefix
89
90
  end
90
91
 
91
- def iter_code(ixml)
92
- docstatus = ixml.at(ns("//bibdata/status/stage"))&.text
93
- return nil unless docstatus == "draft-public"
94
- iter = ixml.at(ns("//bibdata/status/iteration"))&.text || "1"
95
- return "IPD" if iter == "1"
96
- return "FPD" if iter.downcase == "final"
97
- "#{iter}PD"
98
- end
99
-
100
- # override the above
101
92
  def iter_code(ixml)
102
93
  docstatus = ixml.at(ns("//bibdata/status/stage"))&.text
103
94
  iter = ixml.at(ns("//bibdata/status/iteration"))&.text
@@ -106,7 +97,6 @@ module IsoDoc
106
97
 
107
98
  def iter_ordinal(ixml)
108
99
  docstatus = ixml.at(ns("//bibdata/status/stage"))&.text
109
- #return nil unless docstatus == "draft-public"
110
100
  iter = ixml.at(ns("//bibdata/status/iteration"))&.text
111
101
  iter ||= "1" if docstatus == "draft-public"
112
102
  return if iter.nil?
@@ -140,6 +130,7 @@ module IsoDoc
140
130
  when "draft-wip" then "Work-in-Progress Draft"
141
131
  when "draft-prelim" then "Preliminary Draft"
142
132
  when "draft-public" then "Public Draft"
133
+ when "draft-approval" then "Approval Draft"
143
134
  when "final" then "Final"
144
135
  when "final-review" then "Under Review"
145
136
  when "final-withdrawn" then "Withdrawn"
@@ -148,7 +139,8 @@ module IsoDoc
148
139
 
149
140
  def version(ixml, _out)
150
141
  super
151
- set(:revision, ixml&.at(ns("//bibdata/revision"))&.text)
142
+ rev = ixml&.at(ns("//bibdata/edition"))&.text&.sub(/^Revision /, "")
143
+ set(:revision, rev) if rev
152
144
  revdate = get[:revdate]
153
145
  set(:revdate_monthyear, monthyr(revdate))
154
146
  set(:revdate_MMMddyyyy, MMMddyyyy(revdate))
@@ -223,16 +215,16 @@ module IsoDoc
223
215
 
224
216
  def keywords(ixml, _out)
225
217
  keywords = []
226
- ixml.xpath(ns("//bibdata/keyword")).each do |kw|
218
+ ixml.xpath(ns("//bibdata/ext/keyword")).each do |kw|
227
219
  keywords << kw.text
228
220
  end
229
221
  set(:keywords, keywords)
230
222
  end
231
223
 
232
224
  def commentperiod(ixml, _out)
233
- from = ixml.at(ns("//bibdata/commentperiod/from"))&.text
234
- to = ixml.at(ns("//bibdata/commentperiod/to"))&.text
235
- extended = ixml.at(ns("//bibdata/commentperiod/extended"))&.text
225
+ from = ixml.at(ns("//bibdata/ext/commentperiod/from"))&.text
226
+ to = ixml.at(ns("//bibdata/ext/commentperiod/to"))&.text
227
+ extended = ixml.at(ns("//bibdata/ext/commentperiod/extended"))&.text
236
228
  set(:comment_from, from) if from
237
229
  set(:comment_to, to) if to
238
230
  set(:comment_extended, extended) if extended
@@ -272,7 +264,7 @@ module IsoDoc
272
264
  set(:superseding_status,
273
265
  status_print(d.at(ns("./status/stage"))&.text || "final"))
274
266
  superseding_iteration(d)
275
- docid = d.at(ns("./docidentifier[@type = 'nist']"))&.text and
267
+ docid = d.at(ns("./docidentifier[@type = 'NIST']"))&.text and
276
268
  set(:superseding_docidentifier, docid)
277
269
  docid_long = d.at(ns("./docidentifier[@type = 'nist-long']"))&.text and
278
270
  set(:superseding_docidentifier_long, docid_long)
@@ -43,28 +43,20 @@ module IsoDoc
43
43
  @meta = Metadata.new(lang, script, labels)
44
44
  end
45
45
 
46
- def html_head()
46
+ def googlefonts
47
47
  <<~HEAD.freeze
48
- <title>{{ doctitle }}</title>
49
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
50
-
51
- <!--TOC script import-->
52
- <script type="text/javascript" src="https://cdn.rawgit.com/jgallen23/toc/0.3.2/dist/toc.min.js"></script>
53
- <script type="text/javascript">
54
- function toclevel() { var i; var text = "";
55
- for(i = 1; i <= #{@htmlToClevels}; i++) {
56
- if (i > 1) { text += ","; } text += "h" + i + ":not(.TermNum)"; } }
57
- </script>
58
-
59
- <!--Google fonts-->
60
48
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,600,600i" rel="stylesheet">
61
49
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet" />
62
50
  <link href="https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400i,700,700i" rel="stylesheet">
51
+ HEAD
52
+ end
63
53
 
64
- <!--Font awesome import for the link icon-->
65
- <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/solid.css" integrity="sha384-v2Tw72dyUXeU3y4aM2Y0tBJQkGfplr39mxZqlTBDUZAb9BGoC40+rdFCG0m10lXk" crossorigin="anonymous">
66
- <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/fontawesome.css" integrity="sha384-q3jl8XQu1OpdLgGFvNRnPdj5VIlCvgsDQTQB6owSOHWlAurxul7f+JpUOVdAiJ5P" crossorigin="anonymous">
67
- <style class="anchorjs"></style>
54
+ def toclevel
55
+ <<~HEAD.freeze
56
+ function toclevel() { var i; var text = "";
57
+ for(i = 1; i <= #{@htmlToClevels}; i++) {
58
+ if (i > 1) { text += ","; } text += "h" + i + ":not(:empty):not(.TermNum):not(.AbstractTitle):not(.IntroTitle):not(.ForewordTitle)"; }
59
+ return text;}
68
60
  HEAD
69
61
  end
70
62
 
@@ -98,7 +90,7 @@ module IsoDoc
98
90
  dest = docxml.at("//div[@id = 'authority']") || return
99
91
  auth = docxml.at("//div[@class = 'authority']") || return
100
92
  dest.replace(auth.remove)
101
- a = docxml.at("//div[@id = 'authority1']") and a["class"] = "authority1"
93
+ a = docxml.at("//div[@id = 'authority1']") and a["class"] = "authority1"
102
94
  a = docxml.at("//div[@id = 'authority2']") and a["class"] = "authority2"
103
95
  a = docxml.at("//div[@id = 'authority3']") and a["class"] = "authority3"
104
96
  a = docxml.at("//div[@id = 'authority4']") and a["class"] = "authority4"
@@ -172,7 +172,7 @@ module Iso690Render
172
172
  n = s.at("./number")
173
173
  p = s.at("./partnumber")
174
174
  dn = doc.at("./docnumber")
175
- rev = doc.at(".//revision")
175
+ rev = doc&.at(".//edition")&.text.sub(/^Revision /, "")
176
176
  ret = ""
177
177
  if t
178
178
  title = included(type) ? wrap(t.text, " <I>", "</I>") : wrap(t.text, " ", "")
@@ -184,13 +184,14 @@ module Iso690Render
184
184
  ret += ".#{p.text}" if p
185
185
  elsif dn && is_nist(doc)
186
186
  ret += " #{dn.text}"
187
- ret += " Rev. #{rev.text}" if rev
187
+ ret += " Rev. #{rev}" if rev
188
188
  end
189
189
  ret
190
190
  end
191
191
 
192
192
  def self.standardidentifier(doc)
193
193
  ret = []
194
+ require "byebug"; byebug
194
195
  doc.xpath("./docidentifier").each do |id|
195
196
  next if %w(nist-mr nist-long).include? id["type"]
196
197
  ret << standardidentifier1(id)
@@ -200,8 +201,9 @@ module Iso690Render
200
201
 
201
202
  def self.standardidentifier1(id)
202
203
  r = ""
204
+ require "byebug"; byebug
203
205
  r += "#{id['type']} " if id["type"] and
204
- !%w(ISO IEC nist).include? id["type"]
206
+ !%w(ISO IEC NIST).include? id["type"]
205
207
  r += id.text
206
208
  r
207
209
  end
@@ -294,11 +296,9 @@ module Iso690Render
294
296
  when "draft-wip" then "Work-in-Progress Draft"
295
297
  when "draft-prelim" then "Preliminary Draft"
296
298
  when "draft-public" then "Public Draft"
297
- when "draft-retire" then "Retired Draft"
298
- when "draft-withdrawn" then "Withdrawn Draft"
299
+ when "draft-approval" then "Approval Draft"
299
300
  when "final" then "Final"
300
301
  when "final-review" then "Under Review"
301
- when "final-withdrawn" then "Withdrawn"
302
302
  end
303
303
  end
304
304
 
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module NIST
3
- VERSION = "0.0.9"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -22,15 +22,17 @@ Gem::Specification.new do |spec|
22
22
  spec.bindir = "exe"
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
25
26
 
26
27
  spec.add_dependency "asciidoctor", "~> 1.5.7"
27
28
  spec.add_dependency "htmlentities", "~> 4.3.4"
28
29
  spec.add_dependency "ruby-jing"
29
30
  spec.add_dependency "twitter_cldr"
30
- spec.add_dependency "tzinfo-data" if RUBY_PLATFORM =~ /mswin|mingw/i
31
+ spec.add_dependency "tzinfo-data" # we need this for windows only
31
32
 
32
- spec.add_dependency "metanorma-standoc", "~> 1.1.0"
33
- spec.add_dependency "isodoc", "~> 0.9.0"
33
+ spec.add_dependency "metanorma-standoc", "~> 1.2.0"
34
+ spec.add_dependency "isodoc", "~> 0.10.0"
35
+ spec.add_dependency "relaton-nist", "~> 0.2.0"
34
36
 
35
37
  spec.add_development_dependency "bundler", "~> 2.0.1"
36
38
  spec.add_development_dependency "byebug", "~> 9.1"
@@ -43,5 +45,4 @@ Gem::Specification.new do |spec|
43
45
  spec.add_development_dependency "simplecov", "~> 0.15"
44
46
  spec.add_development_dependency "timecop", "~> 0.9"
45
47
  spec.add_development_dependency "metanorma", "~> 0.3.0"
46
- spec.add_development_dependency "nistbib", "~> 0.1.0"
47
48
  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: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-08 00:00:00.000000000 Z
11
+ date: 2019-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -66,34 +66,62 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: tzinfo-data
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: metanorma-standoc
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: 1.1.0
89
+ version: 1.2.0
76
90
  type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: 1.1.0
96
+ version: 1.2.0
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: isodoc
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: 0.9.0
103
+ version: 0.10.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.10.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: relaton-nist
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.2.0
90
118
  type: :runtime
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
122
  - - "~>"
95
123
  - !ruby/object:Gem::Version
96
- version: 0.9.0
124
+ version: 0.2.0
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: bundler
99
127
  requirement: !ruby/object:Gem::Requirement
@@ -248,20 +276,6 @@ dependencies:
248
276
  - - "~>"
249
277
  - !ruby/object:Gem::Version
250
278
  version: 0.3.0
251
- - !ruby/object:Gem::Dependency
252
- name: nistbib
253
- requirement: !ruby/object:Gem::Requirement
254
- requirements:
255
- - - "~>"
256
- - !ruby/object:Gem::Version
257
- version: 0.1.0
258
- type: :development
259
- prerelease: false
260
- version_requirements: !ruby/object:Gem::Requirement
261
- requirements:
262
- - - "~>"
263
- - !ruby/object:Gem::Version
264
- version: 0.1.0
265
279
  description: 'Metanorma NIST gem.
266
280
 
267
281
  '
@@ -332,7 +346,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
332
346
  requirements:
333
347
  - - ">="
334
348
  - !ruby/object:Gem::Version
335
- version: '0'
349
+ version: 2.4.0
336
350
  required_rubygems_version: !ruby/object:Gem::Requirement
337
351
  requirements:
338
352
  - - ">="
@@ -340,7 +354,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
340
354
  version: '0'
341
355
  requirements: []
342
356
  rubyforge_project:
343
- rubygems_version: 2.7.6
357
+ rubygems_version: 2.7.7
344
358
  signing_key:
345
359
  specification_version: 4
346
360
  summary: Metanorma NIST gem.