metanorma-jis 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/jis/html/header.html +70 -33
- data/lib/isodoc/jis/html/wordstyle.css +10 -13
- data/lib/isodoc/jis/html/wordstyle.scss +10 -13
- data/lib/isodoc/jis/jis.international-standard.xsl +620 -66
- data/lib/isodoc/jis/presentation_xml_convert.rb +6 -0
- data/lib/isodoc/jis/word_convert.rb +1 -0
- data/lib/isodoc/jis/xref.rb +42 -0
- data/lib/metanorma/jis/cleanup.rb +23 -0
- data/lib/metanorma/jis/converter.rb +5 -0
- data/lib/metanorma/jis/isodoc.rng +23 -1
- data/lib/metanorma/jis/version.rb +1 -1
- data/metanorma-jis.gemspec +2 -0
- metadata +2 -2
@@ -172,6 +172,7 @@ module IsoDoc
|
|
172
172
|
|
173
173
|
def commentary(isoxml, out)
|
174
174
|
isoxml.xpath(ns("//annex[@commentary = 'true']")).each do |c|
|
175
|
+
out.span style: "mso-bookmark:PRECOMMENTARYPAGEREF"
|
175
176
|
section_break(out)
|
176
177
|
out.div class: "WordSectionCommentary" do |div|
|
177
178
|
commentary_title(isoxml, div)
|
data/lib/isodoc/jis/xref.rb
CHANGED
@@ -1,6 +1,19 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module JIS
|
3
3
|
class Counter < IsoDoc::XrefGen::Counter
|
4
|
+
def ol_type(list, depth)
|
5
|
+
return list["type"].to_sym if list["type"]
|
6
|
+
return :alphabet if depth == 1
|
7
|
+
|
8
|
+
:arabic
|
9
|
+
end
|
10
|
+
|
11
|
+
def listlabel(_list, depth)
|
12
|
+
case depth
|
13
|
+
when 1 then (96 + @num).chr.to_s
|
14
|
+
else @num.to_s
|
15
|
+
end
|
16
|
+
end
|
4
17
|
end
|
5
18
|
|
6
19
|
class Xref < IsoDoc::Iso::Xref
|
@@ -53,6 +66,35 @@ module IsoDoc
|
|
53
66
|
title: clause_title(clause), level: level, type: "clause",
|
54
67
|
elem: @labels["clause"] }
|
55
68
|
end
|
69
|
+
|
70
|
+
def list_item_anchor_names(list, list_anchor, depth, prev_label,
|
71
|
+
refer_list)
|
72
|
+
c = Counter.new(list["start"] ? list["start"].to_i - 1 : 0)
|
73
|
+
list.xpath(ns("./li")).each do |li|
|
74
|
+
bare_label, label = list_item_value(li, c, depth,
|
75
|
+
{ list_anchor: list_anchor, prev_label: prev_label, refer_list: refer_list })
|
76
|
+
li["id"] and @anchors[li["id"]] =
|
77
|
+
{ label: bare_label, bare_xref: "#{bare_label})",
|
78
|
+
xref: "#{label})", type: "listitem", refer_list:
|
79
|
+
refer_list, container: list_anchor[:container] }
|
80
|
+
(li.xpath(ns(".//ol")) - li.xpath(ns(".//ol//ol"))).each do |ol|
|
81
|
+
list_item_anchor_names(ol, list_anchor, depth + 1, label, false)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def list_item_value(entry, counter, depth, opts)
|
87
|
+
label1 = counter.increment(entry).listlabel(entry.parent, depth)
|
88
|
+
if depth > 2
|
89
|
+
base = opts[:prev_label].match(/^(.*?)([0-9.]+)$/) # a) 1.1.1
|
90
|
+
label1 = "#{base[2]}.#{label1}"
|
91
|
+
[label1, list_item_anchor_label(label1, opts[:list_anchor],
|
92
|
+
base[1].sub(/[^a-z0-9]*$/, ""), opts[:refer_list])]
|
93
|
+
else
|
94
|
+
[label1, list_item_anchor_label(label1, opts[:list_anchor], opts[:prev_label],
|
95
|
+
opts[:refer_list])]
|
96
|
+
end
|
97
|
+
end
|
56
98
|
end
|
57
99
|
end
|
58
100
|
end
|
@@ -38,6 +38,29 @@ module Metanorma
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def docidentifier_cleanup(xmldoc); end
|
41
|
+
|
42
|
+
def note_cleanup(xmldoc)
|
43
|
+
note_example_to_table(xmldoc)
|
44
|
+
super
|
45
|
+
clean_example_keep_separate(xmldoc)
|
46
|
+
end
|
47
|
+
|
48
|
+
def note_example_to_table(xmldoc)
|
49
|
+
xmldoc.xpath("//table").each do |t|
|
50
|
+
t.xpath("./following-sibling::*").each do |n|
|
51
|
+
%w(note example).include?(n.name) or break
|
52
|
+
n["keep-separate"] == "true" and break
|
53
|
+
n.parent = t
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def clean_example_keep_separate(xmldoc)
|
59
|
+
xmldoc.xpath("//example[@keep-separate] | " \
|
60
|
+
"//termexample[@keep-separate]").each do |n|
|
61
|
+
n.delete("keep-separate")
|
62
|
+
end
|
63
|
+
end
|
41
64
|
end
|
42
65
|
end
|
43
66
|
end
|
@@ -39,6 +39,11 @@ module Metanorma
|
|
39
39
|
ret
|
40
40
|
end
|
41
41
|
|
42
|
+
def example_attrs(node)
|
43
|
+
attr_code(id_unnum_attrs(node).merge(keep_attrs(node))
|
44
|
+
.merge("keep-separate": node.attr("keep-separate")))
|
45
|
+
end
|
46
|
+
|
42
47
|
def html_converter(node)
|
43
48
|
if node.nil?
|
44
49
|
IsoDoc::JIS::HtmlConvert.new({})
|
@@ -17,7 +17,7 @@
|
|
17
17
|
these elements; we just want one namespace for any child grammars
|
18
18
|
of this.
|
19
19
|
-->
|
20
|
-
<!-- VERSION v1.2.
|
20
|
+
<!-- VERSION v1.2.2 -->
|
21
21
|
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
22
22
|
<include href="reqt.rng"/>
|
23
23
|
<include href="basicdoc.rng">
|
@@ -211,6 +211,9 @@
|
|
211
211
|
<data type="boolean"/>
|
212
212
|
</attribute>
|
213
213
|
</optional>
|
214
|
+
<optional>
|
215
|
+
<attribute name="style"/>
|
216
|
+
</optional>
|
214
217
|
<ref name="CitationType"/>
|
215
218
|
<oneOrMore>
|
216
219
|
<ref name="PureTextElement"/>
|
@@ -1009,6 +1012,7 @@
|
|
1009
1012
|
<ref name="del"/>
|
1010
1013
|
<ref name="span"/>
|
1011
1014
|
<ref name="erefstack"/>
|
1015
|
+
<ref name="date_inline"/>
|
1012
1016
|
</choice>
|
1013
1017
|
</define>
|
1014
1018
|
<define name="add">
|
@@ -1050,6 +1054,23 @@
|
|
1050
1054
|
</oneOrMore>
|
1051
1055
|
</element>
|
1052
1056
|
</define>
|
1057
|
+
<define name="date_inline">
|
1058
|
+
<element name="date">
|
1059
|
+
<attribute name="value"/>
|
1060
|
+
<optional>
|
1061
|
+
<attribute name="format"/>
|
1062
|
+
</optional>
|
1063
|
+
<optional>
|
1064
|
+
<attribute name="language"/>
|
1065
|
+
</optional>
|
1066
|
+
<optional>
|
1067
|
+
<attribute name="script"/>
|
1068
|
+
</optional>
|
1069
|
+
<optional>
|
1070
|
+
<attribute name="locale"/>
|
1071
|
+
</optional>
|
1072
|
+
</element>
|
1073
|
+
</define>
|
1053
1074
|
<define name="concept">
|
1054
1075
|
<element name="concept">
|
1055
1076
|
<optional>
|
@@ -2136,6 +2157,7 @@
|
|
2136
2157
|
<choice>
|
2137
2158
|
<value>identical</value>
|
2138
2159
|
<value>modified</value>
|
2160
|
+
<value>adapted</value>
|
2139
2161
|
<value>restyled</value>
|
2140
2162
|
<value>context-added</value>
|
2141
2163
|
<value>generalisation</value>
|
data/metanorma-jis.gemspec
CHANGED
@@ -31,6 +31,8 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
32
32
|
|
33
33
|
spec.add_dependency "metanorma-iso", "~> 2.4.2"
|
34
|
+
#spec.add_dependency "relaton-bipm", "~> 1.14.8"
|
35
|
+
#spec.add_dependency "relaton-iho", "~> 1.14.3"
|
34
36
|
spec.add_dependency "pubid-jis"
|
35
37
|
|
36
38
|
spec.add_development_dependency "debug"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-jis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
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-
|
11
|
+
date: 2023-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-iso
|