isodoc 3.1.2 → 3.1.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cc231c707c79c5af17d4a07818b64395a13328377f6ab4521e2cdfe1ad8c884
|
4
|
+
data.tar.gz: 1b6a810aae9f30c35eeea2f59daddc10d62d63cfd3efd3a0c0813c1c6a7b8bf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4403a6d48af622fc31f0829683d4c11d2c76226a15f877deb449eaf8fcdf37e9b7fe55b25225ac1889fc2d3a15eda554d568efb9a988def3fe7bdc3e4d1632fc
|
7
|
+
data.tar.gz: 3365c6b7317a602ea24bf62d3ccc73cadd8ac3b872735945388172f029c0b02460e8f2337f95a192b786057ea69045acc4917a7454c4145bb670777da770ce9e
|
@@ -52,8 +52,8 @@ module IsoDoc
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def clause_title_depth(node, title)
|
55
|
-
depth = node.ancestors(sections_names.join(", ")).size + 1
|
56
55
|
depth = title["depth"] if title && title["depth"]
|
56
|
+
depth = node.ancestors(sections_names.join(", ")).size + 1 unless depth
|
57
57
|
depth
|
58
58
|
end
|
59
59
|
|
@@ -70,14 +70,15 @@ module IsoDoc
|
|
70
70
|
|
71
71
|
# do not change to Presentation XML rendering
|
72
72
|
def sem_xml_descendant?(node)
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
73
|
+
ancestor_names = node.ancestors.map(&:name)
|
74
|
+
|
75
|
+
return true if %w[preferred admitted deprecated related definition termsource].any? { |name| ancestor_names.include?(name) }
|
76
|
+
return true if %w[xref eref origin link name title].any? { |name| ancestor_names.include?(name) }
|
77
|
+
return true if ancestor_names.include?("bibitem") &&
|
78
|
+
!%w[formattedref biblio-tag].any? { |name| ancestor_names.include?(name) }
|
79
|
+
return true if (ancestor_names & %w[requirement recommendation permission]).any? &&
|
80
|
+
!ancestor_names.include?("fmt-provision")
|
81
|
+
|
81
82
|
false
|
82
83
|
end
|
83
84
|
|
@@ -15,11 +15,25 @@ module IsoDoc
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def unnumbered_clause?(elem)
|
18
|
-
|
18
|
+
numbered_clause_invalid_context?(elem) ||
|
19
19
|
@suppressheadingnumbers || elem["unnumbered"] ||
|
20
20
|
elem.at("./ancestor::*[@unnumbered = 'true']")
|
21
21
|
end
|
22
22
|
|
23
|
+
# context in which clause numbering is invalid:
|
24
|
+
# metanorma-extension, boilerplate
|
25
|
+
def numbered_clause_invalid_context?(elem)
|
26
|
+
@ncic_cache ||= {}
|
27
|
+
elem or return false
|
28
|
+
@ncic_cache.key?(elem) and return @ncic_cache[elem]
|
29
|
+
if ["metanorma-extension", "boilerplate"].include?(elem.name)
|
30
|
+
@ncic_cache[elem] = true
|
31
|
+
else
|
32
|
+
elem.respond_to?(:parent) or return false
|
33
|
+
@ncic_cache[elem] = numbered_clause_invalid_context?(elem.parent)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
23
37
|
def clausedelim
|
24
38
|
ret = super
|
25
39
|
ret && !ret.empty? or return ret
|
@@ -29,8 +43,9 @@ module IsoDoc
|
|
29
43
|
def clause1(elem)
|
30
44
|
level = @xrefs.anchor(elem["id"], :level, false) ||
|
31
45
|
(elem.ancestors("clause, annex").size + 1)
|
32
|
-
|
33
|
-
|
46
|
+
is_unnumbered = unnumbered_clause?(elem)
|
47
|
+
lbl = @xrefs.anchor(elem["id"], :label, !is_unnumbered)
|
48
|
+
if is_unnumbered || !lbl
|
34
49
|
prefix_name(elem, {}, nil, "title")
|
35
50
|
else
|
36
51
|
prefix_name(elem, { caption: "<tab/>" }, "#{lbl}#{clausedelim}",
|
@@ -132,10 +147,10 @@ module IsoDoc
|
|
132
147
|
clauses.empty? and return
|
133
148
|
preface = clauses.first.parent
|
134
149
|
clauses.each do |clause|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
150
|
+
float = preceding_floats(clause)
|
151
|
+
xpath = after.map { |n| "./self::xmlns:#{n}" }.join(" | ")
|
152
|
+
xpath.empty? and xpath = "./self::*[not(following-sibling::*)]"
|
153
|
+
preface_move1(clause, preface, float, nil, xpath)
|
139
154
|
end
|
140
155
|
end
|
141
156
|
|
data/lib/isodoc/version.rb
CHANGED