metanorma-standoc 1.3.24 → 1.3.25
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 +4 -4
- data/.github/workflows/macos.yml +2 -1
- data/.github/workflows/ubuntu.yml +5 -3
- data/.github/workflows/windows.yml +0 -1
- data/lib/asciidoctor/standoc/base.rb +22 -8
- data/lib/asciidoctor/standoc/biblio.rng +53 -26
- data/lib/asciidoctor/standoc/cleanup.rb +8 -7
- data/lib/asciidoctor/standoc/cleanup_inline.rb +3 -0
- data/lib/asciidoctor/standoc/cleanup_ref.rb +4 -0
- data/lib/asciidoctor/standoc/cleanup_section.rb +21 -6
- data/lib/asciidoctor/standoc/front.rb +5 -3
- data/lib/asciidoctor/standoc/inline.rb +42 -17
- data/lib/asciidoctor/standoc/isodoc.rng +28 -1
- data/lib/asciidoctor/standoc/macros.rb +2 -1
- data/lib/asciidoctor/standoc/macros_yaml2text.rb +142 -0
- data/lib/asciidoctor/standoc/ref.rb +5 -3
- data/lib/asciidoctor/standoc/section.rb +5 -0
- data/lib/asciidoctor/standoc/utils.rb +2 -11
- data/lib/metanorma/standoc/latexml_requirement.rb +14 -12
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +2 -2
- data/spec/asciidoctor-standoc/base_spec.rb +8 -0
- data/spec/asciidoctor-standoc/blocks_spec.rb +56 -1
- data/spec/asciidoctor-standoc/cleanup_spec.rb +26 -2
- data/spec/asciidoctor-standoc/inline_spec.rb +3 -2
- data/spec/asciidoctor-standoc/macros_spec.rb +4 -4
- data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +564 -0
- data/spec/asciidoctor-standoc/refs_spec.rb +234 -146
- data/spec/asciidoctor-standoc/section_spec.rb +58 -0
- data/spec/asciidoctor-standoc/validate_spec.rb +34 -0
- data/spec/assets/codes.yml +695 -0
- data/spec/examples/codes_table.html +3174 -0
- data/spec/metanorma/processor_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -0
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +71 -265
- data/spec/vcr_cassettes/isobib_get_123.yml +38 -84
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +20 -43
- data/spec/vcr_cassettes/isobib_get_124.yml +19 -101
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +35 -35
- metadata +10 -6
@@ -0,0 +1,142 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
3
|
+
module Asciidoctor
|
4
|
+
module Standoc
|
5
|
+
class YamlBlockStruct < OpenStruct
|
6
|
+
def to_a
|
7
|
+
@table.to_h.keys
|
8
|
+
end
|
9
|
+
|
10
|
+
def values
|
11
|
+
@table.to_h.values
|
12
|
+
end
|
13
|
+
|
14
|
+
def each
|
15
|
+
return to_a.each unless block_given?
|
16
|
+
|
17
|
+
to_a.each do |key|
|
18
|
+
yield(key)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class YamlContextRenderer
|
24
|
+
attr_reader :context_object, :context_name
|
25
|
+
|
26
|
+
def initialize(context_object:, context_name:)
|
27
|
+
@context_object = context_object
|
28
|
+
@context_name = context_name
|
29
|
+
end
|
30
|
+
|
31
|
+
def respond_to_missing?(name)
|
32
|
+
respond_to?(name)
|
33
|
+
end
|
34
|
+
|
35
|
+
def method_missing(name, *_args)
|
36
|
+
return context_object if name.to_s == context_name
|
37
|
+
|
38
|
+
super
|
39
|
+
end
|
40
|
+
|
41
|
+
def render(template)
|
42
|
+
ERB.new(template).result(binding)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class Yaml2TextPreprocessor < Asciidoctor::Extensions::Preprocessor
|
47
|
+
BLOCK_START_REGEXP = /\{(.+?)\.\*,(.+),(.+)\}/.freeze
|
48
|
+
BLOCK_END_REGEXP = /\A\{[A-Z]+\}\z/.freeze
|
49
|
+
# search document for block `yaml2text`
|
50
|
+
# after that take template from block and read file into this template
|
51
|
+
# example:
|
52
|
+
# [yaml2text,foobar.yaml]
|
53
|
+
# ----
|
54
|
+
# === {item.name}
|
55
|
+
# {item.desc}
|
56
|
+
#
|
57
|
+
# {item.symbol}:: {item.symbol_def}
|
58
|
+
# ----
|
59
|
+
#
|
60
|
+
# with content of `foobar.yaml` file equal to:
|
61
|
+
# - name: spaghetti
|
62
|
+
# desc: wheat noodles of 9mm diameter
|
63
|
+
# symbol: SPAG
|
64
|
+
# symbol_def: the situation is message like spaghetti at a kid's meal
|
65
|
+
#
|
66
|
+
# will produce:
|
67
|
+
# === spaghetti
|
68
|
+
# wheat noodles of 9mm diameter
|
69
|
+
#
|
70
|
+
# SPAG:: the situation is message like spaghetti at a kid's meal
|
71
|
+
def process(document, reader)
|
72
|
+
input_lines = reader.readlines.to_enum
|
73
|
+
Reader.new(processed_lines(document, input_lines))
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def processed_lines(document, input_lines)
|
79
|
+
result = []
|
80
|
+
loop do
|
81
|
+
line = input_lines.next
|
82
|
+
if yaml_block_match = line.match(/^\[yaml2text,(.+?),(.+?)\]/)
|
83
|
+
mark = input_lines.next
|
84
|
+
current_yaml_block = []
|
85
|
+
while (yaml_block_line = input_lines.next) != mark
|
86
|
+
current_yaml_block.push(yaml_block_line)
|
87
|
+
end
|
88
|
+
content = nested_open_struct_from_yaml(yaml_block_match[1], document)
|
89
|
+
result.push(*
|
90
|
+
parse_blocks_recursively(lines: current_yaml_block,
|
91
|
+
attributes: content,
|
92
|
+
context_name: yaml_block_match[2]))
|
93
|
+
else
|
94
|
+
result.push(line)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
result
|
98
|
+
end
|
99
|
+
|
100
|
+
def nested_open_struct_from_yaml(file_path, document)
|
101
|
+
docfile_directory = File.dirname(document.attributes['docfile'] || '.')
|
102
|
+
yaml_file_path = document.path_resolver.system_path(file_path, docfile_directory)
|
103
|
+
content = YAML.safe_load(File.read(yaml_file_path))
|
104
|
+
# Load content as json, then parse with JSON as nested open_struct
|
105
|
+
JSON.parse(content.to_json, object_class: YamlBlockStruct)
|
106
|
+
end
|
107
|
+
|
108
|
+
def parse_blocks_recursively(lines:,
|
109
|
+
attributes:,
|
110
|
+
context_name:,
|
111
|
+
parent_context: nil)
|
112
|
+
lines = lines.to_enum
|
113
|
+
result = []
|
114
|
+
loop do
|
115
|
+
line = lines.next
|
116
|
+
if line.match(BLOCK_START_REGEXP)
|
117
|
+
line.gsub!(BLOCK_START_REGEXP, '<% \1.each.with_index do |\2,index| %>')
|
118
|
+
end
|
119
|
+
|
120
|
+
if line.match(BLOCK_END_REGEXP)
|
121
|
+
line.gsub!(BLOCK_END_REGEXP, '<% end %>')
|
122
|
+
end
|
123
|
+
line = line.gsub(/{(.+?[^}]*)}/, '<%= \1 %>').gsub(/[a-z\.]+\#/, 'index')
|
124
|
+
result.push(line)
|
125
|
+
end
|
126
|
+
result = parse_context_block(context_lines: result,
|
127
|
+
context_items: attributes,
|
128
|
+
context_name: context_name,
|
129
|
+
parent_context: parent_context)
|
130
|
+
result
|
131
|
+
end
|
132
|
+
|
133
|
+
def parse_context_block(context_lines:,
|
134
|
+
context_items:,
|
135
|
+
context_name:,
|
136
|
+
parent_context: nil)
|
137
|
+
renderer = YamlContextRenderer.new(context_object: context_items, context_name: context_name)
|
138
|
+
renderer.render(context_lines.join('\n')).split('\n')
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
@@ -62,6 +62,7 @@ module Asciidoctor
|
|
62
62
|
t.title(**plaintxt) { |i| i << ref_normalise(m[:text]) }
|
63
63
|
docid(t, m[:usrlbl]) if m[:usrlbl]
|
64
64
|
docid(t, id_and_year(m[:code], yr))
|
65
|
+
t.docnumber m[:code].sub(/^[^\d]*/, "")
|
65
66
|
yr and t.date **{ type: "published" } do |d|
|
66
67
|
set_date_range(d, yr)
|
67
68
|
end
|
@@ -78,6 +79,7 @@ module Asciidoctor
|
|
78
79
|
t.title(**plaintxt) { |i| i << ref_normalise(m[:text]) }
|
79
80
|
docid(t, m[:usrlbl]) if m[:usrlbl]
|
80
81
|
docid(t, id_and_year(m[:code], "--"))
|
82
|
+
t.docnumber m[:code].sub(/^[^\d]*/, "")
|
81
83
|
t.date **{ type: "published" } do |d|
|
82
84
|
d.on "--"
|
83
85
|
end
|
@@ -108,6 +110,7 @@ module Asciidoctor
|
|
108
110
|
t.title(**plaintxt) { |i| i << ref_normalise(m[:text]) }
|
109
111
|
docid(t, m[:usrlbl]) if m[:usrlbl]
|
110
112
|
docid(t, id_and_year(m[:code], yr) + " (all parts)")
|
113
|
+
t.docnumber m[:code].sub(/^[^\d]*/, "")
|
111
114
|
conditional_date(t, m, noyr)
|
112
115
|
iso_publisher(t, m[:code])
|
113
116
|
m.names.include?("fn") && m[:fn] and
|
@@ -139,6 +142,7 @@ module Asciidoctor
|
|
139
142
|
end
|
140
143
|
docid(t, m[:usrlbl]) if m[:usrlbl]
|
141
144
|
docid(t, /^\d+$/.match(m[:code]) ? "[#{m[:code]}]" : m[:code])
|
145
|
+
t.docnumber m[:code].sub(/^[^\d]*/, "") unless /^\d+$/.match(m[:code])
|
142
146
|
end
|
143
147
|
end
|
144
148
|
|
@@ -206,9 +210,7 @@ module Asciidoctor
|
|
206
210
|
|
207
211
|
def reference(node)
|
208
212
|
noko do |xml|
|
209
|
-
node.items.each
|
210
|
-
reference1(node, item.text, xml)
|
211
|
-
end
|
213
|
+
node.items.each { |item| reference1(node, item.text, xml) }
|
212
214
|
end.join
|
213
215
|
end
|
214
216
|
|
@@ -204,6 +204,11 @@ module Asciidoctor
|
|
204
204
|
SYMBOLS_TITLES.include? s.title.downcase
|
205
205
|
end
|
206
206
|
return "Terms and definitions" if sub.empty?
|
207
|
+
sym = /symbol/i.match(node.title)
|
208
|
+
abbrev = /abbreviat/i.match(node.title)
|
209
|
+
sym && abbrev and return "Terms, definitions, symbols and abbreviated terms"
|
210
|
+
sym and return "Terms, definitions and symbols"
|
211
|
+
abbrev and return "Terms, definitions and abbreviated terms"
|
207
212
|
"Terms, definitions, symbols and abbreviated terms"
|
208
213
|
end
|
209
214
|
|
@@ -20,7 +20,8 @@ module Asciidoctor
|
|
20
20
|
def asciidoc_sub(x)
|
21
21
|
return nil if x.nil?
|
22
22
|
return "" if x.empty?
|
23
|
-
d = Asciidoctor::Document.new(x.lines.entries, {header_footer: false
|
23
|
+
d = Asciidoctor::Document.new(x.lines.entries, { header_footer: false,
|
24
|
+
backend: :standoc })
|
24
25
|
b = d.parse.blocks.first
|
25
26
|
b.apply_subs(b.source)
|
26
27
|
end
|
@@ -66,16 +67,6 @@ module Asciidoctor
|
|
66
67
|
end
|
67
68
|
end
|
68
69
|
|
69
|
-
=begin
|
70
|
-
def warning(node, msg, text)
|
71
|
-
return if @novalid
|
72
|
-
warntext = "asciidoctor: WARNING"\
|
73
|
-
"(#{current_location(node)}): #{msg}"
|
74
|
-
warntext += ": #{text}" if text
|
75
|
-
warn warntext
|
76
|
-
end
|
77
|
-
=end
|
78
|
-
|
79
70
|
def flatten_rawtext_lines(node, result)
|
80
71
|
node.lines.each do |x|
|
81
72
|
if node.respond_to?(:context) && (node.context == :literal ||
|
@@ -11,31 +11,33 @@ module Metanorma
|
|
11
11
|
version = version_output&.match(%r{\d+(.\d+)*})
|
12
12
|
|
13
13
|
if version.to_s.empty?
|
14
|
-
@error_message = "LaTeXML not
|
15
|
-
|
14
|
+
@error_message = "LaTeXML is not available. (Or is PATH not setup properly?)"\
|
15
|
+
" You must upgrade/install LaTeXML to a version higher than `#{@recommended_version}`"
|
16
16
|
|
17
17
|
elsif Gem::Version.new(version) < Gem::Version.new(@minimal_version)
|
18
|
-
@error_message = "Minimal supported LaTeXML version is
|
19
|
-
"
|
18
|
+
@error_message = "Minimal supported LaTeXML version is `#{@minimal_version}` "\
|
19
|
+
"Version `#{version}` found; recommended version is `#{@recommended_version}`"
|
20
20
|
|
21
21
|
elsif Gem::Version.new(version) < Gem::Version.new(@recommended_version)
|
22
22
|
version = "unknown" if version.to_s.empty?
|
23
|
-
header_msg = "latexmlmath version
|
23
|
+
header_msg = "latexmlmath version `#{version}` below `#{@recommended_version}`!"
|
24
24
|
suggestion = if Gem.win_platform?
|
25
25
|
"cmd encoding is set to UTF-8 with `chcp 65001`"
|
26
26
|
else
|
27
27
|
"terminal encoding is set to UTF-8 with `export LANG=en_US.UTF-8`"
|
28
28
|
end
|
29
29
|
|
30
|
-
@error_message = "WARNING #{header_msg} Please sure that #{suggestion} command"
|
30
|
+
@error_message = "WARNING #{header_msg} Please sure that #{suggestion} command."
|
31
31
|
|
32
|
-
@cmd =
|
32
|
+
@cmd = 'latexmlmath --strict --preload=amsmath -- -'
|
33
|
+
@cmd2 = 'latexmlmath --strict -- -'
|
33
34
|
else
|
34
|
-
@cmd =
|
35
|
+
@cmd = 'latexmlmath --strict --preload=amsmath --inputencoding=UTF-8 -- -'
|
36
|
+
@cmd2 = 'latexmlmath --strict --inputencoding=UTF-8 -- -'
|
35
37
|
end
|
36
38
|
rescue
|
37
|
-
@error_message = "LaTeXML not
|
38
|
-
" You must upgrade/install LaTeXML to
|
39
|
+
@error_message = "LaTeXML is not available. (Or is PATH not setup properly?)"\
|
40
|
+
" You must upgrade/install LaTeXML to a version higher than `#{@recommended_version}`"
|
39
41
|
end
|
40
42
|
|
41
43
|
def satisfied(abort = false)
|
@@ -53,8 +55,8 @@ module Metanorma
|
|
53
55
|
def cmd
|
54
56
|
abort @error_message unless @error_message.nil?
|
55
57
|
|
56
|
-
@cmd
|
58
|
+
[@cmd, @cmd2]
|
57
59
|
end
|
58
60
|
end
|
59
61
|
end
|
60
|
-
end
|
62
|
+
end
|
data/metanorma-standoc.gemspec
CHANGED
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_dependency "ruby-jing"
|
31
31
|
spec.add_dependency "isodoc", "~> 1.0.20"
|
32
32
|
spec.add_dependency "iev", "~> 0.2.1"
|
33
|
-
spec.add_dependency "relaton", "~> 0.
|
34
|
-
spec.add_dependency "relaton-iev", "~>
|
33
|
+
spec.add_dependency "relaton", "~> 1.0.0"
|
34
|
+
spec.add_dependency "relaton-iev", "~> 1.0.0"
|
35
35
|
spec.add_dependency "sterile", "~> 1.0.14"
|
36
36
|
spec.add_dependency "concurrent-ruby"
|
37
37
|
spec.add_dependency "unicode2latex", "~> 0.0.1"
|
@@ -53,6 +53,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
53
53
|
:issued-date: 1007-01-01
|
54
54
|
:circulated-date: 1008-01-01
|
55
55
|
:unchanged-date: 1009-01-01
|
56
|
+
:vote-started-date: 1011-01-01
|
57
|
+
:vote-ended-date: 1012-01-01
|
56
58
|
:date: Fred 1010-01-01
|
57
59
|
:date_2: Jack 1010-01-01
|
58
60
|
:draft: 3.4
|
@@ -141,6 +143,12 @@ RSpec.describe Asciidoctor::Standoc do
|
|
141
143
|
<date type="unchanged">
|
142
144
|
<on>1009-01-01</on>
|
143
145
|
</date>
|
146
|
+
<date type='vote-started'>
|
147
|
+
<on>1011-01-01</on>
|
148
|
+
</date>
|
149
|
+
<date type='vote-ended'>
|
150
|
+
<on>1012-01-01</on>
|
151
|
+
</date>
|
144
152
|
<date type="Fred">
|
145
153
|
<on>1010-01-01</on>
|
146
154
|
</date>
|
@@ -75,7 +75,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
75
75
|
</formula>
|
76
76
|
<formula id="_" subsequence="A">
|
77
77
|
<stem type="MathML">
|
78
|
-
<math xmlns="http://www.w3.org/1998/Math/MathML"
|
78
|
+
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
|
79
79
|
<mrow>
|
80
80
|
<mi>M</mi>
|
81
81
|
<mo>=</mo>
|
@@ -924,6 +924,19 @@ RSpec.describe Asciidoctor::Standoc do
|
|
924
924
|
|
925
925
|
[.source]
|
926
926
|
<<ISO2191,section=1>>
|
927
|
+
|
928
|
+
=== Term2
|
929
|
+
|
930
|
+
Definition
|
931
|
+
|
932
|
+
[.source]
|
933
|
+
{{IEV:xyz}}
|
934
|
+
|
935
|
+
[.source]
|
936
|
+
{{IEV:xyz,t1}}
|
937
|
+
|
938
|
+
[.source]
|
939
|
+
{{IEV:xyz,t1,t2}}
|
927
940
|
INPUT
|
928
941
|
#{BLANK_HDR}
|
929
942
|
<sections>
|
@@ -940,6 +953,27 @@ RSpec.describe Asciidoctor::Standoc do
|
|
940
953
|
</origin>
|
941
954
|
</termsource>
|
942
955
|
</term>
|
956
|
+
<term id='_'>
|
957
|
+
<preferred>Term2</preferred>
|
958
|
+
<definition>
|
959
|
+
<p id='_'>Definition</p>
|
960
|
+
</definition>
|
961
|
+
<termsource status='identical'>
|
962
|
+
<origin citeas=''>
|
963
|
+
<termref base='IEV' target='xyz'/>
|
964
|
+
</origin>
|
965
|
+
</termsource>
|
966
|
+
<termsource status='identical'>
|
967
|
+
<origin citeas=''>
|
968
|
+
<termref base='IEV' target='xyz'>t1</termref>
|
969
|
+
</origin>
|
970
|
+
</termsource>
|
971
|
+
<termsource status='identical'>
|
972
|
+
<origin citeas=''>
|
973
|
+
<termref base='IEV' target='xyz'>t1</termref>
|
974
|
+
</origin>
|
975
|
+
</termsource>
|
976
|
+
</term>
|
943
977
|
</terms>
|
944
978
|
</sections>
|
945
979
|
</standard-document>
|
@@ -955,6 +989,13 @@ RSpec.describe Asciidoctor::Standoc do
|
|
955
989
|
|
956
990
|
[.source]
|
957
991
|
<<ISO2191,section=1>>, with adjustments
|
992
|
+
|
993
|
+
=== Term2
|
994
|
+
|
995
|
+
Definition
|
996
|
+
|
997
|
+
[.source]
|
998
|
+
{{IEV:xyz}}, with adjustments
|
958
999
|
INPUT
|
959
1000
|
#{BLANK_HDR}
|
960
1001
|
<sections>
|
@@ -975,6 +1016,20 @@ RSpec.describe Asciidoctor::Standoc do
|
|
975
1016
|
</modification>
|
976
1017
|
</termsource>
|
977
1018
|
</term>
|
1019
|
+
<term id='_'>
|
1020
|
+
<preferred>Term2</preferred>
|
1021
|
+
<definition>
|
1022
|
+
<p id='_'>Definition</p>
|
1023
|
+
</definition>
|
1024
|
+
<termsource status='modified'>
|
1025
|
+
<origin citeas=''>
|
1026
|
+
<termref base='IEV' target='xyz'/>
|
1027
|
+
</origin>
|
1028
|
+
<modification>
|
1029
|
+
<p id='_'>with adjustments</p>
|
1030
|
+
</modification>
|
1031
|
+
</termsource>
|
1032
|
+
</term>
|
978
1033
|
</terms>
|
979
1034
|
</sections>
|
980
1035
|
</standard-document>
|
@@ -336,6 +336,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
336
336
|
<bibitem id="iso216" type="standard">
|
337
337
|
<title format="text/plain">Reference</title>
|
338
338
|
<docidentifier>ISO 216:2001</docidentifier>
|
339
|
+
<docnumber>216</docnumber>
|
339
340
|
<date type="published">
|
340
341
|
<on>2001</on>
|
341
342
|
</date>
|
@@ -413,6 +414,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
413
414
|
<bibitem id="iso216" type="standard">
|
414
415
|
<title format="text/plain">Reference</title>
|
415
416
|
<docidentifier>ISO 216</docidentifier>
|
417
|
+
<docnumber>216</docnumber>
|
416
418
|
<contributor>
|
417
419
|
<role type="publisher"/>
|
418
420
|
<organization>
|
@@ -449,6 +451,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
449
451
|
<bibitem id="iso216" type="standard">
|
450
452
|
<title format="text/plain">Reference</title>
|
451
453
|
<docidentifier>ISO 216</docidentifier>
|
454
|
+
<docnumber>216</docnumber>
|
452
455
|
<contributor>
|
453
456
|
<role type="publisher"/>
|
454
457
|
<organization>
|
@@ -511,6 +514,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
511
514
|
<bibitem id="iso216" type="standard">
|
512
515
|
<title format="text/plain">Reference</title>
|
513
516
|
<docidentifier>ISO 216</docidentifier>
|
517
|
+
<docnumber>216</docnumber>
|
514
518
|
<contributor>
|
515
519
|
<role type="publisher"/>
|
516
520
|
<organization>
|
@@ -558,6 +562,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
558
562
|
<bibitem id='iso216' type='standard'>
|
559
563
|
<title format='text/plain'>Reference</title>
|
560
564
|
<docidentifier>ISO 216</docidentifier>
|
565
|
+
<docnumber>216</docnumber>
|
561
566
|
<contributor>
|
562
567
|
<role type='publisher'/>
|
563
568
|
<organization>
|
@@ -574,6 +579,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
574
579
|
<bibitem id='iso216' type='standard'>
|
575
580
|
<title format='text/plain'>Reference</title>
|
576
581
|
<docidentifier>ISO 215</docidentifier>
|
582
|
+
<docnumber>215</docnumber>
|
577
583
|
<contributor>
|
578
584
|
<role type='publisher'/>
|
579
585
|
<organization>
|
@@ -937,6 +943,7 @@ end
|
|
937
943
|
<bibitem id="iso123" type="standard">
|
938
944
|
<title format="text/plain">Standard</title>
|
939
945
|
<docidentifier>ISO 123:—</docidentifier>
|
946
|
+
<docnumber>123</docnumber>
|
940
947
|
<date type="published">
|
941
948
|
<on>–</on>
|
942
949
|
</date>
|
@@ -1378,6 +1385,7 @@ end
|
|
1378
1385
|
<bibitem id="iso124" type="standard">
|
1379
1386
|
<title format="text/plain">Standard 124</title>
|
1380
1387
|
<docidentifier>ISO 124</docidentifier>
|
1388
|
+
<docnumber>124</docnumber>
|
1381
1389
|
<contributor>
|
1382
1390
|
<role type="publisher"/>
|
1383
1391
|
<organization>
|
@@ -1433,6 +1441,7 @@ OUTPUT
|
|
1433
1441
|
<bibitem id="iso124" type="standard">
|
1434
1442
|
<title format="text/plain">Standard 124</title>
|
1435
1443
|
<docidentifier>ISO 124</docidentifier>
|
1444
|
+
<docnumber>124</docnumber>
|
1436
1445
|
<contributor>
|
1437
1446
|
<role type="publisher"/>
|
1438
1447
|
<organization>
|
@@ -1452,6 +1461,7 @@ OUTPUT
|
|
1452
1461
|
<bibitem id="iso125" type="standard">
|
1453
1462
|
<title format="text/plain">Standard 124</title>
|
1454
1463
|
<docidentifier>ISO 125</docidentifier>
|
1464
|
+
<docnumber>125</docnumber>
|
1455
1465
|
<contributor>
|
1456
1466
|
<role type="publisher"/>
|
1457
1467
|
<organization>
|
@@ -1691,11 +1701,25 @@ it "sorts symbols lists" do
|
|
1691
1701
|
<dd>
|
1692
1702
|
<p id='_'>Definition 5</p>
|
1693
1703
|
</dd>
|
1694
|
-
<dt><stem type='MathML'>
|
1704
|
+
<dt><stem type='MathML'>
|
1705
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
1706
|
+
<msub>
|
1707
|
+
<mi>x</mi>
|
1708
|
+
<mi>m</mi>
|
1709
|
+
</msub>
|
1710
|
+
</math>
|
1711
|
+
</stem></dt>
|
1695
1712
|
<dd>
|
1696
1713
|
<p id='_'>Definition 4</p>
|
1697
1714
|
</dd>
|
1698
|
-
<dt><stem type='MathML'>
|
1715
|
+
<dt><stem type='MathML'>
|
1716
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
1717
|
+
<msub>
|
1718
|
+
<mi>x</mi>
|
1719
|
+
<mn>1</mn>
|
1720
|
+
</msub>
|
1721
|
+
</math>
|
1722
|
+
</stem></dt>
|
1699
1723
|
<dd>
|
1700
1724
|
<p id='_'>Definition 3</p>
|
1701
1725
|
</dd>
|
@@ -88,7 +88,7 @@ text, including <strong><em>nest</em></strong>ed markup.</p>
|
|
88
88
|
<sections>
|
89
89
|
<p id="_">
|
90
90
|
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo><</mo><mn>1</mn></math></stem><br/>
|
91
|
-
<stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML"
|
91
|
+
<stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"> <mrow> <mi>n</mi> <mo><</mo> <mn>1</mn> </mrow> </math></stem>
|
92
92
|
</p>
|
93
93
|
</sections>
|
94
94
|
</standard-document>
|
@@ -106,7 +106,7 @@ text, including <strong><em>nest</em></strong>ed markup.</p>
|
|
106
106
|
<sections>
|
107
107
|
<p id="_">
|
108
108
|
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo><</mo><mn>1</mn></math></stem>
|
109
|
-
<stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML"
|
109
|
+
<stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"> <mrow> <mi>n</mi> <mo><</mo> <mn>1</mn> </mrow> </math></stem>
|
110
110
|
</p>
|
111
111
|
</sections>
|
112
112
|
</standard-document>
|
@@ -237,6 +237,7 @@ text, including <strong><em>nest</em></strong>ed markup.</p>
|
|
237
237
|
<bibitem id="ISO713">
|
238
238
|
<formattedref format="application/x-isodoc+xml">Reference</formattedref>
|
239
239
|
<docidentifier>ISO713</docidentifier>
|
240
|
+
<docnumber>713</docnumber>
|
240
241
|
</bibitem>
|
241
242
|
</references>
|
242
243
|
</bibliography>
|
@@ -34,6 +34,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
34
34
|
<em>Title</em>
|
35
35
|
</formattedref>
|
36
36
|
<docidentifier>XYZ 123</docidentifier>
|
37
|
+
<docnumber>123</docnumber>
|
37
38
|
</bibitem>
|
38
39
|
</references>
|
39
40
|
</bibliography>
|
@@ -287,7 +288,7 @@ OUTPUT
|
|
287
288
|
</standard-document>
|
288
289
|
OUTPUT
|
289
290
|
end
|
290
|
-
|
291
|
+
|
291
292
|
it "processes the PlantUML macro" do
|
292
293
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)).gsub(%r{plantuml/plantuml[^./]+\.}, "plantuml/_."))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
293
294
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -462,7 +463,6 @@ Alice <-- Bob: another authentication Response
|
|
462
463
|
OUTPUT
|
463
464
|
end
|
464
465
|
|
465
|
-
|
466
466
|
private
|
467
467
|
|
468
468
|
def mock_plantuml_disabled
|
@@ -471,13 +471,13 @@ Alice <-- Bob: another authentication Response
|
|
471
471
|
false
|
472
472
|
end
|
473
473
|
end
|
474
|
-
|
474
|
+
|
475
475
|
def mock_localdir_unwritable
|
476
476
|
expect(Asciidoctor::Standoc::Utils).to receive(:localdir) do
|
477
477
|
"/"
|
478
478
|
end.exactly(2).times
|
479
479
|
end
|
480
|
-
|
480
|
+
|
481
481
|
def mock_localdir_unwritable
|
482
482
|
expect(File).to receive(:writable?) do
|
483
483
|
false
|