metanorma 1.5.9 → 1.5.11

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: 750abd756dfc85ddfa96a07235adebf364acff4890a739c633236676e1a3ba56
4
- data.tar.gz: b96961b6393e03a8a335d8b43825d91558160debfa01129db5cb11caf1267fe0
3
+ metadata.gz: 56452832fb95047d0221a3720fba58e82b0d9766c5d29e3b1bacf42e703976ab
4
+ data.tar.gz: 162cf563a95b6a6ae6f096fcecf4734025a88d5fc50f4b18de8dae693fc986e0
5
5
  SHA512:
6
- metadata.gz: 4743db532984f95e08292907a38cb764fb44b5399e81d8be367f369dee973916edb29ae82fa36e0447327d197f3fcf1132cbd2e409e526bcfd1aa794e5dec572
7
- data.tar.gz: 127ded2eb3b81f5c88cf75a088031425763b3805da21bc7f851667201b039124523f5311357ed618d33b2eb29dba7cb608f76805bff64df163597173f9a3dc80
6
+ metadata.gz: c3276a5f4445b2776f86bb46beaf4c98d53155f44e2dfa2357b629a879aa36f3d1a621a7789136fac109a76729ca22e0520863d4ad4e5a05f8b3515633dc72ff
7
+ data.tar.gz: d42e2bbd2ecd3d79fcc7960664f1bfdee03661e78e65109a565e0b21adf9e5613be78eee0859e09b202ed2ce53a820901319150c4255516e2bc73554343d47fc
data/README.adoc CHANGED
@@ -19,235 +19,26 @@ Metanorma is composed of a number of specifications and software
19
19
  implementations. The Metanorma document model is based on the SecureDoc
20
20
  document model.
21
21
 
22
- Metanorma includes the following sub-projects:
23
-
24
- * The https://github.com/metanorma/metanorma-model-standoc[Metanorma Standard Document model]
25
-
26
- * IETF Internet-Drafts and RFCs: the https://datatracker.ietf.org/doc/draft-ribose-asciirfc/[AsciiRFC syntax],
27
- the https://github.com/metanorma/asciidoctor-rfc/[asciidoctor-rfc RFC XML v2 and v3 implementations]
28
-
29
- * ISO Standards: the AsciiISO syntax,
30
- the https://github.com/metanorma/metanorma-model-iso/[Metanorma ISO model],
31
- the https://github.com/metanorma/metanorma-iso/[metanorma-iso IsoDoc implementation]
32
-
33
- * CalConnect Standard Documents (CSD): the AsciiCSD syntax,
34
- https://github.com/metanorma/metanorma-model-csd[Metanorma CSD model],
35
- the https://github.com/metanorma/metanorma-csd/[metanorma-csd implementation]
36
-
37
- * Chinese GuoBiao (GB) Standards: the AsciiGB syntax,
38
- https://github.com/metanorma/metanorma-model-gb[Metanorma GB models, for Chinese standards],
39
- the https://github.com/metanorma/metanorma-gb/[metanorma-gb implementation]
40
-
41
- * Cloud Security Alliance Normal Documents (CSAND): the AsciiCSAND syntax,
42
- https://github.com/metanorma/metanorma-model-csand[Metanorma CSAND model],
43
- the https://github.com/metanorma/metanorma-csand/[metanorma-csand implementation]
44
-
45
- * M3AAWG Documents (M3D): the AsciiM3D syntax,
46
- https://github.com/metanorma/metanorma-model-m3d[Metanorma M3D model],
47
- the https://github.com/metanorma/metanorma-m3d/[metanorma-m3d implementation]
48
-
49
- * Ribose Specification Documents (RSD): AsciiRSD, RSD XML schema, and the https://github.com/metanorma/metanorma-rsd[metanorma-rsd implementation]
50
-
51
- * Mandatory Provident Fund Schemes Authority of Hong Kong Documents (MPFD): https://github.com/metanorma/metanorma-mpfd[metanorma-mpfd implementation] (still at proof-of-concept stage)
52
-
53
- * United Nations Economic Commision for Europe Documents (UNECE): https://github.com/metanorma/metanorma-unece[metanorma-unece implementation]
54
-
22
+ For more on Metanorma and who uses it, refer to https://www.metanorma.org[]
55
23
 
56
24
  == Installation on supported platforms
57
25
 
58
- === MacOS
59
-
60
- We recommend macOS users to directly run the Metanorma setup script
61
- located here:
62
- https://github.com/metanorma/metanorma-macos-setup
63
-
64
- This is a one-stop installation script that setups Ruby, Node
65
- and all necessary parts for running Metanorma.
66
-
67
- Alternatively, you can also use the Metanorma Docker container (see below).
68
-
69
- === Linux
70
-
71
- Please see: https://github.com/metanorma/metanorma-linux-setup
72
-
73
- Alternatively, you can also use the Metanorma Docker container (see below).
74
-
75
- === Docker: Windows and other platforms
76
-
77
- Please use the Metanorma Docker container: https://github.com/metanorma/metanorma-docker
78
-
79
-
80
- ////
81
- If you want to run Ubuntu on MacOS, you should do the following beforehand:
82
-
83
- [source,sh]
84
- ----
85
- # Setup docker through dinghy on MacOS:
86
- brew tap codekitchen/dinghy
87
- brew install dinghy
88
- brew install docker docker-machine
89
- dinghy create --provider virtualbox
90
-
91
- # Run the Ubuntu container:
92
- dinghy up
93
- eval $(dinghy env)
94
- docker run -it ubuntu:18.10 bash
95
- ----
96
- ////
26
+ See https://www.metanorma.org/install/[]
97
27
 
98
28
  === Installing individual components
99
29
 
100
- The Metanorma workflow can be utilized via the `metanorma` Ruby gem.
30
+ The Metanorma workflow can be utilized via the `metanorma-cli` Ruby gem.
101
31
 
102
32
  [source,sh]
103
33
  ----
104
34
  gem install metanorma-cli
105
35
  ----
106
36
 
107
- If you are going to generate PDFs from HTML (which applies to CSD), you will also need to install
108
- the node library https://github.com/GoogleChrome/puppeteer:
109
-
110
- * Install Node, with at least version 7.6.0: https://nodejs.org/en/download/,
111
- https://nodejs.org/en/download/package-manager/ . (For macOS, `brew install node`)
112
- * Install npm: https://docs.npmjs.com/getting-started/installing-node
113
- * Install puppeteer: `npm install -g --save --save-exact puppeteer`
114
-
115
-
116
37
  == Usage
117
38
 
118
- Help command:
119
-
120
- [source,sh]
121
- ----
122
- $ metanorma -h
123
- Usage: metanorma [options] <file>
124
- -t, --type TYPE Type of standard to generate: rfc2, rfc3, iso, gb, csd, csand, m3d
125
- -x, --extensions EXT1,EXT2,... | all Type of extension to generate per type:
126
- {
127
- :rfc2=>{:xmlrfc=>"v2.xml"},
128
- :rfc3=>{:xmlrfc=>"v3.xml"},
129
- :iso=>{:html=>"html", :html_alt=>"alt.html", :doc=>"doc"},
130
- :gb=>{:html=>"html", :compliant_html => "compliant_html", :doc=>"doc"},
131
- :csd=>{:html=>"html", :pdf=>"pdf", :doc => "doc"},
132
- :csand=>{:html=>"html"},
133
- :m3d=>{:html=>"html", :doc=>"doc", :pdf => "pdf"},
134
- :rsd=>{:html=>"html", :doc=>"doc", :pdf => "pdf"}
135
- :acme=>{:html=>"html", :doc=>"doc", :pdf => "pdf"}
136
- :mpdf=>{:html=>"html", :doc=>"doc", :pdf => "pdf"}
137
- :unece=>{:html=>"html", :doc=>"doc"}
138
- }
139
- In addition, xml (outside of rfc2, rfc3) generates IsoDoc XML. If the argument is "all" or the option is
140
- missing, all available extensions are generated.
141
- -f, --format FORMAT Format of source file: asciidoc (current default, only format supported)
142
- -r, --require LIBRARY Require LIBRARY prior to execution
143
- -w, --wrapper Create wrapper folder for HTML output
144
- -d, --data-uri-image Encode HTML output images as data URIs
145
- -a, --asciimath Preserve AsciiMath in Metanorma XML, instead of transforming it into MathML
146
- -R, --relaton FILENAME Export Relaton XML (bibdata) for this document to FILENAME
147
- (Also triggered through -x rxl)
148
- -e, --extract DIR(,ASSET1,ASSET2...) Extract assets from this document to directory DIR. If ASSET1,ASSET2 are named, only those types of asset are extracted.
149
- -h, --help Show this message
150
- ----
151
-
152
- Basically it is used like this:
153
-
154
- [source,sh]
155
- ----
156
- $ metanorma --type <chosen-type> [--format input-format] [--extensions EXT1,EXT2...] iso-my-standard-document.adoc
157
- ----
158
-
159
- Options:
160
-
161
- `type`:: (mandatory, specified via `--type` or `-t`) takes one of the following types:
162
- `rfc2`, `rfc3`, `iso`, `gb`, `csd`, `csand`, `m3d`, `rsd`. Each of these corresponds to a
163
- standards class and a Metanorma gem; the list of standards classes supported by the script
164
- by default will grow (see also `require`).
165
-
166
- `extension`:: (optional) specifies the output formats to be generated. If not specified,
167
- all possible output formats are generated. The output formats generated are constrained by
168
- what has been defined for each standard type. All standards can generate Metanorma XML (`xml`),
169
- and at least one of HTML (`html`), DOC (`doc`), PDF (`pdf`). Some standards generate alternative
170
- HTML renderings (e.g. `html_alt` for ISO).
171
-
172
- `wrapper`:: create a separate folder for each instance of HTML output generated; the folder is named
173
- the same as the output file, without the `.html` suffix. Used to make distribution of HTML outputs
174
- more straightforward.
175
-
176
- `datauriimage`:: Encode all images as data URIs.
177
-
178
- `relaton`:: exports the bibdata Relaton XML description of the document (which is part of its Metanorma XML)
179
- to the nominated directory. The filename is the document identifier, if present, else the document filename.
180
-
181
- `asciimath`:: Preserve AsciiMath in Metanorma XML, instead of transforming it into MathML (which is the default).
182
-
183
- `extract`:: export assets found in the document to the nominated directory. If no other arguments are given,
184
- then all asset classes are exported, each to its own subdirectory. If trailing arguments are given, they
185
- are taken as naming which asset classes to extract from the document. Three asset classes are recognised:
186
- `sourcecode`, `image`, and `requirement` (which includes `recommendation` and `permission` elements).
187
- The assets are given autonumbered names, unless they were given a `filename` attribute in the source
188
- Metanorma XML, which is used instead.
189
-
190
- `format`:: (optional, specified via `--format` or `-f`) only accepts `asciidoc` for now,
191
- defaults to `asciidoc`
192
-
193
- As the `--format` argument is (currently) optional, so:
194
-
195
- [source,sh]
196
- ----
197
- $ metanorma --type iso -x html iso-my-standard-document.adoc
198
- ----
199
-
200
- `require`:: If you wish to use metanorma with a document class which has not been included in the types recognised
201
- by the metanorma script, you will need to name the corresponding Metnorma gem explicitly with the `-r`
202
- option; e.g.
203
-
204
- [source,sh]
205
- ----
206
- $ metanorma -t mpfd mpfd-bpn.adoc
207
-
208
- [metanorma] Error: mpfd is not a supported standard type.
209
-
210
- $ metanorma -t mpfd -r metanorma-mpfd mpfd-bpn.adoc
211
- ----
212
-
213
- The `asciimath`, `type`, `extension` and `relaton` options can be omitted if the corresponding metanorma directives
214
- are included in the document as Metanorma directives; for Asciidoctor input, these take the form
215
- of document attributes `mn-keep-asciimath:`, `mn-document-class:`, `:mn-output-extensions:`
216
- and `:mn-relaton-output-file:`, e.g.
217
-
218
- [source,asciidoctor]
219
- ----
220
- = My ISO document
221
- :mn-keep-asciimath:
222
- :mn-document-class: iso
223
- :mn-output-extensions: html,xml,pdf
224
- :mn-relaton-output-file: test.xml
225
-
226
- .Foreword
227
- ----
228
-
229
- Metanorma can also be invoked within Ruby, through the metanorma gem:
230
-
231
- [source,asciidoctor]
232
- ----
233
- require "metanorma"
234
-
235
- Metanorma::Compile.new().compile(filename, options)
236
- ----
237
-
238
- The options hash has the same structure it does when invoked in metanorma-cli:
239
-
240
- `:type`:: one of `"iso"`, `"csd"`, `"rsd"`, etc. (mandatory)
241
- `:format`:: `:asciidoc` is only value currently allowed
242
- `:extension_keys`:: array of symbols: `:all`, `:xml`:, `:doc` etc.
243
- `:wrapper`: true/false
244
- `:datauriimage`: true/false
245
- `:asciimath`: true/false
246
- `:require`: array of libraries to require
247
- `:relaton`: exports the bibdata Relaton XML description of the document (which is part of its Metanorma XML)
248
- to the nominated directory
39
+ Refer to https://www.metanorma.org/install/man/[Metanorma man page] and https://www.metanorma.org/install/usage/[Metanorma usage]
249
40
 
250
- == Threaded execution
41
+ === Threaded execution
251
42
 
252
43
  Metanorma has threaded execution, to generate output documents from the same Presentation XML input more quickly.
253
44
  Similar to https://github.com/relaton/relaton[relaton], the `METANORMA_PARALLEL` environment variable
@@ -129,7 +129,7 @@ module Metanorma
129
129
  end
130
130
 
131
131
  def svgmap_resolve(docxml)
132
- isodoc = IsoDoc::Convert.new({})
132
+ isodoc = IsoDoc::PresentationXMLConvert.new({})
133
133
  isodoc.bibitem_lookup(docxml)
134
134
  docxml.xpath(ns("//svgmap//eref")).each do |e|
135
135
  svgmap_resolve1(e, isodoc)
@@ -33,7 +33,6 @@ module Metanorma
33
33
  (file, isodoc = process_input(filename, options)) or return nil
34
34
  relaton_export(isodoc, options)
35
35
  extract(isodoc, options[:extract], options[:extract_type])
36
- font_install(options)
37
36
  process_exts(filename, extensions, file, isodoc, options)
38
37
  end
39
38
 
@@ -103,10 +102,22 @@ module Metanorma
103
102
  presentationxml: f.sub(/\.[^.]+$/, ".presentation.xml") }
104
103
  @queue = ::Metanorma::WorkersPool
105
104
  .new(ENV["METANORMA_PARALLEL"]&.to_i || 3)
105
+ gather_and_install_fonts(file, options.dup, extensions)
106
+ process_exts_run(fnames, file, isodoc, extensions, options)
107
+ @queue.shutdown
108
+ end
109
+
110
+ def process_exts_run(fnames, file, isodoc, extensions, options)
106
111
  Util.sort_extensions_execution(extensions).each do |ext|
107
112
  process_ext(ext, file, isodoc, fnames, options)
108
113
  end
109
- @queue.shutdown
114
+ end
115
+
116
+ def gather_and_install_fonts(file, options, extensions)
117
+ Util.sort_extensions_execution(extensions).each do |ext|
118
+ isodoc_options = get_isodoc_options(file, options, ext)
119
+ font_install(isodoc_options.merge(options))
120
+ end
110
121
  end
111
122
 
112
123
  def process_ext(ext, file, isodoc, fnames, options)
@@ -59,9 +59,16 @@ module Metanorma
59
59
  return if !opt[:fonts] ||
60
60
  opt[:fontlicenseagreement] == "continue-without-fonts"
61
61
 
62
+ @font_overrides ||= []
63
+ font_install_override(opt)
64
+ end
65
+
66
+ def font_install_override(opt)
62
67
  confirm = opt[:fontlicenseagreement] == "no-install-fonts" ? "no" : "yes"
63
68
  CSV.parse_line(opt[:fonts], col_sep: ";").map(&:strip).each do |f|
69
+ @font_overrides.include?(f) and next
64
70
  Fontist::Font.install(f, confirmation: confirm)
71
+ @font_overrides << f
65
72
  end
66
73
  end
67
74
 
@@ -7,8 +7,7 @@ module Metanorma
7
7
  require "asciidoctor"
8
8
  out_opts = {
9
9
  to_file: false, safe: :safe, backend: type, header_footer: true,
10
- attributes: ["nodoc", "stem", "xrefstyle=short",
11
- "docfile=#{filename}",
10
+ attributes: ["nodoc", "stem", "docfile=#{filename}",
12
11
  "output_dir=#{options[:output_dir]}"]
13
12
  }
14
13
  unless asciidoctor_validate(file, filename, out_opts)
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "1.5.9".freeze
2
+ VERSION = "1.5.11".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.9
4
+ version: 1.5.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-25 00:00:00.000000000 Z
11
+ date: 2023-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor