metanorma-nist 1.0.9 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) 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/biblio.rng +1 -1
  7. data/lib/asciidoctor/nist/cleanup.rb +5 -4
  8. data/lib/asciidoctor/nist/converter.rb +13 -18
  9. data/lib/asciidoctor/nist/isodoc.rng +427 -0
  10. data/lib/asciidoctor/nist/reqt.rng +23 -0
  11. data/lib/isodoc/nist/base_convert.rb +26 -4
  12. data/lib/isodoc/nist/html/_coverpage.css +243 -0
  13. data/lib/isodoc/nist/html/_coverpage.scss +1 -1
  14. data/lib/isodoc/nist/html/html_nist_titlepage.html +1 -1
  15. data/lib/isodoc/nist/html/htmlstyle.css +955 -0
  16. data/lib/isodoc/nist/html/nist.css +1055 -0
  17. data/lib/isodoc/nist/html/nist.scss +0 -1
  18. data/lib/isodoc/nist/html/nist_cswp.css +996 -0
  19. data/lib/isodoc/nist/html/nist_cswp.scss +0 -1
  20. data/lib/isodoc/nist/html/wordstyle.css +1440 -0
  21. data/lib/isodoc/nist/html/wordstyle.scss +0 -1
  22. data/lib/isodoc/nist/html/wordstyle_cswp.css +1119 -0
  23. data/lib/isodoc/nist/html/wordstyle_cswp.scss +0 -1
  24. data/lib/isodoc/nist/html_convert.rb +2 -9
  25. data/lib/isodoc/nist/nist.cswp.xsl +988 -361
  26. data/lib/isodoc/nist/nist.sp.xsl +1129 -495
  27. data/lib/isodoc/nist/pdf_convert.rb +4 -15
  28. data/lib/isodoc/nist/presentation_xml_convert.rb +10 -0
  29. data/lib/isodoc/nist/refs.rb +7 -3
  30. data/lib/isodoc/nist/section.rb +2 -1
  31. data/lib/isodoc/nist/word_convert.rb +0 -5
  32. data/lib/isodoc/nist/word_convert_toc.rb +2 -2
  33. data/lib/isodoc/nist/{xrefs.rb → xref.rb} +2 -2
  34. data/lib/metanorma-nist.rb +2 -0
  35. data/lib/metanorma/nist/processor.rb +6 -8
  36. data/lib/metanorma/nist/version.rb +1 -1
  37. data/metanorma-nist.gemspec +2 -1
  38. metadata +30 -10
@@ -7,26 +7,15 @@ module IsoDoc
7
7
  module NIST
8
8
  # A {Converter} implementation that generates PDF HTML output, and a
9
9
  # document schema encapsulation of the document for validation
10
- class PdfConvert < IsoDoc::PdfConvert
10
+ class PdfConvert < IsoDoc::XslfoPdfConvert
11
11
  def initialize(options)
12
12
  @libdir = File.dirname(__FILE__)
13
13
  super
14
14
  end
15
15
 
16
- def convert(filename, file = nil, debug = false)
17
- file = File.read(filename, encoding: "utf-8") if file.nil?
18
- docxml, outname_html, dir = convert_init(file, filename, debug)
19
- @series = docxml&.at(ns("//bibdata/series/abbreviation"))&.text
20
- /\.xml$/.match(filename) or
21
- filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f|
22
- f.write file
23
- f.path
24
- end
25
- FileUtils.rm_rf dir
26
- ::Metanorma::Output::XslfoPdf.new.convert(
27
- filename, outname_html + ".pdf",
28
- File.join(@libdir, @series == "NIST CSWP" ?
29
- "nist.cswp.xsl" : "nist.sp.xsl"))
16
+ def pdf_stylesheet(docxml)
17
+ series = docxml&.at(ns("//bibdata/series/abbreviation"))&.text
18
+ series == "NIST CSWP" ? "nist.cswp.xsl" : "nist.sp.xsl"
30
19
  end
31
20
  end
32
21
  end
@@ -0,0 +1,10 @@
1
+ require_relative "base_convert"
2
+ require "isodoc"
3
+
4
+ module IsoDoc
5
+ module NIST
6
+ class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
7
+ end
8
+ end
9
+ end
10
+
@@ -21,8 +21,7 @@ module IsoDoc
21
21
  end
22
22
 
23
23
  def reference_format(b, r)
24
- id = bibitem_ref_code(b)
25
- code = render_identifier(id)
24
+ code = render_identifier(bibitem_ref_code(b))
26
25
  if code[0]
27
26
  r << "#{code[0]} "
28
27
  insert_tab(r, 1)
@@ -54,6 +53,11 @@ module IsoDoc
54
53
  end
55
54
 
56
55
  def nist_reference_format(b, r)
56
+ code = render_identifier(bibitem_ref_code(b))
57
+ if code[0]
58
+ r << "#{code[0]} "
59
+ insert_tab(r, 1)
60
+ end
57
61
  bibitem = b.dup.to_xml
58
62
  r.parent.add_child ::Iso690Render.render(bibitem, true)
59
63
  end
@@ -62,7 +66,7 @@ module IsoDoc
62
66
  title = node&.at(ns("./title"))&.text || ""
63
67
  out.div do |div|
64
68
  unless suppress_biblio_title(node)
65
- anchor(node['id'], :label, false) and
69
+ @xrefs.anchor(node['id'], :label, false) and
66
70
  clause_parse_title(node, div, node.at(ns("./title")), out) or
67
71
  div.h2 title, **{ class: "Section3" }
68
72
  end
@@ -25,7 +25,7 @@ module IsoDoc
25
25
  def preface1(c, title, patent, out)
26
26
  out.div **attr_code(id: c["id"]) do |s|
27
27
  page_break(s) if patent
28
- clause_name(anchor(c['id'], :label), title, s,
28
+ clause_name(@xrefs.anchor(c['id'], :label), title, s,
29
29
  class: (c.name == "executivesummary") ? "NormalTitle" :
30
30
  "IntroTitle")
31
31
  c.elements.reject { |c1| c1.name == "title" }.each do |c1|
@@ -36,6 +36,7 @@ module IsoDoc
36
36
 
37
37
  def middle(isoxml, out)
38
38
  clause isoxml, out
39
+ require "byebug"; byebug
39
40
  bibliography isoxml, out
40
41
  annex isoxml, out
41
42
  end
@@ -1,7 +1,6 @@
1
1
  require "isodoc"
2
2
  require_relative "metadata"
3
3
  require "fileutils"
4
- require "sassc"
5
4
  require_relative "base_convert"
6
5
  require_relative "word_convert_toc"
7
6
 
@@ -49,10 +48,6 @@ module IsoDoc
49
48
  olstyle: "l2" }
50
49
  end
51
50
 
52
- def metadata_init(lang, script, labels)
53
- @meta = Metadata.new(lang, script, labels)
54
- end
55
-
56
51
  def make_body(xml, docxml)
57
52
  body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72" }
58
53
  xml.body **body_attr do |body|
@@ -35,7 +35,7 @@ module IsoDoc
35
35
  <span lang="EN-GB"><span
36
36
  style='mso-element:field-begin'></span><span
37
37
  style='mso-spacerun:yes'>&#xA0;</span>TOC
38
- \\h \\z \\t &quot;TableTitle,1&quot; <span
38
+ \\h \\z \\t &quot;TableTitle,tabletitle&quot; <span
39
39
  style='mso-element:field-separator'></span></span>
40
40
  TOC
41
41
 
@@ -43,7 +43,7 @@ module IsoDoc
43
43
  <span lang="EN-GB"><span
44
44
  style='mso-element:field-begin'></span><span
45
45
  style='mso-spacerun:yes'>&#xA0;</span>TOC
46
- \\h \\z \\t &quot;FigureTitle,1&quot; <span
46
+ \\h \\z \\t &quot;FigureTitle,figuretitle&quot; <span
47
47
  style='mso-element:field-separator'></span></span>
48
48
  TOC
49
49
 
@@ -4,7 +4,7 @@ require "fileutils"
4
4
 
5
5
  module IsoDoc
6
6
  module NIST
7
- module BaseConvert
7
+ class Xref < IsoDoc::Xref
8
8
  SECTIONS_XPATH =
9
9
  "//foreword | //introduction | //reviewnote | //executivesummary | //annex | "\
10
10
  "//sections/clause | //bibliography/references | //acknowledgements | "\
@@ -50,7 +50,7 @@ module IsoDoc
50
50
  end
51
51
 
52
52
  def annex_name_lbl(clause, num)
53
- l10n("<b>#{@annex_lbl} #{num}</b>")
53
+ l10n("<b>#{@labels['annex']} #{num}</b>")
54
54
  end
55
55
 
56
56
  def annex_name(annex, name, div)
@@ -3,7 +3,9 @@ require_relative "asciidoctor/nist/converter"
3
3
  require_relative "isodoc/nist/html_convert"
4
4
  require_relative "isodoc/nist/pdf_convert"
5
5
  require_relative "isodoc/nist/word_convert"
6
+ require_relative "isodoc/nist/presentation_xml_convert"
6
7
  require_relative "isodoc/nist/render"
8
+ require_relative "isodoc/nist/xref"
7
9
  require_relative "metanorma/nist/version"
8
10
 
9
11
  if defined? Metanorma
@@ -29,18 +29,16 @@ module Metanorma
29
29
  "Metanorma::NIST #{Metanorma::NIST::VERSION}"
30
30
  end
31
31
 
32
- def input_to_isodoc(file, filename)
33
- Metanorma::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
34
- end
35
-
36
- def output(isodoc_node, outname, format, options={})
32
+ def output(isodoc_node, inname, outname, format, options={})
37
33
  case format
38
34
  when :html
39
- IsoDoc::NIST::HtmlConvert.new(options).convert(outname, isodoc_node)
35
+ IsoDoc::NIST::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
40
36
  when :doc
41
- IsoDoc::NIST::WordConvert.new(options).convert(outname, isodoc_node)
37
+ IsoDoc::NIST::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
42
38
  when :pdf
43
- IsoDoc::NIST::PdfConvert.new(options).convert(outname, isodoc_node)
39
+ IsoDoc::NIST::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
40
+ when :presentation
41
+ IsoDoc::NIST::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
44
42
  else
45
43
  super
46
44
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module NIST
3
- VERSION = "1.0.9"
3
+ VERSION = "1.1.3"
4
4
  end
5
5
  end
@@ -31,10 +31,11 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency "tzinfo-data" # we need this for windows only
32
32
 
33
33
  spec.add_dependency "metanorma-standoc", "~> 1.4.0"
34
- spec.add_dependency "isodoc", "~> 1.0.0"
34
+ spec.add_dependency "isodoc", "~> 1.1.0"
35
35
  #spec.add_dependency "relaton-nist", "~> 0.3.0"
36
36
 
37
37
  spec.add_development_dependency "byebug", "~> 9.1"
38
+ spec.add_development_dependency "sassc", "2.4.0"
38
39
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
39
40
  spec.add_development_dependency "guard", "~> 2.14"
40
41
  spec.add_development_dependency "guard-rspec", "~> 4.7"
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.9
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-08 00:00:00.000000000 Z
11
+ date: 2020-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.0.0
103
+ version: 1.1.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.0.0
110
+ version: 1.1.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: byebug
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '9.1'
125
+ - !ruby/object:Gem::Dependency
126
+ name: sassc
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 2.4.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 2.4.0
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: equivalent-xml
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -272,6 +286,7 @@ files:
272
286
  - lib/asciidoctor/nist/validate.rb
273
287
  - lib/isodoc/nist/base_convert.rb
274
288
  - lib/isodoc/nist/common.xsl
289
+ - lib/isodoc/nist/html/_coverpage.css
275
290
  - lib/isodoc/nist/html/_coverpage.scss
276
291
  - lib/isodoc/nist/html/commerce-logo-color.png
277
292
  - lib/isodoc/nist/html/deptofcommerce.png
@@ -279,17 +294,22 @@ files:
279
294
  - lib/isodoc/nist/html/header_cswp.html
280
295
  - lib/isodoc/nist/html/html_nist_intro.html
281
296
  - lib/isodoc/nist/html/html_nist_titlepage.html
297
+ - lib/isodoc/nist/html/htmlstyle.css
282
298
  - lib/isodoc/nist/html/htmlstyle.scss
283
299
  - lib/isodoc/nist/html/logo.png
284
300
  - lib/isodoc/nist/html/logo_cswp.png
301
+ - lib/isodoc/nist/html/nist.css
285
302
  - lib/isodoc/nist/html/nist.scss
303
+ - lib/isodoc/nist/html/nist_cswp.css
286
304
  - lib/isodoc/nist/html/nist_cswp.scss
287
305
  - lib/isodoc/nist/html/scripts.html
288
306
  - lib/isodoc/nist/html/word_nist_intro.html
289
307
  - lib/isodoc/nist/html/word_nist_intro_cswp.html
290
308
  - lib/isodoc/nist/html/word_nist_titlepage.html
291
309
  - lib/isodoc/nist/html/word_nist_titlepage_cswp.html
310
+ - lib/isodoc/nist/html/wordstyle.css
292
311
  - lib/isodoc/nist/html/wordstyle.scss
312
+ - lib/isodoc/nist/html/wordstyle_cswp.css
293
313
  - lib/isodoc/nist/html/wordstyle_cswp.scss
294
314
  - lib/isodoc/nist/html_convert.rb
295
315
  - lib/isodoc/nist/i18n-en.yaml
@@ -298,6 +318,7 @@ files:
298
318
  - lib/isodoc/nist/nist.cswp.xsl
299
319
  - lib/isodoc/nist/nist.sp.xsl
300
320
  - lib/isodoc/nist/pdf_convert.rb
321
+ - lib/isodoc/nist/presentation_xml_convert.rb
301
322
  - lib/isodoc/nist/refs.rb
302
323
  - lib/isodoc/nist/render.rb
303
324
  - lib/isodoc/nist/render_contributors.rb
@@ -305,7 +326,7 @@ files:
305
326
  - lib/isodoc/nist/section.rb
306
327
  - lib/isodoc/nist/word_convert.rb
307
328
  - lib/isodoc/nist/word_convert_toc.rb
308
- - lib/isodoc/nist/xrefs.rb
329
+ - lib/isodoc/nist/xref.rb
309
330
  - lib/metanorma-nist.rb
310
331
  - lib/metanorma/nist.rb
311
332
  - lib/metanorma/nist/processor.rb
@@ -315,7 +336,7 @@ homepage: https://github.com/metanorma/metanorma-nist
315
336
  licenses:
316
337
  - BSD-2-Clause
317
338
  metadata: {}
318
- post_install_message:
339
+ post_install_message:
319
340
  rdoc_options: []
320
341
  require_paths:
321
342
  - lib
@@ -330,9 +351,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
330
351
  - !ruby/object:Gem::Version
331
352
  version: '0'
332
353
  requirements: []
333
- rubyforge_project:
334
- rubygems_version: 2.7.6
335
- signing_key:
354
+ rubygems_version: 3.0.3
355
+ signing_key:
336
356
  specification_version: 4
337
357
  summary: Metanorma NIST gem.
338
358
  test_files: []