isodoc 2.3.6 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/isodoc.gemspec +2 -1
- data/lib/isodoc/base_style/typography.scss +5 -2
- data/lib/isodoc/class_utils.rb +6 -1
- data/lib/isodoc/convert.rb +7 -4
- data/lib/isodoc/function/blocks.rb +1 -1
- data/lib/isodoc/function/inline.rb +4 -4
- data/lib/isodoc/function/inline_simple.rb +2 -1
- data/lib/isodoc/function/references.rb +38 -52
- data/lib/isodoc/function/table.rb +21 -12
- data/lib/isodoc/function/to_word_html.rb +1 -0
- data/lib/isodoc/function/utils.rb +4 -0
- data/lib/isodoc/html_function/html.rb +6 -25
- data/lib/isodoc/html_function/postprocess_cover.rb +6 -9
- data/lib/isodoc/metadata.rb +5 -0
- data/lib/isodoc/presentation_function/bibdata.rb +9 -9
- data/lib/isodoc/presentation_function/block.rb +99 -33
- data/lib/isodoc/presentation_function/erefs.rb +49 -35
- data/lib/isodoc/presentation_function/refs.rb +76 -4
- data/lib/isodoc/presentation_function/section.rb +1 -1
- data/lib/isodoc/presentation_function/terms.rb +28 -23
- data/lib/isodoc/presentation_function/xrefs.rb +16 -7
- data/lib/isodoc/presentation_xml_convert.rb +2 -2
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/postprocess.rb +32 -3
- data/lib/isodoc/word_function/table.rb +24 -13
- data/lib/isodoc/xref/xref_gen.rb +11 -11
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba10d3ff61b6c99d2251fd1d8e868bf09aea5dde1da505bc1745003778f8750d
|
4
|
+
data.tar.gz: b758cac0f031d6a16c95ba8dd05c963bf227438d64d63f1f3146dd745d5c42e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ba1187b3202d8b8ef7d8c0376ba6cd100230a0cbe889cfaa729510f174cdbfba884b2ca2b5607525b53391b83a007313e21427539aa8c42d604d295b90feb3b
|
7
|
+
data.tar.gz: 0b15b2d4bee5c08e2a0989eba6909d37827f67943eb8f0e86f9815f202ca7f408955b1905c7d041e32ae1433ddc1fa99e7fdecf4bf49c0174ee194731104135f
|
data/isodoc.gemspec
CHANGED
@@ -39,10 +39,11 @@ Gem::Specification.new do |spec|
|
|
39
39
|
spec.add_dependency "mathml2asciimath"
|
40
40
|
spec.add_dependency "metanorma-utils", "~> 1.4.5"
|
41
41
|
spec.add_dependency "mn2pdf"
|
42
|
-
spec.add_dependency "mn-requirements", "~> 0.
|
42
|
+
spec.add_dependency "mn-requirements", "~> 0.3.1"
|
43
43
|
spec.add_dependency "relaton-cli"
|
44
44
|
spec.add_dependency "relaton-render", "~> 0.5.2"
|
45
45
|
spec.add_dependency "roman-numerals"
|
46
|
+
spec.add_dependency "rouge", "~> 4.0"
|
46
47
|
spec.add_dependency "thread_safe"
|
47
48
|
spec.add_dependency "twitter_cldr", ">= 6.6.0"
|
48
49
|
spec.add_dependency "uuidtools"
|
@@ -24,8 +24,11 @@
|
|
24
24
|
background: $colorHighlightBg;
|
25
25
|
box-shadow: 3px 0 0 $colorHighlightBg, -3px 0 0 $colorHighlightBg;
|
26
26
|
}
|
27
|
-
|
28
|
-
|
27
|
+
*::selection {
|
28
|
+
background: $colorHighlightBg;
|
29
|
+
color: $colorHighlightFg;
|
30
|
+
}
|
31
|
+
*::-moz-selection {
|
29
32
|
background: $colorHighlightBg;
|
30
33
|
color: $colorHighlightFg;
|
31
34
|
}
|
data/lib/isodoc/class_utils.rb
CHANGED
@@ -47,6 +47,11 @@ module IsoDoc
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
+
def to_xml(node)
|
51
|
+
node&.to_xml(encoding: "UTF-8", indent: 0,
|
52
|
+
save_with: Nokogiri::XML::Node::SaveOptions::AS_XML)
|
53
|
+
end
|
54
|
+
|
50
55
|
def case_with_markup(linkend, casing, script, firstonly: true)
|
51
56
|
seen = false
|
52
57
|
xml = Nokogiri::XML("<root>#{linkend}</root>")
|
@@ -57,7 +62,7 @@ module IsoDoc
|
|
57
62
|
firstonly: firstonly))
|
58
63
|
seen = true if firstonly
|
59
64
|
end
|
60
|
-
xml.root.children
|
65
|
+
to_xml(xml.root.children)
|
61
66
|
end
|
62
67
|
|
63
68
|
def nearest_block_parent(node)
|
data/lib/isodoc/convert.rb
CHANGED
@@ -11,7 +11,8 @@ require "mn-requirements"
|
|
11
11
|
|
12
12
|
module IsoDoc
|
13
13
|
class Convert < ::IsoDoc::Common
|
14
|
-
attr_accessor :options, :i18n, :meta, :xrefs, :reqt_models,
|
14
|
+
attr_accessor :options, :i18n, :meta, :xrefs, :reqt_models,
|
15
|
+
:requirements_processor
|
15
16
|
|
16
17
|
# htmlstylesheet: Generic stylesheet for HTML
|
17
18
|
# htmlstylesheet_override: Override stylesheet for HTML
|
@@ -48,6 +49,7 @@ module IsoDoc
|
|
48
49
|
# fonts: fontist fonts to install
|
49
50
|
# fontlicenseagreement: fontist font license agreement
|
50
51
|
# modspecidentifierbase: base prefix for any Modspec identifiers
|
52
|
+
# sourcehighlighter: whether to apply sourcecode highlighting
|
51
53
|
def initialize(options) # rubocop:disable Lint/MissingSuper
|
52
54
|
@options = options_preprocess(options)
|
53
55
|
init_stylesheets(@options)
|
@@ -76,10 +78,11 @@ module IsoDoc
|
|
76
78
|
@suppressheadingnumbers = options[:suppressheadingnumbers]
|
77
79
|
@break_up_urls_in_tables = options[:breakupurlsintables]
|
78
80
|
@sectionsplit = options[:sectionsplit] == "true"
|
79
|
-
@suppressasciimathdup = options[:suppressasciimathdup]
|
81
|
+
@suppressasciimathdup = options[:suppressasciimathdup]
|
80
82
|
@bare = options[:bare]
|
81
83
|
@aligncrosselements = options[:aligncrosselements]
|
82
84
|
@modspecidentifierbase = options[:modspecidentifierbase]
|
85
|
+
@sourcehighlighter = options[:sourcehighlighter]
|
83
86
|
end
|
84
87
|
|
85
88
|
def init_i18n(options)
|
@@ -207,7 +210,7 @@ module IsoDoc
|
|
207
210
|
docxml.root.default_namespace = ""
|
208
211
|
convert_i18n_init(docxml)
|
209
212
|
metadata_init(@lang, @script, @locale, @i18n)
|
210
|
-
xref_init(@lang, @script, self, @i18n, {locale: @locale})
|
213
|
+
xref_init(@lang, @script, self, @i18n, { locale: @locale })
|
211
214
|
[docxml, filename, dir]
|
212
215
|
end
|
213
216
|
|
@@ -235,7 +238,7 @@ module IsoDoc
|
|
235
238
|
end
|
236
239
|
|
237
240
|
def middle_clause(_docxml = nil)
|
238
|
-
"//clause[parent::sections][not(@type = 'scope')]"\
|
241
|
+
"//clause[parent::sections][not(@type = 'scope')]" \
|
239
242
|
"[not(descendant::terms)]"
|
240
243
|
end
|
241
244
|
|
@@ -75,7 +75,7 @@ module IsoDoc
|
|
75
75
|
def sourcecode_parse(node, out)
|
76
76
|
name = node.at(ns("./name"))
|
77
77
|
out.p **sourcecode_attrs(node) do |div|
|
78
|
-
@sourcecode = true
|
78
|
+
@sourcecode = true unless node.at(ns(".//sourcecode"))
|
79
79
|
node.children.each { |n| parse(n, div) unless n.name == "name" }
|
80
80
|
@sourcecode = false
|
81
81
|
end
|
@@ -17,12 +17,12 @@ module IsoDoc
|
|
17
17
|
def location_parse(node, out); end
|
18
18
|
|
19
19
|
def span_parse(node, out)
|
20
|
-
if node["style"]
|
21
|
-
out.span **
|
20
|
+
if node["style"] || node["class"]
|
21
|
+
out.span **attr_code(style: node["style"],
|
22
|
+
class: node["class"]) do |s|
|
22
23
|
node.children.each { |n| parse(n, s) }
|
23
24
|
end
|
24
|
-
else
|
25
|
-
node.children.each { |n| parse(n, out) }
|
25
|
+
else node.children.each { |n| parse(n, out) }
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -10,60 +10,59 @@ module IsoDoc
|
|
10
10
|
text
|
11
11
|
end
|
12
12
|
|
13
|
-
def nonstd_bibitem(list, bib,
|
13
|
+
def nonstd_bibitem(list, bib, _ordinal, biblio) # %%%
|
14
14
|
list.p **attr_code(iso_bibitem_entry_attrs(bib, biblio)) do |ref|
|
15
|
-
ids = bibitem_ref_code(bib)
|
16
|
-
idents = render_identifier(ids)
|
17
|
-
if biblio then ref_entry_code(ref, ordinal, idents, ids)
|
18
|
-
else
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
ref << "," if idents[:sdo]
|
23
|
-
|
15
|
+
# ids = bibitem_ref_code(bib)
|
16
|
+
# idents = render_identifier(ids)
|
17
|
+
# if biblio then ref_entry_code(ref, ordinal, idents, ids)
|
18
|
+
# else
|
19
|
+
# ref << (idents[:ordinal] || idents[:metanorma] || idents[:sdo]).to_s
|
20
|
+
# ref << ", #{idents[sdo]}" if idents[:ordinal] && idents[:sdo]
|
21
|
+
# end
|
22
|
+
# ref << "," if idents[:sdo]
|
23
|
+
tag = bib.at(ns("./biblio-tag"))
|
24
|
+
tag&.children&.each { |n| parse(n, ref) }
|
24
25
|
reference_format(bib, ref)
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
28
|
-
def std_bibitem_entry(list, bib,
|
29
|
+
def std_bibitem_entry(list, bib, _ordinal, biblio) # %%%
|
29
30
|
list.p **attr_code(iso_bibitem_entry_attrs(bib, biblio)) do |ref|
|
30
|
-
idents = render_identifier(bibitem_ref_code(bib))
|
31
|
-
if biblio then ref_entry_code(ref, ordinal, idents, nil)
|
32
|
-
else
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
date_note_process(bib, ref)
|
38
|
-
ref << "," if idents[:sdo]
|
39
|
-
|
31
|
+
# idents = render_identifier(bibitem_ref_code(bib))
|
32
|
+
# if biblio then ref_entry_code(ref, ordinal, idents, nil)
|
33
|
+
# else
|
34
|
+
# ref << (idents[:ordinal] || idents[:metanorma] || idents[:sdo]).to_s
|
35
|
+
# ref << ", #{idents[:sdo]}" if (idents[:ordinal] ||
|
36
|
+
# idents[:metanorma]) && idents[:sdo]
|
37
|
+
# end
|
38
|
+
# date_note_process(bib, ref)
|
39
|
+
# ref << "," if idents[:sdo]
|
40
|
+
tag = bib.at(ns("./biblio-tag"))
|
41
|
+
tag&.children&.each { |n| parse(n, ref) }
|
40
42
|
reference_format(bib, ref)
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
44
|
-
# if ids is just a number, only use that ([1] Non-Standard)
|
45
|
-
# else, use both ordinal, as prefix, and ids
|
46
|
-
def ref_entry_code(ref, ordinal, ids, _id)
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
46
|
+
# # if ids is just a number, only use that ([1] Non-Standard)
|
47
|
+
# # else, use both ordinal, as prefix, and ids
|
48
|
+
# def ref_entry_code(ref, ordinal, ids, _id) #%%%
|
49
|
+
# prefix_bracketed_ref(ref, ids[:ordinal] || ids[:metanorma] ||
|
50
|
+
# "[#{ordinal}]")
|
51
|
+
# ids[:sdo] and ref << (ids[:sdo]).to_s
|
52
|
+
# end
|
51
53
|
|
52
|
-
|
53
|
-
|
54
|
+
SKIP_DOCID = "@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or " \
|
55
|
+
"@type = 'metanorma-ordinal' or @type = 'ISBN'".freeze
|
54
56
|
|
55
|
-
|
57
|
+
def pref_ref_code(bib)
|
58
|
+
bib["suppress_identifier"] == "true" and return nil
|
59
|
+
lang = "[@language = '#{@lang}']"
|
60
|
+
ret = bib.xpath(ns("./docidentifier[@primary = 'true']#{lang}"))
|
56
61
|
ret.empty? and
|
57
62
|
ret = bib.xpath(ns("./docidentifier[@primary = 'true']"))
|
58
63
|
ret.empty? and
|
59
|
-
ret = bib.at(ns(
|
60
|
-
./docidentifier[not(
|
61
|
-
XPATH
|
62
|
-
)) ||
|
63
|
-
bib.at(ns(<<~XPATH,
|
64
|
-
./docidentifier[not(@type = 'DOI' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'ISSN' or @type = 'ISBN')]
|
65
|
-
XPATH
|
66
|
-
))
|
64
|
+
ret = bib.at(ns("./docidentifier[not(#{SKIP_DOCID})]#{lang}")) ||
|
65
|
+
bib.at(ns("./docidentifier[not(#{SKIP_DOCID})]"))
|
67
66
|
ret
|
68
67
|
end
|
69
68
|
|
@@ -123,14 +122,6 @@ module IsoDoc
|
|
123
122
|
.include? prefix
|
124
123
|
end
|
125
124
|
|
126
|
-
def date_note_process(bib, ref)
|
127
|
-
date_note = bib.at(ns("./note[@type = 'Unpublished-Status']"))
|
128
|
-
return if date_note.nil?
|
129
|
-
|
130
|
-
date_note.children = "<p>#{date_note.content}</p>"
|
131
|
-
footnote_parse(date_note, ref)
|
132
|
-
end
|
133
|
-
|
134
125
|
def iso_bibitem_entry_attrs(bib, biblio)
|
135
126
|
{ id: bib["id"], class: biblio ? "Biblio" : "NormRef" }
|
136
127
|
end
|
@@ -141,11 +132,6 @@ module IsoDoc
|
|
141
132
|
bib["hidden"] == "true"
|
142
133
|
end
|
143
134
|
|
144
|
-
def prefix_bracketed_ref(ref, text)
|
145
|
-
ref << text.to_s
|
146
|
-
insert_tab(ref, 1)
|
147
|
-
end
|
148
|
-
|
149
135
|
def reference_format(bib, out)
|
150
136
|
ftitle = bib.at(ns("./formattedref"))
|
151
137
|
ftitle&.children&.each { |n| parse(n, out) }
|
@@ -13,7 +13,7 @@ module IsoDoc
|
|
13
13
|
if thead
|
14
14
|
table.thead do |h|
|
15
15
|
thead.element_children.each_with_index do |n, i|
|
16
|
-
tr_parse(n, h, i, thead.
|
16
|
+
tr_parse(n, h, i, thead.xpath(ns("./tr")).size, true)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -23,7 +23,7 @@ module IsoDoc
|
|
23
23
|
tbody = node.at(ns("./tbody")) || return
|
24
24
|
table.tbody do |h|
|
25
25
|
tbody.element_children.each_with_index do |n, i|
|
26
|
-
tr_parse(n, h, i, tbody.
|
26
|
+
tr_parse(n, h, i, tbody.xpath(ns("./tr")).size, false)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -33,7 +33,7 @@ module IsoDoc
|
|
33
33
|
if tfoot
|
34
34
|
table.tfoot do |h|
|
35
35
|
tfoot.element_children.each_with_index do |n, i|
|
36
|
-
tr_parse(n, h, i, tfoot.
|
36
|
+
tr_parse(n, h, i, tfoot.xpath(ns("./tr")).size, false)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -41,11 +41,13 @@ module IsoDoc
|
|
41
41
|
|
42
42
|
def table_attrs(node)
|
43
43
|
width = node["width"] ? "width:#{node['width']};" : nil
|
44
|
+
c = node["class"]
|
45
|
+
bordered = "border-width:1px;border-spacing:0;"
|
46
|
+
(%w(modspec).include?(c) || !c) or bordered = ""
|
44
47
|
attr_code(
|
45
48
|
id: node["id"],
|
46
|
-
class:
|
47
|
-
style: "
|
48
|
-
"#{width}#{keep_style(node)}",
|
49
|
+
class: c || "MsoISOTable",
|
50
|
+
style: "#{bordered}#{width}#{keep_style(node)}",
|
49
51
|
title: node["alt"],
|
50
52
|
)
|
51
53
|
end
|
@@ -91,15 +93,12 @@ module IsoDoc
|
|
91
93
|
# border-left:#{col.zero? ? "#{SW} 1.5pt;" : "none;"}
|
92
94
|
# border-right:#{SW} #{col == totalcols && !header ? "1.5" : "1.0"}pt;
|
93
95
|
|
94
|
-
def make_tr_attr(cell, row, totalrows, header)
|
96
|
+
def make_tr_attr(cell, row, totalrows, header, bordered)
|
95
97
|
style = cell.name == "th" ? "font-weight:bold;" : ""
|
96
98
|
cell["align"] and style += "text-align:#{cell['align']};"
|
97
99
|
cell["valign"] and style += "vertical-align:#{cell['valign']};"
|
98
100
|
rowmax = cell["rowspan"] ? row + cell["rowspan"].to_i - 1 : row
|
99
|
-
style +=
|
100
|
-
border-top:#{row.zero? ? "#{SW} 1.5pt;" : 'none;'}
|
101
|
-
border-bottom:#{SW} #{rowmax == totalrows ? '1.5' : '1.0'}pt;
|
102
|
-
STYLE
|
101
|
+
style += make_tr_attr_style(row, rowmax, totalrows, header, bordered)
|
103
102
|
header and scope = (cell["colspan"] ? "colgroup" : "col")
|
104
103
|
!header && cell.name == "th" and
|
105
104
|
scope = (cell["rowspan"] ? "rowgroup" : "row")
|
@@ -107,10 +106,20 @@ module IsoDoc
|
|
107
106
|
style: style.gsub(/\n/, ""), scope: scope }
|
108
107
|
end
|
109
108
|
|
109
|
+
def make_tr_attr_style(row, rowmax, totalrows, _header, bordered)
|
110
|
+
bordered or return ""
|
111
|
+
<<~STYLE.gsub(/\n/, "")
|
112
|
+
border-top:#{row.zero? ? "#{SW} 1.5pt;" : 'none;'}
|
113
|
+
border-bottom:#{SW} #{rowmax >= totalrows ? '1.5' : '1.0'}pt;
|
114
|
+
STYLE
|
115
|
+
end
|
116
|
+
|
110
117
|
def tr_parse(node, out, ord, totalrows, header)
|
118
|
+
c = node.parent.parent["class"]
|
119
|
+
bordered = %w(modspec).include?(c) || !c
|
111
120
|
out.tr do |r|
|
112
121
|
node.elements.each do |td|
|
113
|
-
attrs = make_tr_attr(td, ord, totalrows - 1, header)
|
122
|
+
attrs = make_tr_attr(td, ord, totalrows - 1, header, bordered)
|
114
123
|
r.send td.name, **attr_code(attrs) do |entry|
|
115
124
|
td.children.each { |n| parse(n, entry) }
|
116
125
|
end
|
@@ -78,7 +78,7 @@ module IsoDoc
|
|
78
78
|
def html_button
|
79
79
|
return "" if @bare
|
80
80
|
|
81
|
-
'<button onclick="topFunction()" id="myBtn" '\
|
81
|
+
'<button onclick="topFunction()" id="myBtn" ' \
|
82
82
|
'title="Go to top">Top</button>'.freeze
|
83
83
|
end
|
84
84
|
|
@@ -89,31 +89,10 @@ module IsoDoc
|
|
89
89
|
d.children.empty? or d.children.first.previous = html_button
|
90
90
|
end
|
91
91
|
|
92
|
-
def sourcecodelang(lang)
|
93
|
-
return unless lang
|
94
|
-
|
95
|
-
case lang.downcase
|
96
|
-
when "javascript" then "lang-js"
|
97
|
-
when "c" then "lang-c"
|
98
|
-
when "c+" then "lang-cpp"
|
99
|
-
when "console" then "lang-bsh"
|
100
|
-
when "ruby" then "lang-rb"
|
101
|
-
when "html" then "lang-html"
|
102
|
-
when "java" then "lang-java"
|
103
|
-
when "xml" then "lang-xml"
|
104
|
-
when "perl" then "lang-perl"
|
105
|
-
when "python" then "lang-py"
|
106
|
-
when "xsl" then "lang-xsl"
|
107
|
-
else
|
108
|
-
""
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
92
|
def sourcecode_parse(node, out)
|
113
93
|
name = node.at(ns("./name"))
|
114
|
-
|
115
|
-
|
116
|
-
@sourcecode = true
|
94
|
+
out.pre **sourcecode_attrs(node).merge(class: "sourcecode") do |div|
|
95
|
+
@sourcecode = true unless node.at(ns(".//sourcecode"))
|
117
96
|
node.children.each { |n| parse(n, div) unless n.name == "name" }
|
118
97
|
@sourcecode = false
|
119
98
|
end
|
@@ -121,7 +100,9 @@ module IsoDoc
|
|
121
100
|
end
|
122
101
|
|
123
102
|
def underline_parse(node, out)
|
124
|
-
|
103
|
+
style = node["style"] ? " #{node['style']}" : ""
|
104
|
+
attr = { style: "text-decoration: underline#{style}" }
|
105
|
+
out.span **attr do |e|
|
125
106
|
node.children.each { |n| parse(n, e) }
|
126
107
|
end
|
127
108
|
end
|
@@ -31,6 +31,9 @@ module IsoDoc
|
|
31
31
|
head = docxml.at("//*[local-name() = 'head']")
|
32
32
|
head << htmlstylesheet(@htmlstylesheet)
|
33
33
|
s = htmlstylesheet(@htmlstylesheet_override) and head << s
|
34
|
+
s = @meta.get[:code_css] and
|
35
|
+
head << "<style><!--#{s.gsub(/sourcecode/,
|
36
|
+
'pre.sourcecode')}--></style>"
|
34
37
|
@bare and
|
35
38
|
head << "<style>body {margin-left: 2em; margin-right: 2em;}</style>"
|
36
39
|
docxml
|
@@ -40,7 +43,6 @@ module IsoDoc
|
|
40
43
|
html_cover(docxml) if @htmlcoverpage && !@bare
|
41
44
|
html_intro(docxml) if @htmlintropage && !@bare
|
42
45
|
docxml.at("//body") << mathjax(@openmathdelim, @closemathdelim)
|
43
|
-
docxml.at("//body") << sourcecode_highlighter
|
44
46
|
html_main(docxml)
|
45
47
|
authority_cleanup(docxml)
|
46
48
|
docxml
|
@@ -48,7 +50,7 @@ module IsoDoc
|
|
48
50
|
|
49
51
|
def authority_cleanup1(docxml, klass)
|
50
52
|
dest = docxml.at("//div[@id = 'boilerplate-#{klass}-destination']")
|
51
|
-
auth = docxml.at("//div[@id = 'boilerplate-#{klass}' or "\
|
53
|
+
auth = docxml.at("//div[@id = 'boilerplate-#{klass}' or " \
|
52
54
|
"@class = 'boilerplate-#{klass}']")
|
53
55
|
auth&.xpath(".//h1[not(text())] | .//h2[not(text())]")&.each(&:remove)
|
54
56
|
auth&.xpath(".//h1 | .//h2")&.each { |h| h["class"] = "IntroTitle" }
|
@@ -92,7 +94,7 @@ module IsoDoc
|
|
92
94
|
end
|
93
95
|
|
94
96
|
def html_toc_entry(level, header)
|
95
|
-
content = header.at("./following-sibling::p"\
|
97
|
+
content = header.at("./following-sibling::p" \
|
96
98
|
"[@class = 'variant-title-toc']") || header
|
97
99
|
%(<li class="#{level}"><a href="##{header['id']}">\
|
98
100
|
#{header_strip(content)}</a></li>)
|
@@ -127,7 +129,7 @@ module IsoDoc
|
|
127
129
|
end
|
128
130
|
|
129
131
|
def toc_exclude_class
|
130
|
-
"[not(@class = 'TermNum')][not(@class = 'noTOC')]"\
|
132
|
+
"[not(@class = 'TermNum')][not(@class = 'noTOC')]" \
|
131
133
|
"[string-length(normalize-space(.))>0]"
|
132
134
|
end
|
133
135
|
|
@@ -142,11 +144,6 @@ module IsoDoc
|
|
142
144
|
"#{a[0]}#{scripts}#{scripts_override}</body>#{a[1]}"
|
143
145
|
end
|
144
146
|
|
145
|
-
def sourcecode_highlighter
|
146
|
-
'<script src="https://cdn.rawgit.com/google/code-prettify/master/'\
|
147
|
-
'loader/run_prettify.js"></script>'
|
148
|
-
end
|
149
|
-
|
150
147
|
MATHJAX_ADDR =
|
151
148
|
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js".freeze
|
152
149
|
MATHJAX = <<~"MATHJAX".freeze
|
data/lib/isodoc/metadata.rb
CHANGED
@@ -10,7 +10,7 @@ module IsoDoc
|
|
10
10
|
address_precompose(a)
|
11
11
|
bibdata_i18n(a)
|
12
12
|
a.next =
|
13
|
-
"<localized-strings>#{i8n_name(trim_hash(@i18n.get), '').join}"\
|
13
|
+
"<localized-strings>#{i8n_name(trim_hash(@i18n.get), '').join}" \
|
14
14
|
"</localized-strings>"
|
15
15
|
end
|
16
16
|
|
@@ -24,7 +24,7 @@ module IsoDoc
|
|
24
24
|
@toctables and
|
25
25
|
ins << "<toc type='table'><title>#{@i18n.toc_tables}</title></toc>"
|
26
26
|
@tocfigures and
|
27
|
-
ins << "<toc type='recommendation'><title>#{@i18n.toc_recommendations}"\
|
27
|
+
ins << "<toc type='recommendation'><title>#{@i18n.toc_recommendations}" \
|
28
28
|
"</title></toc>"
|
29
29
|
end
|
30
30
|
|
@@ -50,17 +50,17 @@ module IsoDoc
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def presmeta(name, value)
|
53
|
-
"<presentation-metadata><name>#{name}</name><value>#{value}</value>"\
|
53
|
+
"<presentation-metadata><name>#{name}</name><value>#{value}</value>" \
|
54
54
|
"</presentation-metadata>"
|
55
55
|
end
|
56
56
|
|
57
57
|
def address_precompose1(addr)
|
58
58
|
ret = []
|
59
|
-
addr.xpath(ns("./street")).each { |s| ret << s.children
|
60
|
-
a = addr.at(ns("./city")) and ret << a.children
|
61
|
-
addr.xpath(ns("./state")).each { |s| ret << s.children
|
62
|
-
a = addr.at(ns("./country")) and ret << a.children
|
63
|
-
a = addr.at(ns("./postcode")) and ret[-1] += " #{a.children
|
59
|
+
addr.xpath(ns("./street")).each { |s| ret << to_xml(s.children) }
|
60
|
+
a = addr.at(ns("./city")) and ret << to_xml(a.children)
|
61
|
+
addr.xpath(ns("./state")).each { |s| ret << to_xml(s.children) }
|
62
|
+
a = addr.at(ns("./country")) and ret << to_xml(a.children)
|
63
|
+
a = addr.at(ns("./postcode")) and ret[-1] += " #{to_xml a.children}"
|
64
64
|
ret.join("<br/>")
|
65
65
|
end
|
66
66
|
|
@@ -118,7 +118,7 @@ module IsoDoc
|
|
118
118
|
end
|
119
119
|
|
120
120
|
def i18n_tag(key, value)
|
121
|
-
"<localized-string key='#{key}' language='#{@lang}'>#{value}"\
|
121
|
+
"<localized-string key='#{key}' language='#{@lang}'>#{value}" \
|
122
122
|
"</localized-string>"
|
123
123
|
end
|
124
124
|
|