metanorma-gb 1.3.23 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,5 +53,20 @@ $('#toggle').on('click', function(){
53
53
  });
54
54
  */
55
55
  </script>
56
-
57
-
56
+ <script>
57
+ // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
58
+ //
59
+ // AnchorJS - v4.2.2 - 2020-04-20
60
+ // https://www.bryanbraun.com/anchorjs/
61
+ // Copyright (c) 2020 Bryan Braun; Licensed MIT
62
+ //
63
+ // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
64
+ !function(A,e){"use strict";"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(this,function(){"use strict";return function(A){function f(A){A.icon=A.hasOwnProperty("icon")?A.icon:"",A.visible=A.hasOwnProperty("visible")?A.visible:"hover",A.placement=A.hasOwnProperty("placement")?A.placement:"right",A.ariaLabel=A.hasOwnProperty("ariaLabel")?A.ariaLabel:"Anchor",A.class=A.hasOwnProperty("class")?A.class:"",A.base=A.hasOwnProperty("base")?A.base:"",A.truncate=A.hasOwnProperty("truncate")?Math.floor(A.truncate):64,A.titleText=A.hasOwnProperty("titleText")?A.titleText:""}function p(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new Error("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}this.options=A||{},this.elements=[],f(this.options),this.isTouchDevice=function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)},this.add=function(A){var e,t,i,n,o,s,a,r,c,h,l,u,d=[];if(f(this.options),"touch"===(l=this.options.visible)&&(l=this.isTouchDevice()?"always":"hover"),0===(e=p(A=A||"h2, h3, h4, h5, h6")).length)return this;for(!function(){if(null!==document.head.querySelector("style.anchorjs"))return;var A,e=document.createElement("style");e.className="anchorjs",e.appendChild(document.createTextNode("")),void 0===(A=document.head.querySelector('[rel="stylesheet"],style'))?document.head.appendChild(e):document.head.insertBefore(e,A);e.sheet.insertRule(".anchorjs-link{opacity:0;text-decoration:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}",e.sheet.cssRules.length),e.sheet.insertRule(":hover>.anchorjs-link,.anchorjs-link:focus{opacity:1}",e.sheet.cssRules.length),e.sheet.insertRule("[data-anchorjs-icon]::after{content:attr(data-anchorjs-icon)}",e.sheet.cssRules.length),e.sheet.insertRule('@font-face{font-family:anchorjs-icons;src:url(data:n/a;base64,AAEAAAALAIAAAwAwT1MvMg8yG2cAAAE4AAAAYGNtYXDp3gC3AAABpAAAAExnYXNwAAAAEAAAA9wAAAAIZ2x5ZlQCcfwAAAH4AAABCGhlYWQHFvHyAAAAvAAAADZoaGVhBnACFwAAAPQAAAAkaG10eASAADEAAAGYAAAADGxvY2EACACEAAAB8AAAAAhtYXhwAAYAVwAAARgAAAAgbmFtZQGOH9cAAAMAAAAAunBvc3QAAwAAAAADvAAAACAAAQAAAAEAAHzE2p9fDzz1AAkEAAAAAADRecUWAAAAANQA6R8AAAAAAoACwAAAAAgAAgAAAAAAAAABAAADwP/AAAACgAAA/9MCrQABAAAAAAAAAAAAAAAAAAAAAwABAAAAAwBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAMCQAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg//0DwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAAIAAAACgAAxAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADAAAAAIAAgAAgAAACDpy//9//8AAAAg6cv//f///+EWNwADAAEAAAAAAAAAAAAAAAAACACEAAEAAAAAAAAAAAAAAAAxAAACAAQARAKAAsAAKwBUAAABIiYnJjQ3NzY2MzIWFxYUBwcGIicmNDc3NjQnJiYjIgYHBwYUFxYUBwYGIwciJicmNDc3NjIXFhQHBwYUFxYWMzI2Nzc2NCcmNDc2MhcWFAcHBgYjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAAADACWAAEAAAAAAAEACAAAAAEAAAAAAAIAAwAIAAEAAAAAAAMACAAAAAEAAAAAAAQACAAAAAEAAAAAAAUAAQALAAEAAAAAAAYACAAAAAMAAQQJAAEAEAAMAAMAAQQJAAIABgAcAAMAAQQJAAMAEAAMAAMAAQQJAAQAEAAMAAMAAQQJAAUAAgAiAAMAAQQJAAYAEAAMYW5jaG9yanM0MDBAAGEAbgBjAGgAbwByAGoAcwA0ADAAMABAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAP) format("truetype")}',e.sheet.cssRules.length)}(),t=document.querySelectorAll("[id]"),i=[].map.call(t,function(A){return A.id}),o=0;o<e.length;o++)if(this.hasAnchorJSLink(e[o]))d.push(o);else{if(e[o].hasAttribute("id"))n=e[o].getAttribute("id");else if(e[o].hasAttribute("data-anchor-id"))n=e[o].getAttribute("data-anchor-id");else{for(c=r=this.urlify(e[o].textContent),a=0;void 0!==s&&(c=r+"-"+a),a+=1,-1!==(s=i.indexOf(c)););s=void 0,i.push(c),e[o].setAttribute("id",c),n=c}(h=document.createElement("a")).className="anchorjs-link "+this.options.class,h.setAttribute("aria-label",this.options.ariaLabel),h.setAttribute("data-anchorjs-icon",this.options.icon),this.options.titleText&&(h.title=this.options.titleText),u=document.querySelector("base")?window.location.pathname+window.location.search:"",u=this.options.base||u,h.href=u+"#"+n,"always"===l&&(h.style.opacity="1"),""===this.options.icon&&(h.style.font="1em/1 anchorjs-icons","left"===this.options.placement&&(h.style.lineHeight="inherit")),"left"===this.options.placement?(h.style.position="absolute",h.style.marginLeft="-1em",h.style.paddingRight="0.5em",e[o].insertBefore(h,e[o].firstChild)):(h.style.paddingLeft="0.375em",e[o].appendChild(h))}for(o=0;o<d.length;o++)e.splice(d[o]-o,1);return this.elements=this.elements.concat(e),this},this.remove=function(A){for(var e,t,i=p(A),n=0;n<i.length;n++)(t=i[n].querySelector(".anchorjs-link"))&&(-1!==(e=this.elements.indexOf(i[n]))&&this.elements.splice(e,1),i[n].removeChild(t));return this},this.removeAll=function(){this.remove(this.elements)},this.urlify=function(A){return this.options.truncate||f(this.options),A.trim().replace(/\'/gi,"").replace(/[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\\n\t\b\v]/g,"-").replace(/-{2,}/g,"-").substring(0,this.options.truncate).replace(/^-+|-+$/gm,"").toLowerCase()},this.hasAnchorJSLink=function(A){var e=A.firstChild&&-1<(" "+A.firstChild.className+" ").indexOf(" anchorjs-link "),t=A.lastChild&&-1<(" "+A.lastChild.className+" ").indexOf(" anchorjs-link ");return e||t||!1}}});
65
+ // @license-end
66
+ </script>
67
+ <script>
68
+ anchors.options = {
69
+ placement: 'left'
70
+ };
71
+ anchors.add('h1, h2, h3, h4');
72
+ </script>
@@ -1,4 +1,4 @@
1
- require_relative "gbbaseconvert"
1
+ require_relative "base_convert"
2
2
  require "isodoc"
3
3
 
4
4
  module IsoDoc
@@ -54,7 +54,7 @@ module IsoDoc
54
54
 
55
55
  def annex_name(annex, name, div)
56
56
  div.h1 **{ class: "Annex" } do |t|
57
- t << "#{anchor(annex['id'], :label)}<br/><br/>"
57
+ t << "#{@xrefs.anchor(annex['id'], :label)}<br/><br/>"
58
58
  t.b do |b|
59
59
  name&.children&.each { |c2| parse(c2, b) }
60
60
  end
@@ -90,8 +90,8 @@ module IsoDoc
90
90
  "95": "obsolete",
91
91
  }
92
92
 
93
- def status_abbrev_cn(stage, _substage, iter, draft)
94
- return status_abbrev(stage, _substage, iter, draft) if @lang != "zh"
93
+ def status_abbrev_cn(stage, _substage, iter, draft, doctype)
94
+ return status_abbrev(stage, _substage, iter, draft, doctype) if @lang != "zh"
95
95
  stage_num = stage == "PRF" ? "60" :
96
96
  (Asciidoctor::Gb::Converter::STAGE_ABBRS&.invert[stage]&.to_s || "??")
97
97
  stage = STAGE_ABBRS_CN[stage_num.to_sym] || "??"
@@ -109,7 +109,8 @@ module IsoDoc
109
109
  set(:statusabbr, status_abbrev_cn(docstatus["abbreviation"],
110
110
  isoxml&.at(ns("//bibdata/status/substage"))&.text,
111
111
  isoxml&.at(ns("//bibdata/status/iteration"))&.text,
112
- isoxml&.at(ns("//version/draft"))&.text))
112
+ isoxml&.at(ns("//version/draft"))&.text,
113
+ isoxml&.at(ns("//bibdata/ext/doctype"))&.text))
113
114
  set(:status, STATUS_CSS[docstatus.text.to_sym])
114
115
  unpublished(docstatus.text) and
115
116
  set(:stageabbr, docstatus["abbreviation"])
@@ -0,0 +1,21 @@
1
+ require "isodoc"
2
+
3
+ module IsoDoc
4
+ module Gb
5
+
6
+ # A {Converter} implementation that generates HTML output, and a document
7
+ # schema encapsulation of the document for validation
8
+ #
9
+ class PdfConvert < IsoDoc::XslfoPdfConvert
10
+ def initialize(options)
11
+ @libdir = File.dirname(__FILE__)
12
+ super
13
+ end
14
+
15
+ def pdf_stylesheet(docxml)
16
+ "gb.recommendation.xsl"
17
+ end
18
+ end
19
+ end
20
+ end
21
+
@@ -0,0 +1,10 @@
1
+ require_relative "base_convert"
2
+ require "isodoc"
3
+
4
+ module IsoDoc
5
+ module Gb
6
+ class PresentationXMLConvert < IsoDoc::Iso::PresentationXMLConvert
7
+ end
8
+ end
9
+ end
10
+
@@ -1,4 +1,4 @@
1
- require_relative "gbbaseconvert"
1
+ require_relative "base_convert"
2
2
  require "isodoc"
3
3
 
4
4
  module IsoDoc
@@ -84,7 +84,7 @@ module IsoDoc
84
84
 
85
85
  def annex_name(annex, name, div)
86
86
  div.h1 **{ class: "Annex" } do |t|
87
- t << "#{anchor(annex['id'], :label)}<br/><br/>"
87
+ t << "#{@xrefs.anchor(annex['id'], :label)}<br/><br/>"
88
88
  name&.children&.each { |c2| parse(c2, t) }
89
89
  end
90
90
  end
@@ -1,9 +1,10 @@
1
1
  require "asciidoctor" unless defined? Asciidoctor::Converter
2
2
  require_relative "asciidoctor/gb/converter"
3
3
  require_relative "metanorma/gb/version"
4
- require "isodoc/gb/gbconvert"
5
- require "isodoc/gb/gbhtmlconvert"
6
- require "isodoc/gb/gbwordconvert"
4
+ require "isodoc/gb/common"
5
+ require "isodoc/gb/html_convert"
6
+ require "isodoc/gb/word_convert"
7
+ require "isodoc/gb/pdf_convert"
7
8
 
8
9
  if defined? Metanorma
9
10
  require_relative "metanorma/gb"
@@ -2,6 +2,15 @@ require "metanorma/processor"
2
2
 
3
3
  module Metanorma
4
4
  module Gb
5
+ def self.fonts_used
6
+ {
7
+ compliant_html: ["SimSun", "Cambria", "SimHei", "Calibri", "Courier New"],
8
+ html: ["SimSun", "Cambria", "SimHei", "Calibri", "Courier New"],
9
+ doc: ["SimSun", "Cambria", "SimHei", "Calibri", "Courier New"],
10
+ pdf: ["SimSun", "Cambria", "SimHei", "Calibri", "Courier New"],
11
+ }
12
+ end
13
+
5
14
  class Processor < Metanorma::Processor
6
15
 
7
16
  def initialize
@@ -14,7 +23,8 @@ module Metanorma
14
23
  super.merge(
15
24
  html: "html",
16
25
  compliant_html: "compliant.html",
17
- doc: "doc"
26
+ doc: "doc",
27
+ pdf: "pdf",
18
28
  )
19
29
  end
20
30
 
@@ -41,14 +51,23 @@ module Metanorma
41
51
  super.merge(new_options)
42
52
  end
43
53
 
44
- def output(isodoc_node, outname, format, options={})
54
+ def use_presentation_xml(ext)
55
+ return true if ext == :compliant_html
56
+ super
57
+ end
58
+
59
+ def output(isodoc_node, inname, outname, format, options={})
45
60
  case format
46
61
  when :html
47
- IsoDoc::Gb::HtmlConvert.new(options).convert(outname, isodoc_node)
62
+ IsoDoc::Gb::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
48
63
  when :compliant_html
49
- IsoDoc::Gb::HtmlConvert.new(options.merge(compliant: true)).convert(outname, isodoc_node)
64
+ IsoDoc::Gb::HtmlConvert.new(options.merge(compliant: true)).convert(inname, isodoc_node, nil, outname)
50
65
  when :doc
51
- IsoDoc::Gb::WordConvert.new(options).convert(outname, isodoc_node)
66
+ IsoDoc::Gb::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
67
+ when :pdf
68
+ IsoDoc::Gb::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
69
+ when :presentation
70
+ IsoDoc::Gb::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
52
71
  else
53
72
  super
54
73
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Gb
3
- VERSION = "1.3.23"
3
+ VERSION = "1.4.0"
4
4
  end
5
5
  end
@@ -29,8 +29,8 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ["lib"]
30
30
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
31
31
 
32
- spec.add_dependency "metanorma-iso", "~> 1.3.0"
33
- spec.add_dependency "isodoc", "~> 1.0.0"
32
+ spec.add_dependency "metanorma-iso", "~> 1.4.0"
33
+ spec.add_dependency "isodoc", "~> 1.1.0"
34
34
  spec.add_dependency "twitter_cldr", "~> 4.4.4"
35
35
  spec.add_dependency "gb-agencies", "~> 0.0.4"
36
36
  spec.add_dependency "htmlentities", "~> 4.3.4"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-gb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.23
4
+ version: 1.4.0
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-05-13 00:00:00.000000000 Z
11
+ date: 2020-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.3.0
19
+ version: 1.4.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.3.0
26
+ version: 1.4.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: isodoc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.0
33
+ version: 1.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.0.0
40
+ version: 1.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: twitter_cldr
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -255,17 +255,17 @@ files:
255
255
  - lib/asciidoctor/gb/boilerplate.xml
256
256
  - lib/asciidoctor/gb/converter.rb
257
257
  - lib/asciidoctor/gb/front.rb
258
+ - lib/asciidoctor/gb/front_id.rb
258
259
  - lib/asciidoctor/gb/gbstandard.rng
259
260
  - lib/asciidoctor/gb/isodoc.rng
260
261
  - lib/asciidoctor/gb/isostandard.rng
261
262
  - lib/asciidoctor/gb/reqt.rng
262
263
  - lib/asciidoctor/gb/section_input.rb
263
264
  - lib/asciidoctor/gb/validate.rb
264
- - lib/isodoc/gb/gbbaseconvert.rb
265
- - lib/isodoc/gb/gbcleanup.rb
266
- - lib/isodoc/gb/gbconvert.rb
267
- - lib/isodoc/gb/gbhtmlconvert.rb
268
- - lib/isodoc/gb/gbwordconvert.rb
265
+ - lib/isodoc/gb/base_convert.rb
266
+ - lib/isodoc/gb/cleanup.rb
267
+ - lib/isodoc/gb/common.rb
268
+ - lib/isodoc/gb/gb.recommendation.xsl
269
269
  - lib/isodoc/gb/html/_coverpage.scss
270
270
  - lib/isodoc/gb/html/blank.png
271
271
  - lib/isodoc/gb/html/footer.png
@@ -302,9 +302,13 @@ files:
302
302
  - lib/isodoc/gb/html/word_gb_intro.html
303
303
  - lib/isodoc/gb/html/word_gb_titlepage.html
304
304
  - lib/isodoc/gb/html/wordstyle.scss
305
+ - lib/isodoc/gb/html_convert.rb
305
306
  - lib/isodoc/gb/i18n-en.yaml
306
307
  - lib/isodoc/gb/i18n-zh-Hans.yaml
307
308
  - lib/isodoc/gb/metadata.rb
309
+ - lib/isodoc/gb/pdf_convert.rb
310
+ - lib/isodoc/gb/presentation_xml_convert.rb
311
+ - lib/isodoc/gb/word_convert.rb
308
312
  - lib/metanorma-gb.rb
309
313
  - lib/metanorma/gb.rb
310
314
  - lib/metanorma/gb/processor.rb
@@ -314,7 +318,7 @@ homepage: https://github.com/metanorma/metanorma-gb
314
318
  licenses:
315
319
  - BSD-2-Clause
316
320
  metadata: {}
317
- post_install_message:
321
+ post_install_message:
318
322
  rdoc_options: []
319
323
  require_paths:
320
324
  - lib
@@ -329,9 +333,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
329
333
  - !ruby/object:Gem::Version
330
334
  version: '0'
331
335
  requirements: []
332
- rubyforge_project:
333
- rubygems_version: 2.7.6
334
- signing_key:
336
+ rubygems_version: 3.0.3
337
+ signing_key:
335
338
  specification_version: 4
336
339
  summary: metanorma-gb lets you write GB standards in AsciiDoc.
337
340
  test_files: []