metanorma-iho 0.0.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +0 -1
- data/.github/workflows/ubuntu.yml +6 -3
- data/.github/workflows/windows.yml +0 -1
- data/Rakefile +2 -0
- data/lib/asciidoctor/iho/biblio.rng +14 -4
- data/lib/asciidoctor/iho/converter.rb +13 -2
- data/lib/asciidoctor/iho/iho.rng +2 -2
- data/lib/asciidoctor/iho/isodoc.rng +456 -7
- data/lib/asciidoctor/iho/reqt.rng +23 -0
- data/lib/isodoc/iho/base_convert.rb +0 -54
- data/lib/isodoc/iho/html/htmlstyle.css +1007 -0
- data/lib/isodoc/iho/html/iho.css +798 -0
- data/lib/isodoc/iho/html/iho.scss +0 -1
- data/lib/isodoc/iho/html/wordstyle.css +1252 -0
- data/lib/isodoc/iho/html/wordstyle.scss +0 -1
- data/lib/isodoc/iho/html_convert.rb +13 -12
- data/lib/isodoc/iho/iho.specification.xsl +3501 -0
- data/lib/isodoc/iho/iho.standard.xsl +3501 -0
- data/lib/isodoc/iho/init.rb +23 -0
- data/lib/isodoc/iho/pdf_convert.rb +5 -13
- data/lib/isodoc/iho/presentation_xml_convert.rb +12 -0
- data/lib/isodoc/iho/word_convert.rb +2 -1
- data/lib/isodoc/iho/xref.rb +64 -0
- data/lib/metanorma-iho.rb +1 -0
- data/lib/metanorma/iho/processor.rb +10 -4
- data/lib/metanorma/iho/version.rb +1 -1
- data/metanorma-iho.gemspec +4 -3
- metadata +34 -13
@@ -0,0 +1,23 @@
|
|
1
|
+
require "isodoc"
|
2
|
+
require_relative "metadata"
|
3
|
+
require_relative "xref"
|
4
|
+
|
5
|
+
module IsoDoc
|
6
|
+
module IHO
|
7
|
+
module Init
|
8
|
+
def metadata_init(lang, script, labels)
|
9
|
+
@meta = Metadata.new(lang, script, labels)
|
10
|
+
end
|
11
|
+
|
12
|
+
def xref_init(lang, script, klass, labels, options)
|
13
|
+
html = HtmlConvert.new(language: lang, script: script)
|
14
|
+
@xrefs = Xref.new(lang, script, html, labels, options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def i18n_init(lang, script, i18nyaml = nil)
|
18
|
+
@i18n = I18n.new(lang, script, i18nyaml || @i18nyaml)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require "isodoc"
|
2
|
-
require "isodoc/iho/metadata"
|
3
2
|
|
4
3
|
module IsoDoc
|
5
4
|
module IHO
|
@@ -11,19 +10,12 @@ module IsoDoc
|
|
11
10
|
super
|
12
11
|
end
|
13
12
|
|
14
|
-
def
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f|
|
20
|
-
f.write file
|
21
|
-
f.path
|
13
|
+
def pdf_stylesheet(docxml)
|
14
|
+
case doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
|
15
|
+
when "standard" then "iho.standard.xsl"
|
16
|
+
else
|
17
|
+
"iho.specification.xsl"
|
22
18
|
end
|
23
|
-
FileUtils.rm_rf dir
|
24
|
-
::Metanorma::Output::XslfoPdf.new.convert(
|
25
|
-
filename, outname_html + ".pdf",
|
26
|
-
File.join(@libdir, "rsd.standard.xsl"))
|
27
19
|
end
|
28
20
|
end
|
29
21
|
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require "isodoc/generic/xref"
|
2
|
+
|
3
|
+
module IsoDoc
|
4
|
+
module IHO
|
5
|
+
class Xref < IsoDoc::Generic::Xref
|
6
|
+
def annex_name_lbl(clause, num)
|
7
|
+
lbl = clause["obligation"] == "informative" ?
|
8
|
+
@labels["appendix"] : @labels["annex"]
|
9
|
+
l10n("<strong>#{lbl} #{num}</strong>")
|
10
|
+
end
|
11
|
+
|
12
|
+
def annex_names(clause, num)
|
13
|
+
appendix_names(clause, num)
|
14
|
+
lbl = clause["obligation"] == "informative" ?
|
15
|
+
@labels["appendix"] : @labels["annex"]
|
16
|
+
@anchors[clause["id"]] =
|
17
|
+
{ label: annex_name_lbl(clause, num), type: "clause",
|
18
|
+
xref: "#{lbl} #{num}", level: 1 }
|
19
|
+
if a = single_annex_special_section(clause)
|
20
|
+
annex_names1(a, "#{num}", 1)
|
21
|
+
else
|
22
|
+
clause.xpath(ns("./clause | ./references | ./terms | ./definitions")).
|
23
|
+
each_with_index do |c, i|
|
24
|
+
annex_names1(c, "#{num}.#{i + 1}", 2)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
hierarchical_asset_names(clause, num)
|
28
|
+
end
|
29
|
+
|
30
|
+
def back_anchor_names(docxml)
|
31
|
+
super
|
32
|
+
docxml.xpath(ns("//annex[@obligation = 'informative']")).
|
33
|
+
each_with_index do |c, i|
|
34
|
+
annex_names(c, i + 1)
|
35
|
+
end
|
36
|
+
docxml.xpath(ns("//annex[not(@obligation = 'informative')]")).
|
37
|
+
each_with_index do |c, i|
|
38
|
+
annex_names(c, (65 + i + (i > 7 ? 1 : 0)).chr.to_s)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def annex_names1(clause, num, level)
|
43
|
+
lbl = clause.at("./ancestor::xmlns:annex/@obligation").
|
44
|
+
text == "informative" ? @labels["appendix"] : @labels["annex"]
|
45
|
+
@anchors[clause["id"]] =
|
46
|
+
{ label: num, xref: "#{lbl} #{num}",
|
47
|
+
level: level, type: "clause" }
|
48
|
+
clause.xpath(ns("./clause | ./references | ./terms | ./definitions")).
|
49
|
+
each_with_index do |c, i|
|
50
|
+
annex_names1(c, "#{num}.#{i + 1}", level + 1)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def appendix_names(clause, num)
|
55
|
+
clause.xpath(ns("./appendix")).each_with_index do |c, i|
|
56
|
+
@anchors[c["id"]] =
|
57
|
+
anchor_struct(i + 1, nil, @labels["appendix"], "clause")
|
58
|
+
@anchors[c["id"]][:level] = 2
|
59
|
+
@anchors[c["id"]][:container] = clause["id"]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/lib/metanorma-iho.rb
CHANGED
@@ -4,6 +4,7 @@ require_relative "isodoc/iho/base_convert"
|
|
4
4
|
require_relative "isodoc/iho/html_convert"
|
5
5
|
require_relative "isodoc/iho/word_convert"
|
6
6
|
require_relative "isodoc/iho/pdf_convert"
|
7
|
+
require_relative "isodoc/iho/presentation_xml_convert"
|
7
8
|
require_relative "metanorma/iho/version"
|
8
9
|
|
9
10
|
if defined? Metanorma
|
@@ -6,6 +6,7 @@ module Metanorma
|
|
6
6
|
{
|
7
7
|
html: ["SourceSansPro-Light", "SourceSerifPro", "SourceCodePro-Light", "HanSans"],
|
8
8
|
doc: ["SourceSansPro-Light", "SourceSerifPro", "SourceCodePro-Light", "HanSans"],
|
9
|
+
pdf: ["SourceSansPro-Light", "SourceSerifPro", "SourceCodePro-Light", "HanSans"],
|
9
10
|
}
|
10
11
|
end
|
11
12
|
|
@@ -18,19 +19,24 @@ module Metanorma
|
|
18
19
|
super.merge(
|
19
20
|
html: "html",
|
20
21
|
doc: "doc",
|
21
|
-
|
22
|
+
pdf: "pdf",
|
23
|
+
)
|
22
24
|
end
|
23
25
|
|
24
26
|
def version
|
25
27
|
"Metanorma::IHO #{Metanorma::IHO::VERSION}"
|
26
28
|
end
|
27
29
|
|
28
|
-
def output(isodoc_node, outname, format, options={})
|
30
|
+
def output(isodoc_node, inname, outname, format, options={})
|
29
31
|
case format
|
30
32
|
when :html
|
31
|
-
IsoDoc::IHO::HtmlConvert.new(options).convert(
|
33
|
+
IsoDoc::IHO::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
32
34
|
when :doc
|
33
|
-
IsoDoc::IHO::WordConvert.new(options).convert(
|
35
|
+
IsoDoc::IHO::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
36
|
+
when :pdf
|
37
|
+
IsoDoc::IHO::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
38
|
+
when :presentation
|
39
|
+
IsoDoc::IHO::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
34
40
|
else
|
35
41
|
super
|
36
42
|
end
|
data/metanorma-iho.gemspec
CHANGED
@@ -27,11 +27,12 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
28
28
|
|
29
29
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
30
|
-
spec.add_dependency "metanorma-standoc", "~> 1.
|
31
|
-
spec.add_dependency "isodoc", "~> 1.
|
32
|
-
spec.add_dependency 'metanorma-generic', '~> 1.
|
30
|
+
spec.add_dependency "metanorma-standoc", "~> 1.5.0"
|
31
|
+
spec.add_dependency "isodoc", "~> 1.2.0"
|
32
|
+
spec.add_dependency 'metanorma-generic', '~> 1.6.0'
|
33
33
|
|
34
34
|
spec.add_development_dependency "byebug", "~> 9.1"
|
35
|
+
spec.add_development_dependency "sassc", "2.4.0"
|
35
36
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
36
37
|
spec.add_development_dependency "guard", "~> 2.14"
|
37
38
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-iho
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.2.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-
|
11
|
+
date: 2020-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|
@@ -30,42 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.5.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.
|
40
|
+
version: 1.5.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: isodoc
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.2.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.2.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: metanorma-generic
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.6.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 1.6.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: byebug
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '9.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: sassc
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.4.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.4.0
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: equivalent-xml
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -225,7 +239,9 @@ files:
|
|
225
239
|
- lib/isodoc/iho/html/header.html
|
226
240
|
- lib/isodoc/iho/html/html_iho_intro.html
|
227
241
|
- lib/isodoc/iho/html/html_iho_titlepage.html
|
242
|
+
- lib/isodoc/iho/html/htmlstyle.css
|
228
243
|
- lib/isodoc/iho/html/htmlstyle.scss
|
244
|
+
- lib/isodoc/iho/html/iho.css
|
229
245
|
- lib/isodoc/iho/html/iho.scss
|
230
246
|
- lib/isodoc/iho/html/image001.png
|
231
247
|
- lib/isodoc/iho/html/image002.png
|
@@ -235,11 +251,17 @@ files:
|
|
235
251
|
- lib/isodoc/iho/html/scripts.html
|
236
252
|
- lib/isodoc/iho/html/word_iho_intro.html
|
237
253
|
- lib/isodoc/iho/html/word_iho_titlepage.html
|
254
|
+
- lib/isodoc/iho/html/wordstyle.css
|
238
255
|
- lib/isodoc/iho/html/wordstyle.scss
|
239
256
|
- lib/isodoc/iho/html_convert.rb
|
257
|
+
- lib/isodoc/iho/iho.specification.xsl
|
258
|
+
- lib/isodoc/iho/iho.standard.xsl
|
259
|
+
- lib/isodoc/iho/init.rb
|
240
260
|
- lib/isodoc/iho/metadata.rb
|
241
261
|
- lib/isodoc/iho/pdf_convert.rb
|
262
|
+
- lib/isodoc/iho/presentation_xml_convert.rb
|
242
263
|
- lib/isodoc/iho/word_convert.rb
|
264
|
+
- lib/isodoc/iho/xref.rb
|
243
265
|
- lib/metanorma-iho.rb
|
244
266
|
- lib/metanorma/iho.rb
|
245
267
|
- lib/metanorma/iho/processor.rb
|
@@ -250,7 +272,7 @@ homepage: https://github.com/metanorma/metanorma-iho
|
|
250
272
|
licenses:
|
251
273
|
- BSD-2-Clause
|
252
274
|
metadata: {}
|
253
|
-
post_install_message:
|
275
|
+
post_install_message:
|
254
276
|
rdoc_options: []
|
255
277
|
require_paths:
|
256
278
|
- lib
|
@@ -265,9 +287,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
265
287
|
- !ruby/object:Gem::Version
|
266
288
|
version: '0'
|
267
289
|
requirements: []
|
268
|
-
|
269
|
-
|
270
|
-
signing_key:
|
290
|
+
rubygems_version: 3.0.3
|
291
|
+
signing_key:
|
271
292
|
specification_version: 4
|
272
293
|
summary: metanorma-iho lets you write IHO in AsciiDoc.
|
273
294
|
test_files: []
|