metanorma-gb 1.3.22 → 1.3.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/gb/isodoc.rng +6 -3
- data/lib/asciidoctor/gb/section_input.rb +2 -94
- data/lib/metanorma/gb/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: cee97909f541eb359323b825088997bfa0e320c8f857df31b681aad62df09381
|
4
|
+
data.tar.gz: b04990abaad05e36461b386a105e9957845d7c43df62e0facbf28bc7e759cecc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e5d3974a43321800525dd6280d9d970c821a4d6ef097658b13394086cccdb20193b07b3cfb32243d18139b32435ac0692dac22cd499ca40d5d3198452e4cbf3
|
7
|
+
data.tar.gz: fd97e5ce4f8f297ad337fc0cf160a721ee4dcf42192a949930ec825e6754f6bf00799d8055e3c8af30c224e0693f02abda8e1b45a697f73699b3dded7f852c8c
|
@@ -129,6 +129,9 @@
|
|
129
129
|
</choice>
|
130
130
|
</attribute>
|
131
131
|
</optional>
|
132
|
+
<attribute name="normative">
|
133
|
+
<data type="boolean"/>
|
134
|
+
</attribute>
|
132
135
|
<optional>
|
133
136
|
<ref name="section-title"/>
|
134
137
|
</optional>
|
@@ -303,11 +306,11 @@
|
|
303
306
|
<ref name="paragraph"/>
|
304
307
|
</element>
|
305
308
|
</define>
|
306
|
-
<define name="TextElement" combine="choice">
|
307
|
-
<ref name="concept"/>
|
308
|
-
</define>
|
309
309
|
</include>
|
310
310
|
<!-- end overrides -->
|
311
|
+
<define name="TextElement" combine="choice">
|
312
|
+
<ref name="concept"/>
|
313
|
+
</define>
|
311
314
|
<define name="concept">
|
312
315
|
<element name="concept">
|
313
316
|
<optional>
|
@@ -6,24 +6,6 @@ module Asciidoctor
|
|
6
6
|
# A {Converter} implementation that generates GB output, and a document
|
7
7
|
# schema encapsulation of the document for validation
|
8
8
|
class Converter < ISO::Converter
|
9
|
-
|
10
|
-
=begin
|
11
|
-
# subclause contains subclauses
|
12
|
-
def term_def_subclause_parse(attrs, xml, node)
|
13
|
-
return clause_parse(attrs, xml, node) if node.role == "nonterm"
|
14
|
-
sub = node.find_by(context: :section) {|s| s.level == node.level + 1 }
|
15
|
-
sub.empty? || (return term_def_parse(attrs, xml, node, false))
|
16
|
-
# TODO allow breakup of "symbols", "abbreviated terms"
|
17
|
-
(node.title.downcase == "symbols and abbreviated terms" ||
|
18
|
-
node.title == "符号、代号和缩略语") &&
|
19
|
-
(return symbols_parse(attrs, xml, node))
|
20
|
-
xml.term **attr_code(attrs) do |xml_section|
|
21
|
-
xml_section.preferred { |name| name << node.title }
|
22
|
-
xml_section << node.content
|
23
|
-
end
|
24
|
-
end
|
25
|
-
=end
|
26
|
-
|
27
9
|
def sectiontype_streamline(ret)
|
28
10
|
case ret
|
29
11
|
when "引言" then "introduction"
|
@@ -40,84 +22,10 @@ module Asciidoctor
|
|
40
22
|
end
|
41
23
|
|
42
24
|
def appendix_parse(attrs, xml, node)
|
25
|
+
# UNSAFE, there is no unset_option() in asciidoctor
|
26
|
+
node.remove_attr("appendix-option")
|
43
27
|
clause_parse(attrs, xml, node)
|
44
28
|
end
|
45
|
-
|
46
|
-
=begin
|
47
|
-
# spec of permissible section sequence
|
48
|
-
SEQ = [
|
49
|
-
{ msg: "Initial section must be (content) 前言",
|
50
|
-
val: [{ tag: "foreword", title: "前言" }], },
|
51
|
-
{ msg: "Prefatory material must be followed by (clause) 范围",
|
52
|
-
val: [{ tag: "introduction", title: "引言" },
|
53
|
-
{ tag: "clause", title: "范围" }], },
|
54
|
-
{ msg: "Prefatory material must be followed by (clause) 范围",
|
55
|
-
val: [{ tag: "clause", title: "范围" }], },
|
56
|
-
{ msg: "规范性引用文件 must be followed by "\
|
57
|
-
"术语和定义",
|
58
|
-
val: [
|
59
|
-
{ tag: "terms", title: "术语和定义" },
|
60
|
-
{ tag: "clause", title: "术语和定义" },
|
61
|
-
{ tag: "clause",
|
62
|
-
title: "术语、定义、符号、代号和缩略语" },
|
63
|
-
{ tag: "terms",
|
64
|
-
title: "术语、定义、符号、代号和缩略语" }
|
65
|
-
] },
|
66
|
-
]
|
67
|
-
|
68
|
-
SECTIONS_XPATH =
|
69
|
-
"//foreword | //introduction | //sections/terms | .//annex | "\
|
70
|
-
"//definitions | //sections/clause | //references[not(parent::clause)] | "\
|
71
|
-
"//clause[descendant::references][not(parent::clause)]".freeze
|
72
|
-
|
73
|
-
def sections_sequence_validate(root)
|
74
|
-
f = root.xpath(SECTIONS_XPATH)
|
75
|
-
names = f.map { |s| { tag: s.name, title: s&.at("./title")&.text } }
|
76
|
-
names = seqcheck(names, SEQ[0][:msg], SEQ[0][:val]) || return
|
77
|
-
n = names[0]
|
78
|
-
names = seqcheck(names, SEQ[1][:msg], SEQ[1][:val]) || return
|
79
|
-
if n == { tag: "introduction", title: "引言" }
|
80
|
-
names = seqcheck(names, SEQ[2][:msg], SEQ[2][:val]) || return
|
81
|
-
end
|
82
|
-
names = seqcheck(names, SEQ[3][:msg], SEQ[3][:val]) || return
|
83
|
-
n = names.shift
|
84
|
-
if n == { tag: "definitions", title: nil }
|
85
|
-
n = names.shift || return
|
86
|
-
end
|
87
|
-
unless n
|
88
|
-
warn "ISO style: Document must contain at least one clause"
|
89
|
-
return
|
90
|
-
end
|
91
|
-
n[:tag] == "clause" or
|
92
|
-
warn "ISO style: Document must contain clause after Terms and Definitions"
|
93
|
-
(n == { tag: "clause", title: "范围" }) &&
|
94
|
-
warn("ISO style: 范围 must occur before 术语和定义")
|
95
|
-
n = names.shift or return
|
96
|
-
while n[:tag] == "clause"
|
97
|
-
(n[:title] == "范围") &&
|
98
|
-
warn("ISO style: 范围 must occur before 术语和定义")
|
99
|
-
n = names.shift or return
|
100
|
-
end
|
101
|
-
unless n[:tag] == "annex" or n[:tag] == "references"
|
102
|
-
warn "ISO style: Only annexes and references can follow clauses"
|
103
|
-
end
|
104
|
-
while n[:tag] == "annex"
|
105
|
-
n = names.shift
|
106
|
-
if n.nil?
|
107
|
-
warn("ISO style: Document must include (references) "\
|
108
|
-
"Normative References")
|
109
|
-
return
|
110
|
-
end
|
111
|
-
end
|
112
|
-
n == { tag: "references", title: "规范性引用文件" } or
|
113
|
-
warn "ISO style: Document must include (references) 规范性引用文件"
|
114
|
-
n = names.shift
|
115
|
-
n == { tag: "references", title: "参考文献" } or
|
116
|
-
warn "ISO style: Final section must be (references) 参考文献"
|
117
|
-
names.empty? or
|
118
|
-
warn "ISO style: There are sections after the final Bibliography"
|
119
|
-
end
|
120
|
-
=end
|
121
29
|
end
|
122
30
|
end
|
123
31
|
end
|
data/lib/metanorma/gb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-gb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-iso
|