metanorma-nist 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -93,6 +93,7 @@ module IsoDoc
93
93
  a = docxml.at("//div[@id = 'authority1']") and a["class"] = "authority1"
94
94
  a = docxml.at("//div[@id = 'authority2']") and a["class"] = "authority2"
95
95
  a = docxml.at("//div[@id = 'authority3']") and a["class"] = "authority3"
96
+ a = docxml.at("//div[@id = 'authority3a']") and a["class"] = "authority3"
96
97
  a = docxml.at("//div[@id = 'authority4']") and a["class"] = "authority4"
97
98
  a = docxml.at("//div[@id = 'authority5']") and a["class"] = "authority5"
98
99
  end
@@ -151,9 +151,12 @@ module IsoDoc
151
151
  ixml.xpath(ns("//bibdata/date")).each do |d|
152
152
  val = Common::date_range(d)
153
153
  next if val == "XXX"
154
- set("#{d['type']}date_monthyear".to_sym, daterange_proc(val, :monthyr))
155
- set("#{d['type']}date_mmddyyyy".to_sym, daterange_proc(val, :mmddyyyy))
156
- set("#{d['type']}date_MMMddyyyy".to_sym, daterange_proc(val, :MMMddyyyy))
154
+ set("#{d['type']}date_monthyear".to_sym,
155
+ daterange_proc(val, :monthyr))
156
+ set("#{d['type']}date_mmddyyyy".to_sym,
157
+ daterange_proc(val, :mmddyyyy))
158
+ set("#{d['type']}date_MMMddyyyy".to_sym,
159
+ daterange_proc(val, :MMMddyyyy))
157
160
  end
158
161
  withdrawal_pending(ixml)
159
162
  most_recent_date(ixml)
@@ -193,6 +196,9 @@ module IsoDoc
193
196
  def series(ixml, _out)
194
197
  series = ixml.at(ns("//bibdata/series[@type = 'main']/title"))&.text
195
198
  set(:series, series) if series
199
+ seriesabbr =
200
+ ixml.at(ns("//bibdata/series[@type = 'main']/abbreviation"))&.text
201
+ set(:seriesabbr, seriesabbr) if seriesabbr
196
202
  subseries = ixml.at(ns("//bibdata/series[@type = 'secondary']/"\
197
203
  "title"))&.text
198
204
  set(:subseries, subseries) if subseries
@@ -275,7 +281,8 @@ module IsoDoc
275
281
  set(:superseding_uri, uri)
276
282
  superseding_titles(ixml, d)
277
283
  authors = d.xpath(ns("./contributor[role/@type = 'author']/person"))
278
- authors = ixml.xpath(ns("//bibdata/contributor[role/@type = 'author']/person")) if authors.empty?
284
+ authors.empty? and authors =
285
+ ixml.xpath(ns("//bibdata/contributor[role/@type = 'author']/person"))
279
286
  set(:superseding_authors, extract_person_names(authors))
280
287
  end
281
288
 
@@ -283,10 +290,13 @@ module IsoDoc
283
290
  title = d.at(ns("./title[@type = 'main']"))&.text
284
291
  if title
285
292
  set(:superseding_title, d.at(ns("./title[@type = 'main']"))&.text)
286
- set(:superseding_subtitle, d.at(ns("./title[@type = 'subtitle']"))&.text)
293
+ set(:superseding_subtitle,
294
+ d.at(ns("./title[@type = 'subtitle']"))&.text)
287
295
  else
288
- set(:superseding_title, ixml.at(ns("//bibdata/title[@type = 'main']"))&.text)
289
- set(:superseding_subtitle, ixml.at(ns("//bibdata/title[@type = 'subtitle']"))&.text)
296
+ set(:superseding_title,
297
+ ixml.at(ns("//bibdata/title[@type = 'main']"))&.text)
298
+ set(:superseding_subtitle,
299
+ ixml.at(ns("//bibdata/title[@type = 'subtitle']"))&.text)
290
300
  end
291
301
  end
292
302
 
@@ -328,7 +338,8 @@ module IsoDoc
328
338
  set(:additional_note, note)
329
339
  note = xml.at(ns("//bibdata/note[@type = 'withdrawal-note']"))&.text and
330
340
  set(:withdrawal_note, note)
331
- note = xml.at(ns("//bibdata/note[@type = 'withdrawal-announcement-link']"))&.text and
341
+ note = xml.at(ns("//bibdata/note[@type = "\
342
+ "'withdrawal-announcement-link']"))&.text and
332
343
  set(:withdrawal_announcement_link, note)
333
344
  end
334
345
  end
@@ -93,6 +93,7 @@ module IsoDoc
93
93
  a = docxml.at("//div[@id = 'authority1']") and a["class"] = "authority1"
94
94
  a = docxml.at("//div[@id = 'authority2']") and a["class"] = "authority2"
95
95
  a = docxml.at("//div[@id = 'authority3']") and a["class"] = "authority3"
96
+ a = docxml.at("//div[@id = 'authority3a']") and a["class"] = "authority3"
96
97
  a = docxml.at("//div[@id = 'authority4']") and a["class"] = "authority4"
97
98
  a = docxml.at("//div[@id = 'authority5']") and a["class"] = "authority5"
98
99
  end
@@ -16,10 +16,21 @@ module IsoDoc
16
16
  end
17
17
 
18
18
  def convert1(docxml, filename, dir)
19
- @bibliographycount = docxml.xpath(ns("//bibliography/references | //annex/references | //bibliography/clause/references")).size
20
- FileUtils.cp html_doc_path("logo.png"), "#{@localdir}/logo.png"
19
+ @series = docxml&.at(ns("//bibdata/series/abbreviation"))&.text
20
+ @bibliographycount =
21
+ docxml.xpath(ns("//bibliography/references | //annex/references | "\
22
+ "//bibliography/clause/references")).size
23
+ FileUtils.cp html_doc_path(@series == "NIST CSWP" ? "logo_cswp.png" :
24
+ "logo.png"), "#{@localdir}/logo.png"
21
25
  FileUtils.cp html_doc_path("deptofcommerce.png"),
22
26
  "#{@localdir}/deptofcommerce.png"
27
+ if @series == "NIST CSWP"
28
+ @wordstylesheet_name = html_doc_path("wordstyle_cswp.scss")
29
+ @standardstylesheet_name = html_doc_path("nist_cswp.scss")
30
+ @wordcoverpage = html_doc_path("word_nist_titlepage_cswp.html")
31
+ @wordintropage = html_doc_path("word_nist_intro_cswp.html")
32
+ @header = html_doc_path("header_cswp.html")
33
+ end
23
34
  super
24
35
  end
25
36
 
@@ -27,9 +38,9 @@ module IsoDoc
27
38
  {
28
39
  bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
29
40
  '"Times New Roman",serif'),
30
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
41
+ headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
31
42
  '"Arial",sans-serif'),
32
- monospacefont: '"Courier New",monospace'
43
+ monospacefont: '"Courier New",monospace'
33
44
  }
34
45
  end
35
46
 
@@ -74,11 +85,15 @@ module IsoDoc
74
85
 
75
86
  def authority_cleanup(docxml)
76
87
  insert = docxml.at("//div[@class = 'WordSection2']")
77
- auth = docxml&.at("//div[@class = 'authority']")&.remove || return
78
- insert.children.first.add_previous_sibling(auth)
88
+ if @series != "NIST CSWP"
89
+ auth = docxml&.at("//div[@class = 'authority']")&.remove || return
90
+ insert.children.first.add_previous_sibling(auth)
91
+ end
79
92
  a = docxml.at("//div[@id = 'authority1']") and a["class"] = "authority1"
80
93
  a = docxml.at("//div[@id = 'authority2']") and a["class"] = "authority2"
81
94
  a = docxml.at("//div[@id = 'authority3']") and a["class"] = "authority3"
95
+ a = docxml.at("//div[@id = 'authority3a']") and
96
+ a["class"] = "authority3"
82
97
  a = docxml.at("//div[@id = 'authority4']") and a["class"] = "authority4"
83
98
  a = docxml.at("//div[@id = 'authority5']") and a["class"] = "authority5"
84
99
  end
@@ -89,7 +104,7 @@ module IsoDoc
89
104
  requirement_cleanup(docxml)
90
105
  h1_cleanup(docxml)
91
106
  word_annex_cleanup(docxml) # need it earlier
92
- word_preface_cleanup(docxml) # need it earlier, since early ToC insertion
107
+ word_preface_cleanup(docxml) # ditto, since early ToC insertion
93
108
  toc_insert(docxml, @wordToClevels)
94
109
  end
95
110
 
@@ -267,7 +282,8 @@ module IsoDoc
267
282
  def term_cleanup(docxml)
268
283
  docxml.xpath("//table[@class = 'terms_dl']").each do |d|
269
284
  prev = d.previous_element
270
- next unless prev and prev.name == "table" and prev["class"] == "terms_dl"
285
+ next unless prev and prev.name == "table" and
286
+ prev["class"] == "terms_dl"
271
287
  d.children.each { |n| prev.add_child(n.remove) }
272
288
  d.remove
273
289
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module NIST
3
- VERSION = "0.2.3"
3
+ VERSION = "0.2.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: 0.2.3
4
+ version: 0.2.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: 2019-09-27 00:00:00.000000000 Z
11
+ date: 2019-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -271,15 +271,16 @@ executables: []
271
271
  extensions: []
272
272
  extra_rdoc_files: []
273
273
  files:
274
+ - ".github/workflows/macos.yml"
275
+ - ".github/workflows/ubuntu.yml"
276
+ - ".github/workflows/windows.yml"
274
277
  - ".hound.yml"
275
278
  - ".rubocop.yml"
276
- - ".travis.yml"
277
279
  - CODE_OF_CONDUCT.md
278
280
  - Gemfile
279
281
  - LICENSE
280
282
  - README.adoc
281
283
  - Rakefile
282
- - appveyor.yml
283
284
  - bin/console
284
285
  - bin/rspec
285
286
  - bin/setup
@@ -294,22 +295,30 @@ files:
294
295
  - lib/asciidoctor/nist/isostandard.rng
295
296
  - lib/asciidoctor/nist/nist.rng
296
297
  - lib/asciidoctor/nist/nist_intro.xml
298
+ - lib/asciidoctor/nist/nist_intro_cswp.xml
297
299
  - lib/asciidoctor/nist/reqt.rng
298
300
  - lib/asciidoctor/nist/validate.rb
299
301
  - lib/isodoc/nist/base_convert.rb
302
+ - lib/isodoc/nist/html/_coverpage.scss
300
303
  - lib/isodoc/nist/html/commerce-logo-color.png
301
304
  - lib/isodoc/nist/html/deptofcommerce.png
302
305
  - lib/isodoc/nist/html/header.html
306
+ - lib/isodoc/nist/html/header_cswp.html
303
307
  - lib/isodoc/nist/html/html_nist_intro.html
304
308
  - lib/isodoc/nist/html/html_nist_titlepage.html
305
309
  - lib/isodoc/nist/html/htmlstyle.scss
306
310
  - lib/isodoc/nist/html/logo.png
311
+ - lib/isodoc/nist/html/logo_cswp.png
307
312
  - lib/isodoc/nist/html/nist.scss
313
+ - lib/isodoc/nist/html/nist_cswp.scss
308
314
  - lib/isodoc/nist/html/scripts.html
309
315
  - lib/isodoc/nist/html/scripts.pdf.html
310
316
  - lib/isodoc/nist/html/word_nist_intro.html
317
+ - lib/isodoc/nist/html/word_nist_intro_cswp.html
311
318
  - lib/isodoc/nist/html/word_nist_titlepage.html
319
+ - lib/isodoc/nist/html/word_nist_titlepage_cswp.html
312
320
  - lib/isodoc/nist/html/wordstyle.scss
321
+ - lib/isodoc/nist/html/wordstyle_cswp.scss
313
322
  - lib/isodoc/nist/html_convert.rb
314
323
  - lib/isodoc/nist/i18n-en.yaml
315
324
  - lib/isodoc/nist/metadata.rb
data/.travis.yml DELETED
@@ -1,22 +0,0 @@
1
- # Auto-generated !!! Do not edit it manually
2
- # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
- language: ruby
4
- cache: bundler
5
- os:
6
- - linux
7
- - osx
8
- rvm:
9
- - 2.6
10
- - 2.5
11
- - 2.4
12
- - ruby-head
13
- before_install:
14
- - nvm install 8
15
- - npm install -g puppeteer
16
- - npm install
17
- - gem install bundler -v "~> 2"
18
- - bundle update
19
- matrix:
20
- allow_failures:
21
- - rvm: ruby-head
22
-
data/appveyor.yml DELETED
@@ -1,37 +0,0 @@
1
- # Auto-generated !!! Do not edit it manually
2
- # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
- version: '{build}'
4
-
5
- cache:
6
- - vendor/bundle
7
-
8
- environment:
9
- matrix:
10
- - RUBY_VERSION: 26
11
- - RUBY_VERSION: 25
12
- - RUBY_VERSION: 24
13
- - RUBY_VERSION: _trunk
14
-
15
- matrix:
16
- allow_failures:
17
- - RUBY_VERSION: _trunk
18
-
19
- install:
20
- - ps: . { iwr -useb https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/appveyor.ps1 } | iex
21
- - refreshenv
22
-
23
- build_script:
24
- - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
25
- - set GIT_TERMINAL_PROMPT=0
26
- - gem install bundler -v "~> 2"
27
- - bundle config --local path vendor/bundle
28
- - bundle update
29
- - bundle install
30
-
31
- before_test:
32
- - ruby -v
33
- - gem -v
34
- - bundle -v
35
-
36
- test_script:
37
- - bundle exec rake