isodoc 1.7.7 → 1.8.0
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/isodoc.gemspec +1 -1
- data/lib/isodoc/function/cleanup.rb +4 -0
- data/lib/isodoc/presentation_function/block.rb +0 -36
- data/lib/isodoc/presentation_function/inline.rb +2 -3
- data/lib/isodoc/presentation_function/terms.rb +179 -0
- data/lib/isodoc/presentation_xml_convert.rb +11 -4
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/postprocess.rb +184 -176
- data/lib/isodoc/xslfo_convert.rb +9 -6
- data/lib/isodoc-yaml/i18n-ar.yaml +22 -0
- data/lib/isodoc-yaml/i18n-de.yaml +20 -0
- data/lib/isodoc-yaml/i18n-en.yaml +20 -0
- data/lib/isodoc-yaml/i18n-es.yaml +20 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +20 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +21 -1
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +21 -0
- data/lib/metanorma/output/xslfo.rb +4 -11
- data/spec/isodoc/i18n_spec.rb +5 -5
- data/spec/isodoc/inline_spec.rb +78 -0
- data/spec/isodoc/section_spec.rb +11 -10
- data/spec/isodoc/terms_spec.rb +354 -34
- data/spec/isodoc/xref_spec.rb +4 -4
- data/spec/isodoc/xslfo_convert_spec.rb +20 -7
- metadata +6 -6
- data/lib/isodoc/presentation_function/concept.rb +0 -68
@@ -1,68 +0,0 @@
|
|
1
|
-
module IsoDoc
|
2
|
-
class PresentationXMLConvert < ::IsoDoc::Convert
|
3
|
-
def concept(docxml)
|
4
|
-
docxml.xpath(ns("//concept")).each { |f| concept1(f) }
|
5
|
-
end
|
6
|
-
|
7
|
-
def concept1(node)
|
8
|
-
xref = node&.at(ns("./xref/@target"))&.text or
|
9
|
-
return concept_render(node, ital: node["ital"] || "true",
|
10
|
-
ref: node["ref"] || "true",
|
11
|
-
linkref: node["linkref"] || "true",
|
12
|
-
linkmention: node["linkmention"] || "false")
|
13
|
-
if node.at(ns("//definitions//dt[@id = '#{xref}']"))
|
14
|
-
concept_render(node, ital: node["ital"] || "false",
|
15
|
-
ref: node["ref"] || "false",
|
16
|
-
linkref: node["linkref"] || "true",
|
17
|
-
linkmention: node["linkmention"] || "false")
|
18
|
-
else concept_render(node, ital: node["ital"] || "true",
|
19
|
-
ref: node["ref"] || "true",
|
20
|
-
linkref: node["linkref"] || "true",
|
21
|
-
linkmention: node["linkmention"] || "false")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def concept_render(node, opts)
|
26
|
-
node&.at(ns("./refterm"))&.remove
|
27
|
-
r = node.at(ns("./renderterm"))
|
28
|
-
ref = node.at(ns("./xref | ./eref | ./termref"))
|
29
|
-
ref && opts[:ref] != "false" and r&.next = " "
|
30
|
-
opts[:ital] == "true" and r&.name = "em"
|
31
|
-
if opts[:linkmention] == "true" && !r.nil? && !ref.nil?
|
32
|
-
ref2 = ref.clone
|
33
|
-
r2 = r.clone
|
34
|
-
r.replace(ref2).children = r2
|
35
|
-
end
|
36
|
-
concept1_ref(node, ref, opts)
|
37
|
-
if opts[:ital] == "false"
|
38
|
-
r = node.at(ns(".//renderterm"))
|
39
|
-
r&.replace(r&.children)
|
40
|
-
end
|
41
|
-
node.replace(node.children)
|
42
|
-
end
|
43
|
-
|
44
|
-
def concept1_ref(_node, ref, opts)
|
45
|
-
ref.nil? and return
|
46
|
-
return ref.remove if opts[:ref] == "false"
|
47
|
-
|
48
|
-
r = concept1_ref_content(ref)
|
49
|
-
ref = r.at("./descendant-or-self::xmlns:xref | "\
|
50
|
-
"./descendant-or-self::xmlns:eref | "\
|
51
|
-
"./descendant-or-self::xmlns:termref")
|
52
|
-
%w(xref eref).include? ref&.name and get_linkend(ref)
|
53
|
-
if opts[:linkref] == "false" && %w(xref eref).include?(ref&.name)
|
54
|
-
ref.replace(ref.children)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def concept1_ref_content(ref)
|
59
|
-
if non_locality_elems(ref).select do |c|
|
60
|
-
!c.text? || /\S/.match(c)
|
61
|
-
end.empty?
|
62
|
-
ref.replace(@i18n.term_defined_in.sub(/%/,
|
63
|
-
ref.to_xml))
|
64
|
-
else ref.replace("[#{ref.to_xml}]")
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|