metanorma-generic 1.4.7 → 1.4.8

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: f9110146825a604b3cd6e40ae2f33ace4f1d6a1969ddc9ca478b9001b06ee3a1
4
- data.tar.gz: d958195686063ea45a0db177d1e854b406561412d3ba5473a97c56afd5c55ee0
3
+ metadata.gz: d23b72d227c475a3df05f0bb00d1cbcdc85a92e2bfbdf7f9cf25a936ae6438d5
4
+ data.tar.gz: 87bc5f53bbb881b078906165aed5dc420ff916c9a7111610c24ff9f0ce343fb8
5
5
  SHA512:
6
- metadata.gz: 4559ae6f318844ad9a9ce03ca66a12bddbfaf951ba33fdc1762c5eb1db66c6c6e2d75ea5063d44cc653c77d50175636237618d97b67d1b37e6de097c9214fd69
7
- data.tar.gz: e35ef1be4f2145df3436a97ad4b58221c99e03ecfb73018a3f6c7a342937f25822a2b2e647afb9437086fee317a79a440ef8f32c369dd10d68586e950dac5878
6
+ metadata.gz: 0c04db2c93abe52d82d17d19d726124d108a58f591c78d83ccfd93ef88739fbd15789ecaeffedc7e22ca8958e25cc19bb4f53c1fe38602047fe1b61275cefd58
7
+ data.tar.gz: 3899c5b73b13a660c446f057ac2224dba81474788983d86a4994bfe32a6c31719e494a083e446c5f90396249100f2f9df161c309ecac68f82939cbb15e97ef7a
@@ -31,7 +31,7 @@ module Asciidoctor
31
31
  xml.contributor do |c|
32
32
  c.role **{ type: "author" }
33
33
  c.organization do |a|
34
- a.name configuration.organization_name_short
34
+ a.name configuration.organization_name_long
35
35
  end
36
36
  end
37
37
  personal_author(node, xml)
@@ -41,7 +41,7 @@ module Asciidoctor
41
41
  xml.contributor do |c|
42
42
  c.role **{ type: "publisher" }
43
43
  c.organization do |a|
44
- a.name configuration.organization_name_short
44
+ a.name configuration.organization_name_long
45
45
  end
46
46
  end
47
47
  end
@@ -60,6 +60,15 @@ module Asciidoctor
60
60
  end
61
61
  end
62
62
 
63
+ def metadata_status(node, xml)
64
+ xml.status do |s|
65
+ s.stage ( node.attr("status") || node.attr("docstage") ||
66
+ configuration.default_stage || "published" )
67
+ x = node.attr("substage") and s.substage x
68
+ x = node.attr("iteration") and s.iteration x
69
+ end
70
+ end
71
+
63
72
  def docidentifier_cleanup(xmldoc)
64
73
  template = configuration.docid_template ||
65
74
  "{{ organization_name_short }} {{ docnumeric }}"
@@ -69,7 +78,8 @@ module Asciidoctor
69
78
  end
70
79
 
71
80
  def metadata_id(node, xml)
72
- xml.docidentifier do |i|
81
+ xml.docidentifier **{ type:
82
+ configuration.organization_name_short } do |i|
73
83
  i << "DUMMY"
74
84
  end
75
85
  xml.docnumber { |i| i << node.attr("docnumber") }
@@ -81,7 +91,7 @@ module Asciidoctor
81
91
  c.from from
82
92
  c.owner do |owner|
83
93
  owner.organization do |o|
84
- o.name configuration.organization_name_short
94
+ o.name configuration.organization_name_long
85
95
  end
86
96
  end
87
97
  end
@@ -94,31 +104,15 @@ module Asciidoctor
94
104
  end
95
105
  end
96
106
 
97
- =begin
98
- def makexml(node)
99
- #root_tag = configuration.xml_root_tag || XML_ROOT_TAG
100
- root_tag = XML_ROOT_TAG
101
- result = ["<?xml version='1.0' encoding='UTF-8'?>\n<#{root_tag}>"]
102
- @draft = node.attributes.has_key?("draft")
103
- result << noko { |ixml| front node, ixml }
104
- result << noko { |ixml| middle node, ixml }
105
- result << "</#{root_tag}>"
106
- result = textcleanup(result)
107
- ret1 = cleanup(Nokogiri::XML(result))
108
- validate(ret1) unless @novalid
109
- ret1.root.add_namespace(nil, configuration.document_namespace ||
110
- XML_NAMESPACE)
111
- ret1
112
- end
113
- =end
114
-
115
107
  def doctype(node)
116
108
  d = node.attr("doctype")
117
- unless %w{policy-and-procedures best-practices supporting-document
118
- report legal directives proposal standard}.include? d
109
+ configuration.doctypes or return d == "article" ? "standard" : d
110
+ default = configuration.default_doctype || Array(configuration.doctypes).dig(0) ||
111
+ "standard"
112
+ unless Array(configuration.doctypes).include? d
119
113
  @log.add("Document Attributes", nil,
120
- "#{d} is not a legal document type: reverting to 'standard'")
121
- d = "standard"
114
+ "#{d} is not a legal document type: reverting to '#{default}'")
115
+ d = default
122
116
  end
123
117
  d
124
118
  end
@@ -128,6 +122,20 @@ module Asciidoctor
128
122
  set_default_values_from_yaml_file(path_to_config_file)
129
123
  end
130
124
 
125
+ def sectiontype_streamline(ret)
126
+ if configuration.termsdefs_titles.map(&:downcase).include? (ret)
127
+ "terms and definitions"
128
+ elsif configuration.symbols_titles.map(&:downcase).include? (ret)
129
+ "symbols and abbreviated terms"
130
+ elsif configuration.normref_titles.map(&:downcase).include? (ret)
131
+ "normative references"
132
+ elsif configuration.bibliography_titles.map(&:downcase).include? (ret)
133
+ "bibliography"
134
+ else
135
+ ret
136
+ end
137
+ end
138
+
131
139
  def document(node)
132
140
  read_config_file(node.attr("customize")) if node.attr("customize")
133
141
  init(node)
@@ -153,6 +161,23 @@ module Asciidoctor
153
161
  File.join(File.dirname(__FILE__), "generic.rng"))
154
162
  end
155
163
 
164
+ def content_validate(doc)
165
+ super
166
+ bibdata_validate(doc.root)
167
+ end
168
+
169
+ def bibdata_validate(doc)
170
+ stage_validate(doc)
171
+ end
172
+
173
+ def stage_validate(xmldoc)
174
+ stages = configuration&.stage_abbreviations&.keys || return
175
+ stages.empty? and return
176
+ stage = xmldoc&.at("//bibdata/status/stage")&.text
177
+ stages.include? stage or
178
+ @log.add("Document Attributes", nil, "#{stage} is not a recognised status")
179
+ end
180
+
156
181
  def sections_cleanup(x)
157
182
  super
158
183
  x.xpath("//*[@inline-header]").each do |h|
@@ -129,6 +129,9 @@
129
129
  </choice>
130
130
  </attribute>
131
131
  </optional>
132
+ <attribute name="normative">
133
+ <data type="boolean"/>
134
+ </attribute>
132
135
  <optional>
133
136
  <ref name="section-title"/>
134
137
  </optional>
@@ -303,11 +306,11 @@
303
306
  <ref name="paragraph"/>
304
307
  </element>
305
308
  </define>
306
- <define name="TextElement" combine="choice">
307
- <ref name="concept"/>
308
- </define>
309
309
  </include>
310
310
  <!-- end overrides -->
311
+ <define name="TextElement" combine="choice">
312
+ <ref name="concept"/>
313
+ </define>
311
314
  <define name="concept">
312
315
  <element name="concept">
313
316
  <optional>
@@ -50,10 +50,8 @@ module IsoDoc
50
50
  end
51
51
 
52
52
  def googlefonts
53
- <<~HEAD.freeze
54
- <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
55
- <link href="https://fonts.googleapis.com/css?family=Overpass:300,300i,600,900" rel="stylesheet">
56
- HEAD
53
+ return unless configuration.webfont
54
+ Array(configuration.webfont).map { |x| %{<link href="#{x.gsub(/\&amp;/, '&')}" rel="stylesheet">} }.join("\n")
57
55
  end
58
56
 
59
57
  include BaseConvert
@@ -9,6 +9,9 @@ module IsoDoc
9
9
  here = File.dirname(__FILE__)
10
10
  default_logo_path = File.expand_path(File.join(here, "html", "logo.jpg"))
11
11
  set(:logo, baselocation(configuration.logo_path) || default_logo_path)
12
+ unless configuration.logo_paths.nil?
13
+ set(:logo_paths, Array(configuration.logo_paths).map { |p| baselocation(p) })
14
+ end
12
15
  end
13
16
 
14
17
  class << self
@@ -14,10 +14,14 @@ module Metanorma
14
14
  CONFIG_ATTRS = %i[
15
15
  organization_name_short
16
16
  organization_name_long
17
+ bibliography_titles
17
18
  document_namespace
18
19
  docid_template
20
+ doctypes
21
+ default_doctype
19
22
  i18nyaml
20
23
  logo_path
24
+ logo_paths
21
25
  header
22
26
  htmlcoverpage
23
27
  htmlintropage
@@ -26,12 +30,18 @@ module Metanorma
26
30
  html_headerfont
27
31
  html_monospacefont
28
32
  metadata_extensions
33
+ metanorma_name
34
+ normref_titles
29
35
  published_stages
36
+ default_stage
30
37
  stage_abbreviations
31
38
  scripts
32
39
  scripts_pdf
33
40
  standardstylesheet
41
+ symbols_titles
42
+ termsdefs_titles
34
43
  validate_rng_file
44
+ webfont
35
45
  wordcoverpage
36
46
  wordintropage
37
47
  wordstylesheet
@@ -59,6 +69,15 @@ module Metanorma
59
69
  self.organization_name_short ||= ORGANIZATION_NAME_SHORT
60
70
  self.organization_name_long ||= ORGANIZATION_NAME_LONG
61
71
  self.document_namespace ||= DOCUMENT_NAMESPACE
72
+ self.termsdefs_titles ||=
73
+ ["Terms and definitions", "Terms, definitions, symbols and abbreviated terms",
74
+ "Terms, definitions, symbols and abbreviations", "Terms, definitions and symbols",
75
+ "Terms, definitions and abbreviations", "Terms, definitions and abbreviated terms"]
76
+ self.symbols_titles ||=
77
+ ["Symbols and abbreviated terms", "Symbols", "Abbreviated terms", "Abbreviations"]
78
+ self.normref_titles ||=
79
+ ["Normative references"]
80
+ self.bibliography_titles ||= ["Bibliography"]
62
81
  end
63
82
 
64
83
  def set_default_values_from_yaml_file(config_file)
@@ -3,10 +3,14 @@ require "metanorma/processor"
3
3
  module Metanorma
4
4
  module Generic
5
5
  class Processor < Metanorma::Processor
6
+ def configuration
7
+ Metanorma::Generic.configuration
8
+ end
9
+
6
10
  def initialize
7
- @short = :generic
11
+ @short = configuration&.metanorma_name&.to_sym || :generic
8
12
  @input_format = :asciidoc
9
- @asciidoctor_backend = :generic
13
+ @asciidoctor_backend = configuration&.metanorma_name&.to_sym || :generic
10
14
  end
11
15
 
12
16
  def output_formats
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Generic
3
- VERSION = "1.4.7"
3
+ VERSION = "1.4.8"
4
4
  end
5
5
  end
@@ -1,12 +1,19 @@
1
+ metanorma_name: generic
1
2
  organization_name_short: My Organization
2
3
  organization_name_long: My Organization name
3
4
  document_namespace: https://open.ribose.com/standards/mine
4
5
  xml_root_tag: 'mine-standard'
5
6
  logo_path: /metanorma-mine/lib/isodoc/mine/html/logo.jpg
7
+ logo_paths:
8
+ - /metanorma-mine/lib/isodoc/mine/html/logo1.jpg
9
+ - /metanorma-mine/lib/isodoc/mine/html/logo2.jpg
6
10
  validate_rng_file: /metanorma-mine/lib/asciidoctor/mine/mine.rng
7
11
  htmlcoverpage: /metanorma-mine/lib/isodoc/mine/html/html_mine_titlepage.html
8
12
  htmlintropage: /metanorma-mine/lib/isodoc/mine/html/html_mine_intro.html
9
13
  htmlstylesheet: /metanorma-mine/lib/isodoc/mine/html/htmlstyle.scss
14
+ html_bodyfont: '"Source Sans Pro",sans-serif'
15
+ html_headerfont: '"Source Sans Pro",sans-serif'
16
+ html_monospacefont: '"Source Code Pro",monospace'
10
17
  scripts: /metanorma-mine/lib/isodoc/mine/html/scripts.html
11
18
  scripts_pdf: /metanorma-mine/lib/isodoc/mine/html/scripts.prd.html
12
19
  standardstylesheet: /metanorma-mine/lib/isodoc/mine/html/
@@ -14,8 +21,41 @@ header: /metanorma-mine/lib/isodoc/mine/html/header.html
14
21
  wordcoverpage: /metanorma-mine/lib/isodoc/mine/html/word_mine_titlepage.html
15
22
  wordintropage: /metanorma-mine/lib/isodoc/mine/html/word_mine_intro.html
16
23
  wordstylesheet: /metanorma-mine/lib/isodoc/mine/html/wordstyle.scss
24
+ word_bodyfont: '"Source Sans Pro","Arial",sans-serif'
25
+ word_headerfont: '"Source Sans Pro","Arial",sans-serif'
26
+ word_monospacefont: '"Source Code Pro",monospace'
17
27
  docid_template: "{{ organization_name_short }} {{ docnumeric }}"
18
28
  metadata_extensions:
19
29
  - security
20
30
  published_stages:
21
31
  - published
32
+ stage_abbreviations:
33
+ draft-proposal:
34
+ draft-development:
35
+ draft-testing:
36
+ draft-implementation:
37
+ in-force:
38
+ retired:
39
+ metadata_extensions:
40
+ - security
41
+ - recipient
42
+ doctypes:
43
+ - standard
44
+ - recommendation
45
+ default_doctype: standard
46
+ termsdefs_titles:
47
+ - Terms and definitions
48
+ - Terms, definitions, symbols and abbreviated terms
49
+ - Terms, definitions, symbols and abbreviations
50
+ - Terms, definitions and symbls
51
+ - Terms, definitions and abbreviations
52
+ - Terms, definitions and abbreviated terms
53
+ symbols_titles:
54
+ - Symbols and abbreviated terms
55
+ - Symbols
56
+ - Abbreviated terms
57
+ - Abbreviations
58
+ normref_titles:
59
+ - Normative references
60
+ bibliography_titles
61
+ - Bibliography
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-generic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.7
4
+ version: 1.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-01 00:00:00.000000000 Z
11
+ date: 2020-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities