metanorma-iso 1.10.0 → 1.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ubuntu.yml +41 -0
- data/Gemfile +3 -4
- data/Makefile +44 -0
- data/Rakefile +1 -1
- data/bin/rspec +1 -2
- data/lib/asciidoctor/iso/base.rb +1 -1
- data/lib/asciidoctor/iso/cleanup.rb +7 -6
- data/lib/asciidoctor/iso/front.rb +2 -2
- data/lib/asciidoctor/iso/isodoc.rng +68 -18
- data/lib/asciidoctor/iso/isostandard.rng +14 -0
- data/lib/asciidoctor/iso/section.rb +1 -1
- data/lib/asciidoctor/iso/validate.rb +1 -1
- data/lib/asciidoctor/iso/validate_section.rb +1 -1
- data/lib/isodoc/iso/html/isodoc.css +0 -1
- data/lib/isodoc/iso/html/isodoc.scss +0 -1
- data/lib/isodoc/iso/html/style-human.css +21 -1
- data/lib/isodoc/iso/html/style-human.scss +26 -1
- data/lib/isodoc/iso/html/style-iso.css +21 -1
- data/lib/isodoc/iso/html/style-iso.scss +26 -1
- data/lib/isodoc/iso/html_convert.rb +81 -22
- data/lib/isodoc/iso/i18n.rb +10 -9
- data/lib/isodoc/iso/iso.amendment.xsl +304 -118
- data/lib/isodoc/iso/iso.international-standard.xsl +304 -118
- data/lib/isodoc/iso/isosts_convert.rb +6 -2
- data/lib/isodoc/iso/presentation_xml_convert.rb +19 -9
- data/lib/isodoc/iso/sections.rb +2 -0
- data/lib/isodoc/iso/sts_convert.rb +5 -2
- data/lib/isodoc/iso/word_cleanup.rb +94 -0
- data/lib/isodoc/iso/word_convert.rb +12 -91
- data/lib/metanorma/iso/processor.rb +2 -2
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +3 -3
- data/spec/asciidoctor/base_spec.rb +543 -209
- data/spec/asciidoctor/blocks_spec.rb +4 -43
- data/spec/asciidoctor/cleanup_spec.rb +15 -12
- data/spec/asciidoctor/refs_spec.rb +174 -88
- data/spec/isodoc/i18n_spec.rb +32 -18
- data/spec/isodoc/inline_spec.rb +4 -4
- data/spec/isodoc/postproc_spec.rb +111 -28
- data/spec/isodoc/section_spec.rb +3 -3
- data/spec/isodoc/table_spec.rb +6 -8
- data/spec/isodoc/terms_spec.rb +30 -37
- data/spec/isodoc/xref_spec.rb +3 -3
- data/spec/metanorma/processor_spec.rb +110 -14
- data/spec/vcr_cassettes/docrels.yml +783 -0
- data/spec/vcr_cassettes/sortrefs.yml +599 -0
- metadata +12 -8
@@ -10,39 +10,98 @@ module IsoDoc
|
|
10
10
|
super
|
11
11
|
end
|
12
12
|
|
13
|
-
def googlefonts
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
def googlefonts
|
14
|
+
<<~HEAD.freeze
|
15
|
+
<link href="https://fonts.googleapis.com/css?family=Space+Mono:400,400i,700,700i&display=swap" rel="stylesheet">
|
16
|
+
<link href="https://fonts.googleapis.com/css?family=Lato:400,400i,700,900" rel="stylesheet">
|
17
|
+
HEAD
|
18
|
+
end
|
19
19
|
|
20
20
|
def default_fonts(options)
|
21
21
|
{
|
22
|
-
bodyfont: (options[:script] == "Hans"
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
bodyfont: (if options[:script] == "Hans"
|
23
|
+
'"Source Han Sans",serif'
|
24
|
+
else
|
25
|
+
options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif'
|
26
|
+
end),
|
27
|
+
headerfont: (if options[:script] == "Hans"
|
28
|
+
'"Source Han Sans",sans-serif'
|
29
|
+
else
|
30
|
+
options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif'
|
31
|
+
end),
|
32
|
+
monospacefont: (if options[:alt]
|
33
|
+
'"Space Mono",monospace'
|
34
|
+
else
|
35
|
+
'"Courier New",monospace'
|
36
|
+
end),
|
37
|
+
normalfontsize: "1.0em",
|
38
|
+
smallerfontsize: "0.9em",
|
39
|
+
footnotefontsize: "0.9em",
|
40
|
+
monospacefontsize: "0.8em",
|
32
41
|
}
|
33
42
|
end
|
34
43
|
|
35
44
|
def default_file_locations(options)
|
36
45
|
{
|
37
|
-
htmlstylesheet: (options[:alt]
|
38
|
-
|
39
|
-
|
40
|
-
|
46
|
+
htmlstylesheet: (if options[:alt]
|
47
|
+
html_doc_path("style-human.scss")
|
48
|
+
else
|
49
|
+
html_doc_path("style-iso.scss")
|
50
|
+
end),
|
51
|
+
htmlcoverpage: html_doc_path("html_iso_titlepage.html"),
|
52
|
+
htmlintropage: html_doc_path("html_iso_intro.html"),
|
41
53
|
}
|
42
54
|
end
|
43
55
|
|
44
|
-
def footnote_reference_format(
|
45
|
-
|
56
|
+
def footnote_reference_format(link)
|
57
|
+
link.content += ")"
|
58
|
+
end
|
59
|
+
|
60
|
+
def html_toc_entry(level, header)
|
61
|
+
if level == "h1" && header.parent.at(".//h2[not(@class = 'TermNum')]"\
|
62
|
+
"[not(@class = 'noTOC')][text()]")
|
63
|
+
<<~HDR
|
64
|
+
<li class="#{level}"><div class="collapse-group"><a href="##{header['id']}">#{header_strip(header)}</a></li>
|
65
|
+
<div class="collapse-button"></div></div>
|
66
|
+
HDR
|
67
|
+
else
|
68
|
+
%(<li class="#{level}"><a href="##{header['id']}">\
|
69
|
+
#{header_strip(header)}</a></li>)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def html_toc(docxml)
|
74
|
+
super
|
75
|
+
docxml.xpath("//div[@id = 'toc']/ul[li[@class = 'h2']]").each do |u|
|
76
|
+
html_toc1(u)
|
77
|
+
end
|
78
|
+
docxml
|
79
|
+
end
|
80
|
+
|
81
|
+
def html_toc1(ulist)
|
82
|
+
u2 = nil
|
83
|
+
ulist.xpath("./li").each do |l|
|
84
|
+
if l["class"] != "h2"
|
85
|
+
u2 = nil
|
86
|
+
elsif u2 then u2.add_child(l.remove)
|
87
|
+
else
|
88
|
+
u2 = l.replace("<ul class='content collapse'>#{l}</ul>").first
|
89
|
+
p = u2.previous_element and p << u2
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def inject_script(doc)
|
95
|
+
scr = <<~HEAD.freeze
|
96
|
+
<script>
|
97
|
+
$(".collapse-button").click(function () {
|
98
|
+
$(this).toggleClass('expand'); // expand: the class to change the collapse button shape
|
99
|
+
// collapse: the class to collapse/expand the li elements with the h2 class
|
100
|
+
$(this).closest('li').children(".content").toggleClass('collapse');})
|
101
|
+
</script>
|
102
|
+
HEAD
|
103
|
+
a = super.split(%r{</body>})
|
104
|
+
"#{a[0]}#{scr}</body>#{a[1]}"
|
46
105
|
end
|
47
106
|
|
48
107
|
def table_th_center(docxml)
|
data/lib/isodoc/iso/i18n.rb
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module Iso
|
3
3
|
class I18n < IsoDoc::I18n
|
4
|
+
def load_file(fname)
|
5
|
+
YAML.load_file(File.join(File.dirname(__FILE__), fname))
|
6
|
+
end
|
7
|
+
|
4
8
|
def load_yaml1(lang, script)
|
5
|
-
y = if lang == "en"
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
else
|
12
|
-
YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
|
13
|
-
end
|
9
|
+
y = if lang == "en" then load_file("i18n-en.yaml")
|
10
|
+
elsif lang == "fr" then load_file("i18n-fr.yaml")
|
11
|
+
elsif lang == "zh" && script == "Hans"
|
12
|
+
load_file("i18n-zh-Hans.yaml")
|
13
|
+
else load_file("i18n-en.yaml")
|
14
|
+
end
|
14
15
|
super.merge(y)
|
15
16
|
end
|
16
17
|
end
|