metanorma-standoc 1.3.28 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +8 -7
- data/.github/workflows/ubuntu.yml +14 -11
- data/.github/workflows/windows.yml +8 -8
- data/.gitignore +1 -0
- data/lib/asciidoctor/standoc/base.rb +29 -48
- data/lib/asciidoctor/standoc/biblio.rng +36 -6
- data/lib/asciidoctor/standoc/blocks.rb +32 -96
- data/lib/asciidoctor/standoc/blocks_notes.rb +89 -0
- data/lib/asciidoctor/standoc/cleanup.rb +12 -6
- data/lib/asciidoctor/standoc/cleanup_block.rb +5 -2
- data/lib/asciidoctor/standoc/cleanup_inline.rb +1 -1
- data/lib/asciidoctor/standoc/cleanup_ref.rb +47 -1
- data/lib/asciidoctor/standoc/cleanup_section.rb +8 -125
- data/lib/asciidoctor/standoc/cleanup_terms.rb +134 -0
- data/lib/asciidoctor/standoc/converter.rb +16 -0
- data/lib/asciidoctor/standoc/datamodel/attributes_table_preprocessor.rb +57 -0
- data/lib/asciidoctor/standoc/datamodel/diagram_preprocessor.rb +102 -0
- data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +408 -0
- data/lib/asciidoctor/standoc/inline.rb +11 -6
- data/lib/asciidoctor/standoc/isodoc.rng +444 -1
- data/lib/asciidoctor/standoc/lists.rb +12 -12
- data/lib/asciidoctor/standoc/macros.rb +13 -8
- data/lib/asciidoctor/standoc/macros_yaml2text.rb +44 -21
- data/lib/asciidoctor/standoc/ref.rb +78 -79
- data/lib/asciidoctor/standoc/ref_sect.rb +124 -0
- data/lib/asciidoctor/standoc/reqt.rb +11 -6
- data/lib/asciidoctor/standoc/reqt.rng +23 -0
- data/lib/asciidoctor/standoc/section.rb +2 -46
- data/lib/asciidoctor/standoc/table.rb +3 -2
- data/lib/asciidoctor/standoc/validate.rb +8 -2
- data/lib/asciidoctor/standoc/validate_section.rb +0 -2
- data/lib/asciidoctor/standoc/views/datamodel/model_representation.adoc.erb +30 -0
- data/lib/asciidoctor/standoc/views/datamodel/plantuml_representation.adoc.erb +20 -0
- data/lib/metanorma/standoc/processor.rb +5 -7
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +2 -2
- data/spec/asciidoctor-standoc/blocks_spec.rb +68 -23
- data/spec/asciidoctor-standoc/cleanup_spec.rb +85 -5
- data/spec/asciidoctor-standoc/datamodel/attributes_table_preprocessor_spec.rb +111 -0
- data/spec/asciidoctor-standoc/datamodel/diagram_preprocessor_spec.rb +72 -0
- data/spec/asciidoctor-standoc/inline_spec.rb +7 -3
- data/spec/asciidoctor-standoc/isobib_cache_spec.rb +4 -4
- data/spec/asciidoctor-standoc/lists_spec.rb +7 -5
- data/spec/asciidoctor-standoc/macros_spec.rb +54 -2
- data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +2 -1
- data/spec/asciidoctor-standoc/refs_dl_spec.rb +4 -2
- data/spec/asciidoctor-standoc/refs_spec.rb +283 -24
- data/spec/asciidoctor-standoc/table_spec.rb +3 -3
- data/spec/asciidoctor-standoc/validate_spec.rb +77 -7
- data/spec/assets/iso123.rxl +107 -0
- data/spec/assets/xref_error.adoc +7 -0
- data/spec/examples/datamodel/address_class_profile.adoc +4 -0
- data/spec/examples/datamodel/address_component_profile.adoc +4 -0
- data/spec/examples/datamodel/blank_definition_profile.adoc +4 -0
- data/spec/examples/datamodel/common_models_diagram.adoc +4 -0
- data/spec/examples/datamodel/models/models/AddressClassProfile.yml +90 -0
- data/spec/examples/datamodel/models/models/AddressComponentProfile.yml +63 -0
- data/spec/examples/datamodel/models/models/AddressComponentSpecification.yml +15 -0
- data/spec/examples/datamodel/models/models/AddressProfile.yml +36 -0
- data/spec/examples/datamodel/models/models/AttributeProfile.yml +32 -0
- data/spec/examples/datamodel/models/models/InterchangeAddressClassProfile.yml +79 -0
- data/spec/examples/datamodel/models/models/Localization copy.yml +23 -0
- data/spec/examples/datamodel/models/models/Localization.yml +23 -0
- data/spec/examples/datamodel/models/models/ProfileCompliantAddress.yml +36 -0
- data/spec/examples/datamodel/models/models/ProfileCompliantAddressComponent.yml +15 -0
- data/spec/examples/datamodel/models/models/Signature.yml +20 -0
- data/spec/examples/datamodel/models/models/SignatureBlankDefinition.yml +20 -0
- data/spec/examples/datamodel/models/models/TextDirectionCode copy.yml +16 -0
- data/spec/examples/datamodel/models/models/TextDirectionCode.yml +16 -0
- data/spec/examples/datamodel/models/models/Validity.yml +14 -0
- data/spec/examples/datamodel/models/models/iso19160-1/Address.yml +22 -0
- data/spec/examples/datamodel/models/models/iso19160-1/AddressComponent.yml +2 -0
- data/spec/examples/datamodel/models/style.uml.inc +37 -0
- data/spec/examples/datamodel/models/views/CommonModels.yml +9 -0
- data/spec/examples/datamodel/models/views/TopDown.yml +62 -0
- data/spec/examples/datamodel/top_down_diagram.adoc +4 -0
- data/spec/fixtures/macros_datamodel/address_class_profile.xml +149 -0
- data/spec/fixtures/macros_datamodel/address_component_profile.xml +71 -0
- data/spec/fixtures/macros_datamodel/blank_definition_profile.xml +51 -0
- data/spec/fixtures/macros_datamodel/common_models_diagram.xml +7 -0
- data/spec/fixtures/macros_datamodel/top_down_diagram.xml +7 -0
- data/spec/metanorma/processor_spec.rb +4 -4
- data/spec/spec_helper.rb +13 -2
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +85 -85
- data/spec/vcr_cassettes/isobib_get_123.yml +19 -198
- data/spec/vcr_cassettes/isobib_get_123_1.yml +361 -0
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +22 -22
- data/spec/vcr_cassettes/isobib_get_124.yml +21 -21
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +10 -10
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +47 -44
- metadata +53 -11
@@ -0,0 +1,124 @@
|
|
1
|
+
module Asciidoctor
|
2
|
+
module Standoc
|
3
|
+
module Section
|
4
|
+
def in_biblio?
|
5
|
+
@biblio
|
6
|
+
end
|
7
|
+
|
8
|
+
def in_norm_ref?
|
9
|
+
@norm_ref
|
10
|
+
end
|
11
|
+
|
12
|
+
def bibliography_parse(attrs, xml, node)
|
13
|
+
node.option? "bibitem" and return bibitem_parse(attrs, xml, node)
|
14
|
+
node.attr("style") == "bibliography" or
|
15
|
+
@log.add("AsciiDoc Input", node, "Section not marked up as [bibliography]!")
|
16
|
+
@biblio = true
|
17
|
+
xml.references **attr_code(attrs.merge(normative: false)) do |xml_section|
|
18
|
+
title = node.level == 1 ? "Bibliography" : node.title
|
19
|
+
xml_section.title { |t| t << title }
|
20
|
+
xml_section << node.content
|
21
|
+
end
|
22
|
+
@biblio = false
|
23
|
+
end
|
24
|
+
|
25
|
+
def bibitem_parse(attrs, xml, node)
|
26
|
+
norm_ref = @norm_ref
|
27
|
+
biblio = @biblio
|
28
|
+
@biblio = false
|
29
|
+
@norm_ref = false
|
30
|
+
clause_parse(attrs, xml, node)
|
31
|
+
@biblio = biblio
|
32
|
+
@norm_ref = norm_ref
|
33
|
+
end
|
34
|
+
|
35
|
+
def norm_ref_parse(attrs, xml, node)
|
36
|
+
node.option? "bibitem" and return bibitem_parse(attrs, xml, node)
|
37
|
+
node.attr("style") == "bibliography" or
|
38
|
+
@log.add("AsciiDoc Input", node, "Section not marked up as [bibliography]!")
|
39
|
+
@norm_ref = true
|
40
|
+
xml.references **attr_code(attrs.merge(normative: true)) do |xml_section|
|
41
|
+
xml_section.title { |t| t << "Normative References" }
|
42
|
+
xml_section << node.content
|
43
|
+
end
|
44
|
+
@norm_ref = false
|
45
|
+
end
|
46
|
+
|
47
|
+
def global_ievcache_name
|
48
|
+
"#{Dir.home}/.iev/cache"
|
49
|
+
end
|
50
|
+
|
51
|
+
def local_ievcache_name(cachename)
|
52
|
+
return nil if cachename.nil?
|
53
|
+
cachename += "_iev" unless cachename.empty?
|
54
|
+
cachename = "iev" if cachename.empty?
|
55
|
+
"#{cachename}/cache"
|
56
|
+
end
|
57
|
+
|
58
|
+
def fetch_ref(xml, code, year, **opts)
|
59
|
+
return nil if opts[:no_year]
|
60
|
+
code = code.sub(/^\([^)]+\)/, "")
|
61
|
+
hit = @bibdb&.fetch(code, year, opts)
|
62
|
+
return nil if hit.nil?
|
63
|
+
xml.parent.add_child(smart_render_xml(hit, code, opts[:title],
|
64
|
+
opts[:usrlbl]))
|
65
|
+
xml
|
66
|
+
rescue RelatonBib::RequestError
|
67
|
+
@log.add("Bibliography", nil, "Could not retrieve #{code}: "\
|
68
|
+
"no access to online site")
|
69
|
+
nil
|
70
|
+
end
|
71
|
+
|
72
|
+
def emend_biblio(xml, code, title, usrlbl)
|
73
|
+
unless xml.at("/bibitem/docidentifier[not(@type = 'DOI')][text()]")
|
74
|
+
@log.add("Bibliography", nil,
|
75
|
+
"ERROR: No document identifier retrieved for #{code}")
|
76
|
+
xml.root << "<docidentifier>#{code}</docidentifier>"
|
77
|
+
end
|
78
|
+
unless xml.at("/bibitem/title[text()]")
|
79
|
+
@log.add("Bibliography", nil,
|
80
|
+
"ERROR: No title retrieved for #{code}")
|
81
|
+
xml.root << "<title>#{title || "(MISSING TITLE)"}</title>"
|
82
|
+
end
|
83
|
+
usrlbl and xml.at("/bibitem/docidentifier").next =
|
84
|
+
"<docidentifier type='metanorma'>#{mn_code(usrlbl)}</docidentifier>"
|
85
|
+
end
|
86
|
+
|
87
|
+
def smart_render_xml(x, code, title, usrlbl)
|
88
|
+
xstr = x.to_xml if x.respond_to? :to_xml
|
89
|
+
xml = Nokogiri::XML(xstr)
|
90
|
+
emend_biblio(xml, code, title, usrlbl)
|
91
|
+
xml.xpath("//date").each { |d| Utils::endash_date(d) }
|
92
|
+
xml.traverse do |n|
|
93
|
+
n.text? and n.replace(Utils::smartformat(n.text))
|
94
|
+
end
|
95
|
+
xml.to_xml.sub(/<\?[^>]+>/, "")
|
96
|
+
end
|
97
|
+
|
98
|
+
def init_bib_caches(node)
|
99
|
+
return if @no_isobib
|
100
|
+
global = !@no_isobib_cache && !node.attr("local-cache-only")
|
101
|
+
local = node.attr("local-cache") || node.attr("local-cache-only")
|
102
|
+
local = nil if @no_isobib_cache
|
103
|
+
@bibdb = Relaton::DbCache.init_bib_caches(
|
104
|
+
local_cache: local,
|
105
|
+
flush_caches: node.attr("flush-caches"),
|
106
|
+
global_cache: global)
|
107
|
+
end
|
108
|
+
|
109
|
+
def init_iev_caches(node)
|
110
|
+
unless (@no_isobib_cache || @no_isobib)
|
111
|
+
node.attr("local-cache-only") or
|
112
|
+
@iev_globalname = global_ievcache_name
|
113
|
+
@iev_localname = local_ievcache_name(node.attr("local-cache") ||
|
114
|
+
node.attr("local-cache-only"))
|
115
|
+
if node.attr("flush-caches")
|
116
|
+
FileUtils.rm_f @iev_globalname unless @iev_globalname.nil?
|
117
|
+
FileUtils.rm_f @iev_localname unless @iev_localname.nil?
|
118
|
+
end
|
119
|
+
end
|
120
|
+
#@iev = Iev::Db.new(globalname, localname) unless @no_isobib
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -6,11 +6,15 @@ require "base64"
|
|
6
6
|
module Asciidoctor
|
7
7
|
module Standoc
|
8
8
|
module Blocks
|
9
|
+
def reqt_subpart_attrs(node)
|
10
|
+
attr_code(keep_attrs(node).merge(exclude: node.option?("exclude"),
|
11
|
+
type: node.attr("type")))
|
12
|
+
end
|
13
|
+
|
9
14
|
def requirement_subpart(node)
|
10
15
|
name = node.role || node.attr("style")
|
11
16
|
noko do |xml|
|
12
|
-
xml.send name, **
|
13
|
-
type: node.attr("type")) do |o|
|
17
|
+
xml.send name, **reqt_subpart_attrs(node) do |o|
|
14
18
|
o << node.content
|
15
19
|
end
|
16
20
|
end
|
@@ -35,22 +39,23 @@ module Asciidoctor
|
|
35
39
|
end
|
36
40
|
end
|
37
41
|
|
38
|
-
def
|
39
|
-
|
42
|
+
def reqt_attrs(node)
|
43
|
+
attr_code(keep_attrs(node).merge(id_unnum_attrs(node)).merge(
|
40
44
|
id: Utils::anchor_or_uuid(node),
|
41
45
|
unnumbered: node.option?("unnumbered") ? "true" : nil,
|
46
|
+
number: node.attr("number"),
|
42
47
|
subsequence: node.attr("subsequence"),
|
43
48
|
obligation: node.attr("obligation"),
|
44
49
|
filename: node.attr("filename"),
|
45
50
|
type: node.attr("type"),
|
46
51
|
model: node.attr("model"),
|
47
|
-
|
52
|
+
))
|
48
53
|
end
|
49
54
|
|
50
55
|
def requirement(node, obligation)
|
51
56
|
classif = node.attr("classification")
|
52
57
|
noko do |xml|
|
53
|
-
xml.send obligation, **
|
58
|
+
xml.send obligation, **reqt_attrs(node) do |ex|
|
54
59
|
node.title and ex.title { |t| t << node.title }
|
55
60
|
node.attr("label") and ex.label { |l| l << node.attr("label") }
|
56
61
|
node.attr("subject") and ex.subject { |s| s << node.attr("subject") }
|
@@ -30,9 +30,22 @@
|
|
30
30
|
<data type="boolean"/>
|
31
31
|
</attribute>
|
32
32
|
</optional>
|
33
|
+
<optional>
|
34
|
+
<attribute name="number"/>
|
35
|
+
</optional>
|
33
36
|
<optional>
|
34
37
|
<attribute name="subsequence"/>
|
35
38
|
</optional>
|
39
|
+
<optional>
|
40
|
+
<attribute name="keep-with-next">
|
41
|
+
<data type="boolean"/>
|
42
|
+
</attribute>
|
43
|
+
</optional>
|
44
|
+
<optional>
|
45
|
+
<attribute name="keep-lines-together">
|
46
|
+
<data type="boolean"/>
|
47
|
+
</attribute>
|
48
|
+
</optional>
|
36
49
|
<attribute name="id">
|
37
50
|
<data type="ID"/>
|
38
51
|
</attribute>
|
@@ -141,6 +154,16 @@
|
|
141
154
|
<data type="boolean"/>
|
142
155
|
</attribute>
|
143
156
|
</optional>
|
157
|
+
<optional>
|
158
|
+
<attribute name="keep-with-next">
|
159
|
+
<data type="boolean"/>
|
160
|
+
</attribute>
|
161
|
+
</optional>
|
162
|
+
<optional>
|
163
|
+
<attribute name="keep-lines-together">
|
164
|
+
<data type="boolean"/>
|
165
|
+
</attribute>
|
166
|
+
</optional>
|
144
167
|
<oneOrMore>
|
145
168
|
<ref name="BasicBlock"/>
|
146
169
|
</oneOrMore>
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require "htmlentities"
|
2
2
|
require "uri"
|
3
|
+
require_relative "ref_sect"
|
3
4
|
|
4
5
|
module Asciidoctor
|
5
6
|
module Standoc
|
@@ -8,18 +9,10 @@ module Asciidoctor
|
|
8
9
|
@term_def = false
|
9
10
|
@norm_ref = false
|
10
11
|
|
11
|
-
def in_biblio?
|
12
|
-
@biblio
|
13
|
-
end
|
14
|
-
|
15
12
|
def in_terms?
|
16
13
|
@term_def
|
17
14
|
end
|
18
15
|
|
19
|
-
def in_norm_ref?
|
20
|
-
@norm_ref
|
21
|
-
end
|
22
|
-
|
23
16
|
def sectiontype(node, level = true)
|
24
17
|
ret = node&.attr("heading")&.downcase ||
|
25
18
|
node.title.gsub(/<[^>]+>/, "").downcase
|
@@ -41,9 +34,7 @@ module Asciidoctor
|
|
41
34
|
"terms, definitions and abbreviated terms"
|
42
35
|
"terms and definitions"
|
43
36
|
when "symbols and abbreviated terms",
|
44
|
-
"symbols",
|
45
|
-
"abbreviated terms",
|
46
|
-
"abbreviations"
|
37
|
+
"symbols", "abbreviated terms", "abbreviations"
|
47
38
|
"symbols and abbreviated terms"
|
48
39
|
else
|
49
40
|
ret
|
@@ -148,19 +139,6 @@ module Asciidoctor
|
|
148
139
|
end
|
149
140
|
end
|
150
141
|
|
151
|
-
def bibliography_parse(attrs, xml, node)
|
152
|
-
node.option? "bibitem" and return bibitem_parse(attrs, xml, node)
|
153
|
-
node.attr("style") == "bibliography" or
|
154
|
-
@log.add("AsciiDoc Input", node, "Section not marked up as [bibliography]!")
|
155
|
-
@biblio = true
|
156
|
-
xml.references **attr_code(attrs.merge(normative: false)) do |xml_section|
|
157
|
-
title = node.level == 1 ? "Bibliography" : node.title
|
158
|
-
xml_section.title { |t| t << title }
|
159
|
-
xml_section << node.content
|
160
|
-
end
|
161
|
-
@biblio = false
|
162
|
-
end
|
163
|
-
|
164
142
|
def nonterm_symbols_parse(attrs, xml, node)
|
165
143
|
@definitions = false
|
166
144
|
clause_parse(attrs, xml, node)
|
@@ -236,28 +214,6 @@ module Asciidoctor
|
|
236
214
|
end
|
237
215
|
end
|
238
216
|
|
239
|
-
def bibitem_parse(attrs, xml, node)
|
240
|
-
norm_ref = @norm_ref
|
241
|
-
biblio = @biblio
|
242
|
-
@biblio = false
|
243
|
-
@norm_ref = false
|
244
|
-
clause_parse(attrs, xml, node)
|
245
|
-
@biblio = biblio
|
246
|
-
@norm_ref = norm_ref
|
247
|
-
end
|
248
|
-
|
249
|
-
def norm_ref_parse(attrs, xml, node)
|
250
|
-
node.option? "bibitem" and return bibitem_parse(attrs, xml, node)
|
251
|
-
node.attr("style") == "bibliography" or
|
252
|
-
@log.add("AsciiDoc Input", node, "Section not marked up as [bibliography]!")
|
253
|
-
@norm_ref = true
|
254
|
-
xml.references **attr_code(attrs.merge(normative: true)) do |xml_section|
|
255
|
-
xml_section.title { |t| t << "Normative References" }
|
256
|
-
xml_section << node.content
|
257
|
-
end
|
258
|
-
@norm_ref = false
|
259
|
-
end
|
260
|
-
|
261
217
|
def introduction_parse(attrs, xml, node)
|
262
218
|
xml.introduction **attr_code(attrs) do |xml_section|
|
263
219
|
xml_section.title { |t| t << "Introduction" }
|
@@ -2,14 +2,15 @@ module Asciidoctor
|
|
2
2
|
module Standoc
|
3
3
|
module Table
|
4
4
|
def table_attrs(node)
|
5
|
-
|
5
|
+
keep_attrs(node).merge( id: Utils::anchor_or_uuid(node),
|
6
6
|
headerrows: node.attr("headerrows"),
|
7
7
|
unnumbered: node.option?("unnumbered") ? "true" : nil,
|
8
|
+
number: node.attr("number"),
|
8
9
|
subsequence: node.attr("subsequence"),
|
9
10
|
alt: node.attr("alt"),
|
10
11
|
summary: node.attr("summary"),
|
11
12
|
width: node.attr("width"),
|
12
|
-
|
13
|
+
)
|
13
14
|
end
|
14
15
|
|
15
16
|
def table(node)
|
@@ -25,7 +25,6 @@ module Asciidoctor
|
|
25
25
|
@iev = init_iev or return
|
26
26
|
iev = @iev.fetch(locality, xmldoc&.at("//language")&.text || "en") or next
|
27
27
|
pref.include?(iev.downcase) or
|
28
|
-
#warn %(Term "#{pref[0]}" does not match IEV #{locality} "#{iev}")
|
29
28
|
@log.add("Bibliography", t, %(Term "#{pref[0]}" does not match IEV #{locality} "#{iev}"))
|
30
29
|
end
|
31
30
|
end
|
@@ -38,14 +37,20 @@ module Asciidoctor
|
|
38
37
|
|
39
38
|
def repeat_id_validate(doc)
|
40
39
|
ids = {}
|
40
|
+
crash = false
|
41
41
|
doc.xpath("//*[@id]").each do |x|
|
42
42
|
if ids[x["id"]]
|
43
|
-
|
43
|
+
@log.add("Anchors", x, "Anchor #{x['id']} has already been used at line #{ids[x['id']]}")
|
44
|
+
crash = true
|
44
45
|
else
|
45
46
|
ids[x["id"]] = x.line
|
46
47
|
end
|
47
48
|
end
|
49
|
+
if crash
|
50
|
+
clean_exit
|
51
|
+
abort("Cannot deal with multiple instances of same ID")
|
48
52
|
end
|
53
|
+
end
|
49
54
|
|
50
55
|
def schema_validate(doc, schema)
|
51
56
|
Tempfile.open(["tmp", ".xml"], :encoding => 'UTF-8') do |f|
|
@@ -58,6 +63,7 @@ module Asciidoctor
|
|
58
63
|
@log.add("Syntax", "XML Line #{"%06d" % error[:line]}:#{error[:column]}", error[:message])
|
59
64
|
end
|
60
65
|
rescue Jing::Error => e
|
66
|
+
clean_exit
|
61
67
|
abort "Jing failed with error: #{e}"
|
62
68
|
ensure
|
63
69
|
f.close!
|
@@ -14,7 +14,6 @@ module Asciidoctor
|
|
14
14
|
callouts = x.elements.select { |e| e.name == "callout" }
|
15
15
|
annotations = x.elements.select { |e| e.name == "annotation" }
|
16
16
|
if callouts.size != annotations.size
|
17
|
-
#warn "#{x['id']}: mismatch of callouts and annotations"
|
18
17
|
@log.add("AsciiDoc Input", x, "mismatch of callouts and annotations")
|
19
18
|
end
|
20
19
|
end
|
@@ -23,7 +22,6 @@ module Asciidoctor
|
|
23
22
|
def style_warning(node, msg, text = nil)
|
24
23
|
w = msg
|
25
24
|
w += ": #{text}" if text
|
26
|
-
#warn w
|
27
25
|
@log.add("Style Warning", node, w)
|
28
26
|
end
|
29
27
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
[yaml2text,<%= model_path %>,definition]
|
3
|
+
----
|
4
|
+
|
5
|
+
=== {definition.name || "<%= file_name %>"}
|
6
|
+
{definition.definition}
|
7
|
+
|
8
|
+
{if definition.attributes}
|
9
|
+
.{definition.name || "<%= file_name %>"} attributes
|
10
|
+
|===
|
11
|
+
|Name |Definition |Mandatory/ Optional/ Conditional |Max Occur |Data Type
|
12
|
+
|
13
|
+
{definition.attributes&.*,key,EOK}
|
14
|
+
|{key} |{definition.attributes[key].definition || "TODO: enum " + key.to_s + "'s definition"} |{definition.attributes[key]&.cardinality&.min == 0 ? "O" : "M"} |{definition.attributes[key]&.cardinality&.max == "*" ? "N" : "1"} |{definition.attributes[key].origin ? "<<" + definition.attributes[key].origin.to_s + ">>" : ""}`{definition.attributes[key].type}`
|
15
|
+
{EOK}
|
16
|
+
|===
|
17
|
+
{end}
|
18
|
+
|
19
|
+
{if definition['values']}
|
20
|
+
.{definition.name || "<%= file_name %>"} values
|
21
|
+
|===
|
22
|
+
|Name |Definition
|
23
|
+
|
24
|
+
{definition['values']&.*,key,EOK}
|
25
|
+
|{key} |{definition['values'][key].definition}
|
26
|
+
{EOK}
|
27
|
+
|===
|
28
|
+
{end}
|
29
|
+
|
30
|
+
----
|
@@ -0,0 +1,20 @@
|
|
1
|
+
[plantuml,title=<%= diagram_caption %>]
|
2
|
+
....
|
3
|
+
@startuml
|
4
|
+
|
5
|
+
<%= diagram_options_yml_to_plantuml %>
|
6
|
+
|
7
|
+
<%= class_groups_yml_to_plantuml %>
|
8
|
+
|
9
|
+
<%= imports_yml_to_plantuml %>
|
10
|
+
|
11
|
+
<%= class_defs_yml_to_plantuml %>
|
12
|
+
|
13
|
+
<%= class_relations_yml_to_plantuml %>
|
14
|
+
|
15
|
+
<%= fidelity_yml_to_plantuml %>
|
16
|
+
|
17
|
+
<%= bottom_yml_to_plantuml %>
|
18
|
+
|
19
|
+
@enduml
|
20
|
+
....
|
@@ -21,16 +21,14 @@ module Metanorma
|
|
21
21
|
"Metanorma::Standoc #{Metanorma::Standoc::VERSION}/IsoDoc #{IsoDoc::VERSION}"
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
25
|
-
Metanorma::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
|
26
|
-
end
|
27
|
-
|
28
|
-
def output(isodoc_node, outname, format, options={})
|
24
|
+
def output(isodoc_node, inname, outname, format, options={})
|
29
25
|
case format
|
30
26
|
when :html
|
31
|
-
IsoDoc::HtmlConvert.new(options).convert(
|
27
|
+
IsoDoc::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
32
28
|
when :doc
|
33
|
-
IsoDoc::WordConvert.new(options).convert(
|
29
|
+
IsoDoc::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
30
|
+
when :presentation
|
31
|
+
IsoDoc::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
34
32
|
else
|
35
33
|
super
|
36
34
|
end
|