metanorma-standoc 2.7.4 → 2.7.5
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/Gemfile +2 -8
- data/lib/isodoc/html/htmlstyle.css +8 -0
- data/lib/metanorma/standoc/base.rb +9 -5
- data/lib/metanorma/standoc/basicdoc.rng +26 -17
- data/lib/metanorma/standoc/cleanup_toc.rb +3 -2
- data/lib/metanorma/standoc/front_contributor.rb +6 -1
- data/lib/metanorma/standoc/macros_inline.rb +24 -17
- data/lib/metanorma/standoc/render.rb +6 -4
- data/lib/metanorma/standoc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d3fc596438edd06d1a0bbfa6ca008e650e22e9230048259f4b0696bde8a1087
|
4
|
+
data.tar.gz: 3b5c3569a642d7da4b61cb98aa999a2ad526e4f43265489bd99fa59c659e5d48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 483f649b259da9b1a6b44736eb78979b3e06ad5ae29f666e0e2416ef3aa2193b22ea13b9aa14f2ac6b249020f6226f8912ab95cd2860458df767be62f6198127
|
7
|
+
data.tar.gz: ba5da0a5a7af09d8da8237fabeeb9bfe813e3d43d21295e04ea0b2f0bc9c0011d52a7da2c55df2a00fad8fe2568bd14e5e57b28fa761c0ed2535d72f0a22eeb4
|
data/Gemfile
CHANGED
@@ -4,12 +4,6 @@ Encoding.default_internal = Encoding::UTF_8
|
|
4
4
|
source "https://rubygems.org"
|
5
5
|
git_source(:github) { |repo| "https://github.com/#{repo}" }
|
6
6
|
|
7
|
-
group :development, :test do
|
8
|
-
gem "rspec"
|
9
|
-
end
|
10
|
-
|
11
|
-
if File.exist? "Gemfile.devel"
|
12
|
-
eval File.read("Gemfile.devel"), nil, "Gemfile.devel" # rubocop:disable Security/Eval
|
13
|
-
end
|
14
|
-
|
15
7
|
gemspec
|
8
|
+
|
9
|
+
eval_gemfile("Gemfile.devel") rescue nil
|
@@ -140,6 +140,14 @@ a.FootnoteRef, span.FootnoteRef {
|
|
140
140
|
color: red;
|
141
141
|
text-decoration: line-through; }
|
142
142
|
|
143
|
+
ruby {
|
144
|
+
ruby-position: over;
|
145
|
+
-webkit-ruby-position: before; }
|
146
|
+
|
147
|
+
ruby ruby {
|
148
|
+
ruby-position: under;
|
149
|
+
-webkit-ruby-position: after; }
|
150
|
+
|
143
151
|
/* code highlighting with line numbers */
|
144
152
|
table.rouge-line-table td.rouge-gutter {
|
145
153
|
-moz-user-select: none;
|
@@ -87,18 +87,22 @@ module Metanorma
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def init_toc(node)
|
90
|
-
@htmltoclevels = node.attr("
|
90
|
+
@htmltoclevels = node.attr("toclevels-html") ||
|
91
|
+
node.attr("htmltoclevels") ||
|
91
92
|
node.attr("toclevels") || toc_default[:html_levels]
|
92
|
-
@doctoclevels = node.attr("
|
93
|
-
node.attr("toclevels") ||
|
94
|
-
|
93
|
+
@doctoclevels = node.attr("toclevels-doc") ||
|
94
|
+
node.attr("doctoclevels") || node.attr("toclevels") ||
|
95
|
+
toc_default[:word_levels]
|
96
|
+
@pdftoclevels = node.attr("toclevels-pdf") ||
|
97
|
+
node.attr("toclevels") || toc_default[:pdf_levels]
|
98
|
+
@toclevels = node.attr("toclevels") || toc_default[:html_levels]
|
95
99
|
@tocfigures = node.attr("toc-figures")
|
96
100
|
@toctables = node.attr("toc-tables")
|
97
101
|
@tocrecommendations = node.attr("toc-recommendations")
|
98
102
|
end
|
99
103
|
|
100
104
|
def toc_default
|
101
|
-
{ word_levels: 2, html_levels: 2 }
|
105
|
+
{ word_levels: 2, html_levels: 2, pdf_levels: 2 }
|
102
106
|
end
|
103
107
|
|
104
108
|
def init_output(node)
|
@@ -715,27 +715,36 @@
|
|
715
715
|
</define>
|
716
716
|
<define name="ruby">
|
717
717
|
<element name="ruby">
|
718
|
-
<
|
719
|
-
<
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
718
|
+
<choice>
|
719
|
+
<ref name="ruby_pronunciation"/>
|
720
|
+
<ref name="ruby_annotation"/>
|
721
|
+
</choice>
|
722
|
+
<choice>
|
723
|
+
<text/>
|
724
|
+
<ref name="ruby"/>
|
725
|
+
</choice>
|
725
726
|
</element>
|
726
727
|
</define>
|
727
|
-
<define name="
|
728
|
-
<element name="
|
729
|
-
<
|
730
|
-
|
731
|
-
|
728
|
+
<define name="ruby_pronunciation">
|
729
|
+
<element name="pronunciation">
|
730
|
+
<attribute name="value"/>
|
731
|
+
<optional>
|
732
|
+
<attribute name="script"/>
|
733
|
+
</optional>
|
734
|
+
<optional>
|
735
|
+
<attribute name="lang"/>
|
736
|
+
</optional>
|
732
737
|
</element>
|
733
738
|
</define>
|
734
|
-
<define name="
|
735
|
-
<element name="
|
736
|
-
<
|
737
|
-
|
738
|
-
|
739
|
+
<define name="ruby_annotation">
|
740
|
+
<element name="annotation">
|
741
|
+
<attribute name="value"/>
|
742
|
+
<optional>
|
743
|
+
<attribute name="script"/>
|
744
|
+
</optional>
|
745
|
+
<optional>
|
746
|
+
<attribute name="lang"/>
|
747
|
+
</optional>
|
739
748
|
</element>
|
740
749
|
</define>
|
741
750
|
<define name="br">
|
@@ -78,7 +78,7 @@ module Metanorma
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def toc_metadata(xmldoc)
|
81
|
-
@htmltoclevels || @doctoclevels || @toclevels or return
|
81
|
+
@htmltoclevels || @doctoclevels || @pdftoclevels || @toclevels or return
|
82
82
|
ins = add_misc_container(xmldoc)
|
83
83
|
toc_metadata1(ins)
|
84
84
|
end
|
@@ -86,7 +86,8 @@ module Metanorma
|
|
86
86
|
def toc_metadata1(ins)
|
87
87
|
[[@toclevels, "TOC Heading Levels"],
|
88
88
|
[@htmltoclevels, "HTML TOC Heading Levels"],
|
89
|
-
[@doctoclevels, "DOC TOC Heading Levels"]
|
89
|
+
[@doctoclevels, "DOC TOC Heading Levels"],
|
90
|
+
[@pdftoclevels, "PDF TOC Heading Levels"]].each do |n|
|
90
91
|
n[0] and ins << "<presentation-metadata><name>#{n[1]}</name>" \
|
91
92
|
"<value>#{n[0]}</value></presentation-metadata>"
|
92
93
|
end
|
@@ -22,7 +22,12 @@ module Metanorma
|
|
22
22
|
|
23
23
|
def personal_role(node, contrib, suffix)
|
24
24
|
type = node.attr("role#{suffix}")&.downcase || "author"
|
25
|
-
|
25
|
+
desc = node.attr("role-description#{suffix}")
|
26
|
+
contrib.role type: type do |r|
|
27
|
+
desc and r.description do |d|
|
28
|
+
d << desc
|
29
|
+
end
|
30
|
+
end
|
26
31
|
end
|
27
32
|
|
28
33
|
def personal_contact(node, suffix, person)
|
@@ -52,25 +52,32 @@ module Metanorma
|
|
52
52
|
use_dsl
|
53
53
|
named :ruby
|
54
54
|
parse_content_as :text
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
def
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
attributes.key?("rpbegin")
|
65
|
-
rt = attributes[1] || ""
|
66
|
-
else
|
67
|
-
rpbegin = attributes["rpbegin"]
|
68
|
-
rt = attributes["rt"]
|
69
|
-
rpend = attributes["rpend"]
|
55
|
+
|
56
|
+
# ruby:{annotation}[lang=ja,script=Hira,type=pronunciation|annotation,text]
|
57
|
+
|
58
|
+
def preprocess_attrs(text)
|
59
|
+
ret = {}
|
60
|
+
while m = /^(?<key>lang|script|type)=(?<val>[^,]+),(?<rest>.+)$/
|
61
|
+
.match(text)
|
62
|
+
text = m[:rest]
|
63
|
+
ret[m[:key].to_sym] = m[:val]
|
70
64
|
end
|
65
|
+
ret[:text] = text
|
66
|
+
ret[:type] ||= "pronunciation"
|
67
|
+
ret[:type] == "annotation" or ret[:type] = "pronunciation"
|
68
|
+
ret
|
69
|
+
end
|
71
70
|
|
72
|
-
|
73
|
-
|
71
|
+
def process(parent, target, attributes)
|
72
|
+
args = preprocess_attrs(attributes["text"])
|
73
|
+
out = Nokogiri::XML(
|
74
|
+
create_block(parent, :paragraph, [args[:text]], {},
|
75
|
+
subs: [:macros], content_model: :simple).convert,
|
76
|
+
).root.children.to_xml # force recurse macros
|
77
|
+
attrs = " value='#{target}'"
|
78
|
+
x = args[:lang] and attrs += " lang='#{x}'"
|
79
|
+
x = args[:script] and attrs += " script='#{x}'"
|
80
|
+
"<ruby><#{args[:type]} #{attrs}/>#{out}</ruby>"
|
74
81
|
end
|
75
82
|
end
|
76
83
|
|
@@ -17,8 +17,9 @@ module Metanorma
|
|
17
17
|
scripts_override: node.attr("scripts-override"),
|
18
18
|
scripts_pdf: node.attr("scripts-pdf"),
|
19
19
|
datauriimage: node.attr("data-uri-image") != "false",
|
20
|
-
htmltoclevels:
|
21
|
-
doctoclevels:
|
20
|
+
htmltoclevels: @htmltoclevels,
|
21
|
+
doctoclevels: @doctoclevels,
|
22
|
+
pdftoclevels: @pdftoclevels,
|
22
23
|
breakupurlsintables: node.attr("break-up-urls-in-tables"),
|
23
24
|
suppressasciimathdup: node.attr("suppress-asciimath-dup") == "true",
|
24
25
|
bare: node.attr("bare"),
|
@@ -62,8 +63,9 @@ module Metanorma
|
|
62
63
|
wordintropage: node.attr("wordintropage"),
|
63
64
|
ulstyle: node.attr("ulstyle"),
|
64
65
|
olstyle: node.attr("olstyle"),
|
65
|
-
htmltoclevels:
|
66
|
-
doctoclevels:
|
66
|
+
htmltoclevels: @htmltoclevels,
|
67
|
+
doctoclevels: @doctoclevels,
|
68
|
+
pdftoclevels: @pdftoclevels,
|
67
69
|
breakupurlsintables: node.attr("break-up-urls-in-tables"),
|
68
70
|
suppressasciimathdup: node.attr("suppress-asciimath-dup"),
|
69
71
|
bare: node.attr("bare"),
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-standoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.5
|
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-12-
|
11
|
+
date: 2023-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|