metanorma-standoc 1.6.3 → 1.6.4

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: 6ca3aedd38f18114d3fb4c86c797294a3f1fb4fced3dbe22141980ad899df051
4
- data.tar.gz: b885be1a706d741781853f85df50fe988b9ed93d31f15f6458c3f8debe8ab704
3
+ metadata.gz: e30bd97d527914e60d6dfcd537620ba7d2d5ae82d9d9c07e24d5a535dd9ec8ee
4
+ data.tar.gz: b8774965fcb7e698288f1793460fd67b982085e8d0951b35cfa6c4f102157e9a
5
5
  SHA512:
6
- metadata.gz: b679c9834b6a85dcbbb743a50f4fe4cae499cf6bc8f6bebe2c58545bc09b282fe2c529068fa8db2a3027023f983f6b589a1b1883b356f18710d34cbdf8e13ce4
7
- data.tar.gz: 583bc49e6a03656378f097a2acfa91578699d04be365bd92e3515b0252a940104efddf778ef79784fa27e06997345505a8527c530a86cdeaf3d13c78cc644e1f
6
+ metadata.gz: 74e250a48b25dd82c3174b78b515e57fe11bc3f4f8767d6942048bb3ef01ddf6937a6c2ff24ddb5e17d8f747eeb582b77248b28bdf50bc120a3fcfafd6f78221
7
+ data.tar.gz: a0fe35b39a730d18afe1cc7463b166377adb2137c4cfd9c650844e3a593e1a2312fa8242a8991a1508aaed44b7b7525a54cad7f747a177ea2848b27720cf644d
@@ -36,7 +36,7 @@ jobs:
36
36
  with:
37
37
  ruby-version: ${{ matrix.ruby }}
38
38
 
39
- - uses: actions/cache@v1
39
+ - uses: actions/cache@v2
40
40
  with:
41
41
  path: vendor/bundle
42
42
  key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
@@ -82,7 +82,21 @@ module Asciidoctor
82
82
  end
83
83
  end
84
84
 
85
+ def footnote_block_cleanup(xmldoc)
86
+ xmldoc.xpath("//footnoteblock").each do |f|
87
+ f.name = 'fn'
88
+ if id = xmldoc.at("//*[@id = '#{f.text}']")
89
+ f.children = id.remove.children
90
+ else
91
+ @log.add("Crossreferences", f,
92
+ "Could not resolve footnoteblock:[#{f.text}]")
93
+ f.children = "[ERROR]"
94
+ end
95
+ end
96
+ end
97
+
85
98
  def footnote_cleanup(xmldoc)
99
+ footnote_block_cleanup(xmldoc)
86
100
  title_footnote_move(xmldoc)
87
101
  table_footnote_renumber(xmldoc)
88
102
  other_footnote_renumber(xmldoc)
@@ -1,4 +1,7 @@
1
1
  require "asciidoctor"
2
+ require "fontist"
3
+ require "fontist/manifest/install"
4
+ require "metanorma/util"
2
5
  require "metanorma/standoc/version"
3
6
  require "asciidoctor/standoc/base"
4
7
  require "asciidoctor/standoc/front"
@@ -26,6 +29,7 @@ module Asciidoctor
26
29
  preprocessor Metanorma::Plugin::Datastruct::Json2TextPreprocessor
27
30
  preprocessor Metanorma::Plugin::Datastruct::Yaml2TextPreprocessor
28
31
  preprocessor Metanorma::Plugin::Lutaml::LutamlPreprocessor
32
+ preprocessor Metanorma::Plugin::Lutaml::LutamlUmlAttributesTablePreprocessor
29
33
  inline_macro Asciidoctor::Standoc::AltTermInlineMacro
30
34
  inline_macro Asciidoctor::Standoc::DeprecatedTermInlineMacro
31
35
  inline_macro Asciidoctor::Standoc::DomainTermInlineMacro
@@ -34,9 +38,11 @@ module Asciidoctor
34
38
  inline_macro Asciidoctor::Standoc::ConceptInlineMacro
35
39
  inline_macro Asciidoctor::Standoc::AutonumberInlineMacro
36
40
  inline_macro Asciidoctor::Standoc::VariantInlineMacro
41
+ inline_macro Asciidoctor::Standoc::FootnoteBlockInlineMacro
37
42
  block Asciidoctor::Standoc::ToDoAdmonitionBlock
38
43
  treeprocessor Asciidoctor::Standoc::ToDoInlineAdmonitionBlock
39
44
  block Asciidoctor::Standoc::PlantUMLBlockMacro
45
+ block Metanorma::Plugin::Lutaml::LutamlDiagramBlock
40
46
  block Asciidoctor::Standoc::PseudocodeBlockMacro
41
47
  end
42
48
 
@@ -63,6 +69,8 @@ module Asciidoctor
63
69
  basebackend "html"
64
70
  outfilesuffix ".xml"
65
71
  @libdir = File.dirname(self.class::_file || __FILE__)
72
+
73
+ install_fonts(opts)
66
74
  end
67
75
 
68
76
  class << self
@@ -75,7 +83,52 @@ module Asciidoctor
75
83
 
76
84
  # path to isodoc assets in child gems
77
85
  def html_doc_path(file)
78
- File.join(@libdir, File.join("../../isodoc/html", file))
86
+ File.join(@libdir, "../../isodoc/html", file)
87
+ end
88
+
89
+ def flavor_name
90
+ self.class.name.split("::")&.[](-2).downcase
91
+ end
92
+
93
+ def fonts_manifest
94
+ File.expand_path(File.join(@libdir, "../../metanorma/", flavor_name, "fonts_manifest.yaml"))
95
+ end
96
+
97
+ def install_fonts(options={})
98
+ if options[:no_install_fonts]
99
+ Metanorma::Util.log("[fontist] Skip font installation because" \
100
+ " --no-install-fonts argument passed", :debug)
101
+ return
102
+ end
103
+
104
+ if fonts_manifest.nil? || !File.exist?(fonts_manifest)
105
+ Metanorma::Util.log("[fontist] Skip font installation because" \
106
+ " font manifest file doesn't exists/defined", :debug)
107
+ return
108
+ end
109
+
110
+ begin
111
+ Fontist::Manifest::Install.call(
112
+ fonts_manifest,
113
+ confirmation: options[:agree_to_terms] ? "yes" : "no"
114
+ )
115
+ rescue Fontist::Errors::LicensingError
116
+ if !options[:agree_to_terms]
117
+ Metanorma::Util.log("[fontist] --agree-to-terms option missing." \
118
+ " You must accept font licenses to install fonts.", :debug)
119
+ elsif options[:continue_without_fonts]
120
+ Metanorma::Util.log("[fontist] Processing will continue without" \
121
+ " fonts installed", :debug)
122
+ else
123
+ Metanorma::Util.log("[fontist] Aborting without proper fonts" \
124
+ " installed", :fatal)
125
+ end
126
+ rescue Fontist::Errors::NonSupportedFontError
127
+ flavor = flavor_name || "cli"
128
+ Metanorma::Util.log("[fontist] '#{font}' font is not supported. " \
129
+ "Please go to github.com/metanorma/metanorma-#{flavor}/issues" \
130
+ " to report this issue.", :info)
131
+ end
79
132
  end
80
133
 
81
134
  alias_method :embedded, :content
@@ -201,5 +201,17 @@ module Asciidoctor
201
201
  %{<variant lang=#{lang}>#{out}</variant>}
202
202
  end
203
203
  end
204
+
205
+ class FootnoteBlockInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor
206
+ use_dsl
207
+ named :footnoteblock
208
+ parse_content_as :text
209
+ using_format :short
210
+
211
+ def process(parent, _target, attrs)
212
+ out = Asciidoctor::Inline.new(parent, :quoted, attrs["text"]).convert
213
+ %{<footnoteblock>#{out}</footnoteblock>}
214
+ end
215
+ end
204
216
  end
205
217
  end
@@ -56,7 +56,9 @@ module Asciidoctor
56
56
  end
57
57
 
58
58
  def norm_year(yr)
59
- /^\&\#821[12];$/.match(yr) ? "--" : yr
59
+ /^\&\#821[12];$/.match(yr) and return "--"
60
+ /^\d\d\d\d-\d\d\d\d$/.match(yr) and return yr
61
+ yr&.sub(/(?<=[0-9])-.*$/, "")
60
62
  end
61
63
 
62
64
  def isorefrender1(t, m, yr, allp = "")
@@ -164,8 +166,9 @@ module Asciidoctor
164
166
 
165
167
  def analyse_ref_repo_path(ret)
166
168
  return ret unless m =
167
- /^(?<type>repo|path):\((?<key>[^,]+),(?<id>.+)\)$/.match(ret[:id])
168
- ret.merge(id: m[:id], type: m[:type], key: m[:key], nofetch: true)
169
+ /^(?<type>repo|path):\((?<key>[^,]+),?(?<id>.*)\)$/.match(ret[:id])
170
+ id = m[:id].empty? ? m[:key].sub(%r{^[^/]+/}, "") : m[:id]
171
+ ret.merge(id: id, type: m[:type], key: m[:key], nofetch: true)
169
172
  end
170
173
 
171
174
  def analyse_ref_numeric(ret)
@@ -225,7 +228,7 @@ module Asciidoctor
225
228
 
226
229
  NON_ISO_REF = %r{^<ref\sid="(?<anchor>[^"]+)">
227
230
  \[(?<usrlbl>\([^)]+\))?(?<code>[^\]]+?)
228
- ([:-](?<year>(19|20)[0-9][0-9]))?\]</ref>,?\s*(?<text>.*)$}xm
231
+ ([:-](?<year>(19|20)[0-9][0-9][0-9-]*))?\]</ref>,?\s*(?<text>.*)$}xm
229
232
 
230
233
  def reference1_matches(item)
231
234
  matched = ISO_REF.match item
@@ -21,8 +21,8 @@ module Asciidoctor
21
21
  @log.add("AsciiDoc Input", node, "Section not marked up as [bibliography]!")
22
22
  @biblio = true
23
23
  xml.references **attr_code(attrs.merge(normative: false)) do |xml_section|
24
- title = node.level == 1 ? "Bibliography" : node.title
25
- xml_section.title { |t| t << title }
24
+ #title = node.level == 1 ? "Bibliography" : node.title
25
+ xml_section.title { |t| t << node.title }
26
26
  xml_section << node.content
27
27
  end
28
28
  @biblio = false
@@ -44,7 +44,8 @@ module Asciidoctor
44
44
  @log.add("AsciiDoc Input", node, "Section not marked up as [bibliography]!")
45
45
  @norm_ref = true
46
46
  xml.references **attr_code(attrs.merge(normative: true)) do |xml_section|
47
- xml_section.title { |t| t << "Normative References" }
47
+ #xml_section.title { |t| t << "Normative References" }
48
+ xml_section.title { |t| t << node.title }
48
49
  xml_section << node.content
49
50
  end
50
51
  @norm_ref = false
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "1.6.3".freeze
22
+ VERSION = "1.6.4".freeze
23
23
  end
24
24
  end
@@ -28,19 +28,20 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_dependency "asciidoctor", "~> 2.0.0"
30
30
  spec.add_dependency "ruby-jing"
31
- spec.add_dependency "isodoc", "~> 1.2.0"
31
+ spec.add_dependency "isodoc", "~> 1.3.0"
32
32
  spec.add_dependency "iev", "~> 0.2.1"
33
33
  spec.add_dependency "metanorma-plugin-datastruct"
34
- spec.add_dependency "metanorma-plugin-lutaml"
34
+ spec.add_dependency "metanorma-plugin-lutaml", "~> 0.2.1"
35
35
  # relaton-cli not just relaton, to avoid circular reference in metanorma
36
- spec.add_dependency "relaton-cli", "~> 1.5.0"
37
- spec.add_dependency "relaton-iev", "~> 1.0.0"
36
+ spec.add_dependency "relaton-cli", "~> 1.7.0"
37
+ spec.add_dependency "relaton-iev", "~> 1.1.0"
38
38
  spec.add_dependency "sterile", "~> 1.0.14"
39
39
  spec.add_dependency "concurrent-ruby"
40
40
  spec.add_dependency "unicode2latex", "~> 0.0.1"
41
41
  spec.add_dependency "mimemagic"
42
42
  spec.add_dependency "mathml2asciimath"
43
43
  spec.add_dependency "latexmath"
44
+ spec.add_dependency "fontist", "~> 1.5.0"
44
45
 
45
46
  spec.add_development_dependency "byebug"
46
47
  spec.add_development_dependency "sassc", "2.4.0"
@@ -548,17 +548,33 @@ INPUT
548
548
  </annex>
549
549
  <bibliography>
550
550
  <references id='_' normative='true' obligation='informative'>
551
- <title>Normative references</title>
551
+ <title>Normative references
552
+ <fn reference='1'>
553
+ <p id='_'>A</p>
554
+ </fn>
555
+ </title>
552
556
  <p id='_'>There are no normative references in this document.</p>
553
557
  </references>
554
558
  <references id='_' normative='false' obligation='informative'>
555
- <title>Bibliography</title>
559
+ <title>Bibliography
560
+ <fn reference='1'>
561
+ <p id='_'>A</p>
562
+ </fn>
563
+ </title>
556
564
  </references>
557
565
  <references id='_' normative='false' obligation='informative'>
558
- <title>Bibliography</title>
566
+ <title>Bibliography.
567
+ <fn reference='1'>
568
+ <p id='_'>A</p>
569
+ </fn>
570
+ </title>
559
571
  </references>
560
572
  <clause id='_' obligation='informative'>
561
- <title>Bibliography</title>
573
+ <title>Bibliography 2.
574
+ <fn reference='1'>
575
+ <p id='_'>A</p>
576
+ </fn>
577
+ </title>
562
578
  <references id='_' normative='false' obligation='informative'>
563
579
  <title>Bibliography Subsection</title>
564
580
  </references>
@@ -789,7 +805,7 @@ INPUT
789
805
  <title>Bibliography</title>
790
806
  </references>
791
807
  <clause id='_' obligation='informative'>
792
- <title>Bibliography</title>
808
+ <title>Bibliography 2</title>
793
809
  <references id='_' normative='false' obligation='informative'>
794
810
  <title>Bibliography Subsection</title>
795
811
  </references>
@@ -1023,7 +1039,7 @@ INPUT
1023
1039
  <title>Bibliography</title>
1024
1040
  </references>
1025
1041
  <clause id='_' obligation='informative'>
1026
- <title>Bibliography</title>
1042
+ <title>Bibliography 2</title>
1027
1043
  <references id='_' normative='false' obligation='informative'>
1028
1044
  <title>Bibliography Subsection</title>
1029
1045
  </references>
@@ -1254,7 +1270,7 @@ INPUT
1254
1270
  <title>Bibliography</title>
1255
1271
  </references>
1256
1272
  <clause id='_' obligation='informative'>
1257
- <title>Bibliography</title>
1273
+ <title>Bibliography 2</title>
1258
1274
  <references id='_' normative='false' obligation='informative'>
1259
1275
  <title>Bibliography Subsection</title>
1260
1276
  </references>
@@ -1485,7 +1501,7 @@ INPUT
1485
1501
  <title>Bibliography</title>
1486
1502
  </references>
1487
1503
  <clause id='_' obligation='informative'>
1488
- <title>Bibliography</title>
1504
+ <title>Bibliography 2</title>
1489
1505
  <references id='_' normative='false' obligation='informative'>
1490
1506
  <title>Bibliography Subsection</title>
1491
1507
  </references>
@@ -1165,7 +1165,7 @@ RSpec.describe Asciidoctor::Standoc do
1165
1165
  <docidentifier type="IEC">IEC 60050-102:2007</docidentifier>
1166
1166
  <docidentifier type='URN'>urn:iec:std:iec:60050-102:2007:::en</docidentifier>
1167
1167
  <date type="published">
1168
- <on>2007</on>
1168
+ <on>2007-08-27</on>
1169
1169
  </date>
1170
1170
  <contributor>
1171
1171
  <role type="publisher"/>
@@ -1204,7 +1204,7 @@ RSpec.describe Asciidoctor::Standoc do
1204
1204
  <docidentifier type="IEC">IEC 60050-103:2009</docidentifier>
1205
1205
  <docidentifier type='URN'>urn:iec:std:iec:60050-103:2009:::en</docidentifier>
1206
1206
  <date type="published">
1207
- <on>2009</on>
1207
+ <on>2009-12-14</on>
1208
1208
  </date>
1209
1209
  <contributor>
1210
1210
  <role type="publisher"/>
@@ -55,7 +55,7 @@ EOS
55
55
  <docidentifier type='URN'>urn:iso:std:iso:124:stage-90.93:ed-7:en</docidentifier>
56
56
  <docnumber>124</docnumber>
57
57
  <date type="published">
58
- <on>2014</on>
58
+ <on>2014-03</on>
59
59
  </date>
60
60
  <contributor>
61
61
  <role type="publisher"/>
@@ -214,7 +214,7 @@ EOS
214
214
  <docidentifier type='URN'>urn:iso:std:iso:123:stage-90.93:ed-3:en</docidentifier>
215
215
  <docnumber>123</docnumber>
216
216
  <date type="published">
217
- <on>2001</on>
217
+ <on>2001-05</on>
218
218
  </date>
219
219
  <contributor>
220
220
  <role type="publisher"/>
@@ -227,6 +227,13 @@ EOS
227
227
  <edition>3</edition>
228
228
  <language>en</language>
229
229
  <script>Latn</script>
230
+ <abstract format='text/plain' language='en' script='Latn'>
231
+ This International Standard specifies procedures for sampling natural rubber
232
+ latex concentrate and for sampling syntheticrubber latices and artificial
233
+ latices. It is also suitable for sampling rubber latex contained in drums,
234
+ tank cars ortanks. The procedures may also be used for sampling plastics
235
+ dispersions.
236
+ </abstract>
230
237
  <status>
231
238
  <stage>90</stage>
232
239
  <substage>93</substage>
@@ -44,27 +44,27 @@ RSpec.describe 'Lutaml macros' do
44
44
  <clause id="_" inline-header="false" obligation="normative">
45
45
  <title>a3m_data_quality_criterion</title>
46
46
  <p id="_">supertypes →
47
- explicit → assessment_specification</p>
47
+ explicit → </p>
48
48
  </clause>
49
49
  <clause id="_" inline-header="false" obligation="normative">
50
50
  <title>a3m_data_quality_criterion_specific_applied_value</title>
51
51
  <p id="_">supertypes →
52
- explicit → criterion_to_assign_the_value</p>
52
+ explicit → </p>
53
53
  </clause>
54
54
  <clause id="_" inline-header="false" obligation="normative">
55
55
  <title>a3m_data_quality_target_accuracy_association</title>
56
56
  <p id="_">supertypes →
57
- explicit → id</p>
57
+ explicit → </p>
58
58
  </clause>
59
59
  <clause id="_" inline-header="false" obligation="normative">
60
60
  <title>a3m_detailed_report_request</title>
61
61
  <p id="_">supertypes →
62
- explicit → value_type_requested</p>
62
+ explicit → </p>
63
63
  </clause>
64
64
  <clause id="_" inline-header="false" obligation="normative">
65
65
  <title>a3m_summary_report_request_with_representative_value</title>
66
66
  <p id="_">supertypes →
67
- explicit → value_type_requested</p>
67
+ explicit → </p>
68
68
  </clause></clause>
69
69
  </sections>
70
70
  </standard-document>
@@ -395,6 +395,119 @@ OUTPUT
395
395
  OUTPUT
396
396
  end
397
397
 
398
+ it "processes the footnoteblock macro" do
399
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
400
+ #{ASCIIDOC_BLANK_HDR}
401
+
402
+ footnoteblock:[id1]
403
+
404
+ [[id1]]
405
+ [NOTE]
406
+ --
407
+ |===
408
+ |a |b
409
+
410
+ |c |d
411
+ |===
412
+
413
+ * A
414
+ * B
415
+ * C
416
+ --
417
+ INPUT
418
+ #{BLANK_HDR}
419
+ <sections>
420
+ <p id="_">
421
+ <fn reference='1'>
422
+ <table id='_'>
423
+ <thead>
424
+ <tr>
425
+ <th valign='top' align='left'>a</th>
426
+ <th valign='top' align='left'>b</th>
427
+ </tr>
428
+ </thead>
429
+ <tbody>
430
+ <tr>
431
+ <td valign='top' align='left'>c</td>
432
+ <td valign='top' align='left'>d</td>
433
+ </tr>
434
+ </tbody>
435
+ </table>
436
+ <ul id='_'>
437
+ <li>
438
+ <p id='_'>A</p>
439
+ </li>
440
+ <li>
441
+ <p id='_'>B</p>
442
+ </li>
443
+ <li>
444
+ <p id='_'>C</p>
445
+ </li>
446
+ </ul>
447
+ </fn>
448
+ </p>
449
+ </sections>
450
+ </standard-document>
451
+ OUTPUT
452
+ end
453
+
454
+ it "processes the footnoteblock macro with failed reference" do
455
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
456
+ #{ASCIIDOC_BLANK_HDR}
457
+
458
+ footnoteblock:[id1]
459
+
460
+ [[id2]]
461
+ [NOTE]
462
+ --
463
+ |===
464
+ |a |b
465
+
466
+ |c |d
467
+ |===
468
+
469
+ * A
470
+ * B
471
+ * C
472
+ --
473
+ INPUT
474
+ #{BLANK_HDR}
475
+ <sections>
476
+ <p id='_'>
477
+ <fn reference='1'>[ERROR]</fn>
478
+ </p>
479
+ <note id='id2'>
480
+ <table id='_'>
481
+ <thead>
482
+ <tr>
483
+ <th valign='top' align='left'>a</th>
484
+ <th valign='top' align='left'>b</th>
485
+ </tr>
486
+ </thead>
487
+ <tbody>
488
+ <tr>
489
+ <td valign='top' align='left'>c</td>
490
+ <td valign='top' align='left'>d</td>
491
+ </tr>
492
+ </tbody>
493
+ </table>
494
+ <ul id='_'>
495
+ <li>
496
+ <p id='_'>A</p>
497
+ </li>
498
+ <li>
499
+ <p id='_'>B</p>
500
+ </li>
501
+ <li>
502
+ <p id='_'>C</p>
503
+ </li>
504
+ </ul>
505
+ </note>
506
+ </sections>
507
+ </standard-document>
508
+ OUTPUT
509
+ end
510
+
398
511
  it "processes the PlantUML macro" do
399
512
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)).gsub(%r{plantuml/plantuml[^./]+\.}, "plantuml/_."))).to be_equivalent_to xmlpp(<<~"OUTPUT")
400
513
  #{ASCIIDOC_BLANK_HDR}
@@ -477,6 +590,117 @@ OUTPUT
477
590
  OUTPUT
478
591
  end
479
592
 
593
+ context 'when lutaml_diagram' do
594
+ let(:input) do
595
+ <<~"OUTPUT"
596
+ = Document title
597
+ Author
598
+ :docfile: test.adoc
599
+ :nodoc:
600
+ :novalid:
601
+ :no-isobib:
602
+ :imagesdir: spec/assets
603
+
604
+ [lutaml_diagram]
605
+ ....
606
+ diagram MyView {
607
+ fontname "Arial"
608
+ title "my diagram"
609
+ class Foo {}
610
+ }
611
+ ....
612
+ OUTPUT
613
+ end
614
+ let(:output) do
615
+ <<~"OUTPUT"
616
+ #{BLANK_HDR}
617
+ <sections>
618
+ <figure id="_">
619
+ <image src="spec/assets/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
620
+ </figure>
621
+ </sections>
622
+ </standard-document>
623
+ OUTPUT
624
+ end
625
+
626
+ it "processes the lutaml_diagram" do
627
+ expect(
628
+ xmlpp(
629
+ strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))
630
+ .gsub(%r{".+spec\/assets\/lutaml\/[^.\/]+\.}, %q("spec/assets/_.))))
631
+ .to(be_equivalent_to xmlpp(output))
632
+ end
633
+ end
634
+
635
+ =begin
636
+ context 'when lutaml_uml_attributes_table' do
637
+ let(:example_file) { fixtures_path("diagram_definitions.lutaml") }
638
+ let(:input) do
639
+ <<~"OUTPUT"
640
+ = Document title
641
+ Author
642
+ :docfile: test.adoc
643
+ :nodoc:
644
+ :novalid:
645
+ :no-isobib:
646
+ :imagesdir: spec/assets
647
+
648
+ [lutaml_uml_attributes_table,#{example_file},AttributeProfile]
649
+ OUTPUT
650
+ end
651
+ let(:output) do
652
+ <<~"OUTPUT"
653
+ #{BLANK_HDR}
654
+ <sections>
655
+ <clause id='_' inline-header='false' obligation='normative'>
656
+ <title>AttributeProfile</title>
657
+ <table id='_'>
658
+ <name>AttributeProfile attributes</name>
659
+ <thead>
660
+ <tr>
661
+ <th valign='top' align='left'>Name</th>
662
+ <th valign='top' align='left'>Definition</th>
663
+ <th valign='top' align='left'>Mandatory/ Optional/ Conditional</th>
664
+ <th valign='top' align='left'>Max Occur</th>
665
+ <th valign='top' align='left'>Data Type</th>
666
+ </tr>
667
+ </thead>
668
+ <tbody>
669
+ <tr>
670
+ <td valign='top' align='left'>addressClassProfile</td>
671
+ <td valign='top' align='left'>TODO: enum ‘s definition</td>
672
+ <td valign='top' align='left'>M</td>
673
+ <td valign='top' align='left'>1</td>
674
+ <td valign='top' align='left'>
675
+ <tt>CharacterString</tt>
676
+ </td>
677
+ </tr>
678
+ <tr>
679
+ <td valign='top' align='left'>imlicistAttributeProfile</td>
680
+ <td valign='top' align='left'>this is attribute definition with multiply lines</td>
681
+ <td valign='top' align='left'>M</td>
682
+ <td valign='top' align='left'>1</td>
683
+ <td valign='top' align='left'>
684
+ <tt>CharacterString</tt>
685
+ </td>
686
+ </tr>
687
+ </tbody>
688
+ </table>
689
+ </clause>
690
+ </sections>
691
+ </standard-document>
692
+ OUTPUT
693
+ end
694
+
695
+ it "processes the lutaml_diagram" do
696
+ expect(
697
+ xmlpp(
698
+ strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
699
+ .to(be_equivalent_to(xmlpp(output)))
700
+ end
701
+ end
702
+ =end
703
+
480
704
  it "processes the PlantUML macro with PlantUML disabled" do
481
705
  mock_plantuml_disabled
482
706
  expect { Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true) }.to output(%r{PlantUML not installed}).to_stderr