asciidoctor 1.5.7.1 → 1.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +95 -5
- data/Gemfile +23 -13
- data/README-de.adoc +482 -0
- data/README-fr.adoc +128 -119
- data/README-jp.adoc +2 -3
- data/README-zh_CN.adoc +2 -3
- data/README.adoc +131 -106
- data/asciidoctor.gemspec +9 -7
- data/data/locale/attributes-ar.adoc +1 -1
- data/data/locale/attributes-bg.adoc +1 -1
- data/data/locale/attributes-ca.adoc +1 -1
- data/data/locale/attributes-cs.adoc +1 -1
- data/data/locale/attributes-da.adoc +1 -1
- data/data/locale/attributes-de.adoc +1 -1
- data/data/locale/attributes-en.adoc +1 -1
- data/data/locale/attributes-es.adoc +1 -1
- data/data/locale/attributes-fa.adoc +1 -1
- data/data/locale/attributes-fi.adoc +1 -1
- data/data/locale/attributes-fr.adoc +1 -1
- data/data/locale/attributes-hu.adoc +1 -1
- data/data/locale/attributes-id.adoc +1 -1
- data/data/locale/attributes-it.adoc +1 -1
- data/data/locale/attributes-ja.adoc +1 -1
- data/data/locale/attributes-kr.adoc +1 -1
- data/data/locale/attributes-nb.adoc +1 -1
- data/data/locale/attributes-nl.adoc +1 -1
- data/data/locale/attributes-nn.adoc +1 -1
- data/data/locale/attributes-pl.adoc +1 -1
- data/data/locale/attributes-pt.adoc +1 -1
- data/data/locale/attributes-pt_BR.adoc +1 -1
- data/data/locale/attributes-ro.adoc +1 -1
- data/data/locale/attributes-ru.adoc +1 -1
- data/data/locale/attributes-sr.adoc +5 -4
- data/data/locale/attributes-sr_Latn.adoc +5 -4
- data/data/locale/attributes-sv.adoc +23 -0
- data/data/locale/attributes-tr.adoc +1 -1
- data/data/locale/attributes-uk.adoc +1 -1
- data/data/locale/attributes-zh_CN.adoc +1 -1
- data/data/locale/attributes-zh_TW.adoc +1 -1
- data/data/stylesheets/asciidoctor-default.css +23 -23
- data/lib/asciidoctor.rb +110 -104
- data/lib/asciidoctor/abstract_block.rb +55 -32
- data/lib/asciidoctor/abstract_node.rb +32 -17
- data/lib/asciidoctor/attribute_list.rb +8 -7
- data/lib/asciidoctor/block.rb +5 -7
- data/lib/asciidoctor/cli/options.rb +5 -9
- data/lib/asciidoctor/converter.rb +2 -2
- data/lib/asciidoctor/converter/docbook45.rb +7 -20
- data/lib/asciidoctor/converter/docbook5.rb +36 -37
- data/lib/asciidoctor/converter/factory.rb +10 -8
- data/lib/asciidoctor/converter/html5.rb +90 -65
- data/lib/asciidoctor/converter/manpage.rb +72 -62
- data/lib/asciidoctor/converter/template.rb +8 -6
- data/lib/asciidoctor/core_ext/1.8.7/concurrent/hash.rb +5 -0
- data/lib/asciidoctor/document.rb +62 -10
- data/lib/asciidoctor/extensions.rb +74 -16
- data/lib/asciidoctor/helpers.rb +11 -14
- data/lib/asciidoctor/list.rb +2 -2
- data/lib/asciidoctor/parser.rb +223 -195
- data/lib/asciidoctor/path_resolver.rb +15 -7
- data/lib/asciidoctor/reader.rb +65 -36
- data/lib/asciidoctor/section.rb +6 -4
- data/lib/asciidoctor/substitutors.rb +170 -149
- data/lib/asciidoctor/table.rb +16 -8
- data/lib/asciidoctor/version.rb +1 -1
- data/man/asciidoctor.1 +6 -5
- data/man/asciidoctor.adoc +3 -2
- data/test/api_test.rb +236 -0
- data/test/attribute_list_test.rb +242 -0
- data/test/attributes_test.rb +65 -52
- data/test/blocks_test.rb +408 -260
- data/test/converter_test.rb +7 -7
- data/test/document_test.rb +60 -54
- data/test/extensions_test.rb +218 -32
- data/test/fixtures/doctime-localtime.adoc +2 -0
- data/test/fixtures/section-a.adoc +4 -0
- data/test/fixtures/subs.adoc +0 -1
- data/test/invoker_test.rb +56 -18
- data/test/links_test.rb +105 -81
- data/test/lists_test.rb +636 -265
- data/test/logger_test.rb +1 -1
- data/test/manpage_test.rb +140 -3
- data/test/paragraphs_test.rb +42 -42
- data/test/parser_test.rb +63 -183
- data/test/paths_test.rb +21 -4
- data/test/preamble_test.rb +9 -9
- data/test/reader_test.rb +78 -28
- data/test/sections_test.rb +273 -151
- data/test/substitutions_test.rb +53 -19
- data/test/tables_test.rb +286 -163
- data/test/test_helper.rb +4 -3
- data/test/text_test.rb +65 -65
- metadata +16 -21
data/test/logger_test.rb
CHANGED
@@ -202,7 +202,7 @@ first paragraph
|
|
202
202
|
another first paragraph
|
203
203
|
EOS
|
204
204
|
messages = redirect_streams do |_, err|
|
205
|
-
|
205
|
+
convert_string_to_embedded input
|
206
206
|
err.string
|
207
207
|
end
|
208
208
|
assert_equal 'asciidoctor: WARNING: <stdin>: line 5: id assigned to block already in use: first', messages.chomp
|
data/test/manpage_test.rb
CHANGED
@@ -43,7 +43,7 @@ context 'Manpage' do
|
|
43
43
|
assert_includes output.lines, %(command, alt_command \\- does stuff\n)
|
44
44
|
end
|
45
45
|
|
46
|
-
test 'should
|
46
|
+
test 'should not parse NAME section if manname and manpurpose attributes are set' do
|
47
47
|
input = <<-EOS
|
48
48
|
= foobar (1)
|
49
49
|
Author Name
|
@@ -51,10 +51,37 @@ Author Name
|
|
51
51
|
:man manual: Foo Bar Manual
|
52
52
|
:man source: Foo Bar 1.0
|
53
53
|
|
54
|
+
== SYNOPSIS
|
55
|
+
|
56
|
+
*foobar* [_OPTIONS_]...
|
57
|
+
|
58
|
+
== DESCRIPTION
|
59
|
+
|
60
|
+
When you need to put some foo on the bar.
|
61
|
+
EOS
|
62
|
+
|
63
|
+
attrs = { 'manname' => 'foobar', 'manpurpose' => 'puts some foo on the bar' }
|
64
|
+
doc = Asciidoctor.load input, :backend => :manpage, :header_footer => true, :attributes => attrs
|
65
|
+
assert_equal 'foobar', (doc.attr 'manname')
|
66
|
+
assert_equal ['foobar'], (doc.attr 'mannames')
|
67
|
+
assert_equal 'puts some foo on the bar', (doc.attr 'manpurpose')
|
68
|
+
assert_equal 'SYNOPSIS', doc.sections[0].title
|
69
|
+
end
|
70
|
+
|
71
|
+
test 'should normalize whitespace and skip line comments before and inside NAME section' do
|
72
|
+
input = <<-EOS
|
73
|
+
= foobar (1)
|
74
|
+
Author Name
|
75
|
+
:doctype: manpage
|
76
|
+
:man manual: Foo Bar Manual
|
77
|
+
:man source: Foo Bar 1.0
|
78
|
+
|
79
|
+
// this is the name section
|
54
80
|
== NAME
|
55
81
|
|
56
|
-
// follows the form `name - description`
|
57
|
-
foobar - puts some foo
|
82
|
+
// it follows the form `name - description`
|
83
|
+
foobar - puts some foo
|
84
|
+
on the bar
|
58
85
|
// a little bit of this, a little bit of that
|
59
86
|
|
60
87
|
== SYNOPSIS
|
@@ -70,6 +97,52 @@ When you need to put some foo on the bar.
|
|
70
97
|
assert_equal 'puts some foo on the bar', (doc.attr 'manpurpose')
|
71
98
|
end
|
72
99
|
|
100
|
+
test 'should parse malformed document with warnings' do
|
101
|
+
input = 'garbage in'
|
102
|
+
using_memory_logger do |logger|
|
103
|
+
doc = Asciidoctor.load input, :backend => :manpage, :header_footer => true, :attributes => { 'docname' => 'cmd' }
|
104
|
+
assert_equal 'cmd', doc.attr('manname')
|
105
|
+
assert_equal ['cmd'], doc.attr('mannames')
|
106
|
+
assert_equal '.1', doc.attr('outfilesuffix')
|
107
|
+
output = doc.convert
|
108
|
+
refute logger.messages.empty?
|
109
|
+
assert_includes output, 'Title: cmd'
|
110
|
+
assert output.end_with?('garbage in')
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
test 'should warn if document title is non-conforming' do
|
115
|
+
input = <<-EOS
|
116
|
+
= command
|
117
|
+
|
118
|
+
== Name
|
119
|
+
|
120
|
+
command - does stuff
|
121
|
+
EOS
|
122
|
+
|
123
|
+
using_memory_logger do |logger|
|
124
|
+
document_from_string input, :backend => :manpage
|
125
|
+
assert_message logger, :ERROR, '<stdin>: line 1: non-conforming manpage title', Hash
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
test 'should warn if first section is not name section' do
|
130
|
+
input = <<-EOS
|
131
|
+
= command(1)
|
132
|
+
|
133
|
+
== Synopsis
|
134
|
+
|
135
|
+
Does stuff.
|
136
|
+
EOS
|
137
|
+
|
138
|
+
using_memory_logger do |logger|
|
139
|
+
doc = document_from_string input, :backend => :manpage
|
140
|
+
assert_message logger, :ERROR, '<stdin>: line 3: non-conforming name section body', Hash
|
141
|
+
refute_nil doc.sections[0]
|
142
|
+
assert_equal 'Synopsis', doc.sections[0].title
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
73
146
|
test 'should define default linkstyle' do
|
74
147
|
input = SAMPLE_MANPAGE_HEADER
|
75
148
|
output = Asciidoctor.convert input, :backend => :manpage, :header_footer => true
|
@@ -134,6 +207,44 @@ BBB this line and the one above it should be visible)
|
|
134
207
|
output = Asciidoctor.convert input, :backend => :manpage
|
135
208
|
assert_equal '\&.if 1 .nx', output.lines.entries[-2].chomp
|
136
209
|
end
|
210
|
+
|
211
|
+
test 'should normalize whitespace in a paragraph' do
|
212
|
+
input = %(#{SAMPLE_MANPAGE_HEADER}
|
213
|
+
|
214
|
+
Oh, here it goes again
|
215
|
+
I should have known,
|
216
|
+
should have known,
|
217
|
+
should have known again)
|
218
|
+
|
219
|
+
output = Asciidoctor.convert input, :backend => :manpage
|
220
|
+
assert_includes output, %(Oh, here it goes again\nI should have known,\nshould have known,\nshould have known again)
|
221
|
+
end
|
222
|
+
|
223
|
+
test 'should normalize whitespace in a list item' do
|
224
|
+
input = %(#{SAMPLE_MANPAGE_HEADER}
|
225
|
+
|
226
|
+
* Oh, here it goes again
|
227
|
+
I should have known,
|
228
|
+
should have known,
|
229
|
+
should have known again)
|
230
|
+
|
231
|
+
output = Asciidoctor.convert input, :backend => :manpage
|
232
|
+
assert_includes output, %(Oh, here it goes again\nI should have known,\nshould have known,\nshould have known again)
|
233
|
+
end
|
234
|
+
|
235
|
+
test 'should collapse whitespace in the man manual and man source' do
|
236
|
+
input = %(#{SAMPLE_MANPAGE_HEADER}
|
237
|
+
|
238
|
+
Describe this thing.)
|
239
|
+
|
240
|
+
output = Asciidoctor.convert input, :backend => :manpage, :header_footer => true, :attributes => {
|
241
|
+
'manmanual' => %(General\nCommands\nManual),
|
242
|
+
'mansource' => %(Control\nAll\nThe\nThings\n5.0)
|
243
|
+
}
|
244
|
+
assert_includes output, 'Manual: General Commands Manual'
|
245
|
+
assert_includes output, 'Source: Control All The Things 5.0'
|
246
|
+
assert_includes output, '"Control All The Things 5.0" "General Commands Manual"'
|
247
|
+
end
|
137
248
|
end
|
138
249
|
|
139
250
|
context 'Backslash' do
|
@@ -467,6 +578,32 @@ The Magic 8 Ball says image:signs-point-to-yes.jpg[link=https://en.wikipedia.org
|
|
467
578
|
end
|
468
579
|
end
|
469
580
|
|
581
|
+
context 'Quote Block' do
|
582
|
+
test 'should indent quote block' do
|
583
|
+
input = %(#{SAMPLE_MANPAGE_HEADER}
|
584
|
+
|
585
|
+
[,James Baldwin]
|
586
|
+
____
|
587
|
+
Not everything that is faced can be changed.
|
588
|
+
But nothing can be changed until it is faced.
|
589
|
+
____)
|
590
|
+
output = Asciidoctor.convert input, :backend => :manpage
|
591
|
+
assert output.end_with? '.RS 3
|
592
|
+
.ll -.6i
|
593
|
+
.sp
|
594
|
+
Not everything that is faced can be changed.
|
595
|
+
But nothing can be changed until it is faced.
|
596
|
+
.br
|
597
|
+
.RE
|
598
|
+
.ll
|
599
|
+
.RS 5
|
600
|
+
.ll -.10i
|
601
|
+
\(em James Baldwin
|
602
|
+
.RE
|
603
|
+
.ll'
|
604
|
+
end
|
605
|
+
end
|
606
|
+
|
470
607
|
context 'Callout List' do
|
471
608
|
test 'should generate callout list using proper formatting commands' do
|
472
609
|
input = %(#{SAMPLE_MANPAGE_HEADER}
|
data/test/paragraphs_test.rb
CHANGED
@@ -12,7 +12,7 @@ Plain text for the win!
|
|
12
12
|
|
13
13
|
Yep. Text. Plain and simple.
|
14
14
|
EOS
|
15
|
-
output =
|
15
|
+
output = convert_string_to_embedded input
|
16
16
|
assert_css 'p', output, 2
|
17
17
|
assert_xpath '(//p)[1][text() = "Plain text for the win!"]', output, 1
|
18
18
|
assert_xpath '(//p)[2][text() = "Yep. Text. Plain and simple."]', output, 1
|
@@ -25,7 +25,7 @@ Paragraph.
|
|
25
25
|
|
26
26
|
Winning.
|
27
27
|
EOS
|
28
|
-
output =
|
28
|
+
output = convert_string_to_embedded input
|
29
29
|
|
30
30
|
assert_css 'p', output, 2
|
31
31
|
assert_xpath '(//p)[1]/preceding-sibling::*[@class = "title"]', output, 1
|
@@ -50,7 +50,7 @@ Paragraph 2
|
|
50
50
|
Last words
|
51
51
|
EOS
|
52
52
|
|
53
|
-
output =
|
53
|
+
output = convert_string input
|
54
54
|
assert_xpath '//p[text() = "Paragraph 2"]', output, 1
|
55
55
|
end
|
56
56
|
|
@@ -60,7 +60,7 @@ paragraph
|
|
60
60
|
. wrapped line
|
61
61
|
EOS
|
62
62
|
|
63
|
-
output =
|
63
|
+
output = convert_string_to_embedded input
|
64
64
|
assert_css 'p', output, 1
|
65
65
|
assert_xpath %(//p[text()="paragraph\n. wrapped line"]), output, 1
|
66
66
|
end
|
@@ -71,7 +71,7 @@ paragraph
|
|
71
71
|
.wrapped line
|
72
72
|
EOS
|
73
73
|
|
74
|
-
output =
|
74
|
+
output = convert_string_to_embedded input
|
75
75
|
assert_css 'p', output, 1
|
76
76
|
assert_xpath %(//p[text()="paragraph\n.wrapped line"]), output, 1
|
77
77
|
end
|
@@ -83,7 +83,7 @@ Normal paragraph.
|
|
83
83
|
Nothing special.
|
84
84
|
EOS
|
85
85
|
|
86
|
-
output =
|
86
|
+
output = convert_string_to_embedded input
|
87
87
|
assert_css 'p', output, 1
|
88
88
|
end
|
89
89
|
|
@@ -95,7 +95,7 @@ Nothing special.
|
|
95
95
|
Last line.
|
96
96
|
EOS
|
97
97
|
|
98
|
-
output =
|
98
|
+
output = convert_string_to_embedded input
|
99
99
|
assert_css 'p', output, 1
|
100
100
|
assert_xpath %(//p[text()="Normal paragraph.\n Nothing special.\nLast line."]), output, 1
|
101
101
|
end
|
@@ -106,7 +106,7 @@ normal text
|
|
106
106
|
[literal]
|
107
107
|
literal text
|
108
108
|
EOS
|
109
|
-
output =
|
109
|
+
output = convert_string_to_embedded input
|
110
110
|
assert_css '.paragraph:root', output, 1
|
111
111
|
assert_css '.literalblock:root', output, 1
|
112
112
|
end
|
@@ -118,7 +118,7 @@ normal text
|
|
118
118
|
text in open block
|
119
119
|
--
|
120
120
|
EOS
|
121
|
-
output =
|
121
|
+
output = convert_string_to_embedded input
|
122
122
|
assert_css '.paragraph:root', output, 1
|
123
123
|
assert_css '.openblock:root', output, 1
|
124
124
|
end
|
@@ -128,7 +128,7 @@ text in open block
|
|
128
128
|
normal text
|
129
129
|
+
|
130
130
|
EOS
|
131
|
-
output =
|
131
|
+
output = convert_string_to_embedded input
|
132
132
|
assert_css '.paragraph:root', output, 2
|
133
133
|
assert_xpath %((/*[@class="paragraph"])[1]/p[text() = "normal text"]), output, 1
|
134
134
|
assert_xpath %((/*[@class="paragraph"])[2]/p[text() = "+"]), output, 1
|
@@ -141,7 +141,7 @@ normal text
|
|
141
141
|
despite the leading indent
|
142
142
|
EOS
|
143
143
|
|
144
|
-
output =
|
144
|
+
output = convert_string_to_embedded input
|
145
145
|
assert_css '.paragraph:root > p', output, 1
|
146
146
|
end
|
147
147
|
|
@@ -154,7 +154,7 @@ Here is an index entry for indexterm2:[Linux].
|
|
154
154
|
Note that multi-entry terms generate separate index entries.
|
155
155
|
EOS
|
156
156
|
|
157
|
-
output =
|
157
|
+
output = convert_string_to_embedded input, :attributes => {'backend' => 'docbook45'}
|
158
158
|
assert_xpath '/simpara', output, 1
|
159
159
|
term1 = xmlnodes_at_xpath '(//indexterm)[1]', output, 1
|
160
160
|
assert_equal '<indexterm><primary>tigers</primary></indexterm>', term1.to_s
|
@@ -193,7 +193,7 @@ Note that multi-entry terms generate separate index entries.
|
|
193
193
|
*<Hey Jude>*
|
194
194
|
EOS
|
195
195
|
|
196
|
-
output =
|
196
|
+
output = convert_string_to_embedded input
|
197
197
|
assert_includes output, '*<Hey Jude>*'
|
198
198
|
end
|
199
199
|
|
@@ -203,7 +203,7 @@ Note that multi-entry terms generate separate index entries.
|
|
203
203
|
*<Hey Jude>*
|
204
204
|
EOS
|
205
205
|
|
206
|
-
output =
|
206
|
+
output = convert_string_to_embedded input
|
207
207
|
assert_includes output, '*<Hey Jude>*'
|
208
208
|
end
|
209
209
|
|
@@ -215,7 +215,7 @@ my
|
|
215
215
|
lips
|
216
216
|
EOS
|
217
217
|
|
218
|
-
output =
|
218
|
+
output = convert_string_to_embedded input
|
219
219
|
assert_css 'br', output, 2
|
220
220
|
assert_xpath '//p', output, 1
|
221
221
|
assert_includes output, "<p>read<br>\nmy<br>\nlips</p>"
|
@@ -231,7 +231,7 @@ lips
|
|
231
231
|
|
232
232
|
AWESOME!
|
233
233
|
EOS
|
234
|
-
output =
|
234
|
+
output = convert_string_to_embedded input
|
235
235
|
assert_xpath '//pre', output, 3
|
236
236
|
end
|
237
237
|
|
@@ -244,7 +244,7 @@ Install instructions:
|
|
244
244
|
|
245
245
|
You're good to go!
|
246
246
|
EOS
|
247
|
-
output =
|
247
|
+
output = convert_string_to_embedded input
|
248
248
|
assert_xpath '//pre', output, 1
|
249
249
|
# indentation should be trimmed from literal block
|
250
250
|
assert_xpath %(//pre[text() = "yum install ruby rubygems\ngem install asciidoctor"]), output, 1
|
@@ -255,7 +255,7 @@ You're good to go!
|
|
255
255
|
[literal]
|
256
256
|
this text is literally literal
|
257
257
|
EOS
|
258
|
-
output =
|
258
|
+
output = convert_string_to_embedded input
|
259
259
|
assert_xpath %(/*[@class="literalblock"]//pre[text()="this text is literally literal"]), output, 1
|
260
260
|
end
|
261
261
|
|
@@ -264,7 +264,7 @@ this text is literally literal
|
|
264
264
|
[literal]
|
265
265
|
image::not-an-image-block[]
|
266
266
|
EOS
|
267
|
-
output =
|
267
|
+
output = convert_string_to_embedded input
|
268
268
|
assert_xpath %(/*[@class="literalblock"]//pre[text()="image::not-an-image-block[]"]), output, 1
|
269
269
|
assert_css 'img', output, 0
|
270
270
|
end
|
@@ -274,7 +274,7 @@ image::not-an-image-block[]
|
|
274
274
|
[listing]
|
275
275
|
this text is a listing
|
276
276
|
EOS
|
277
|
-
output =
|
277
|
+
output = convert_string_to_embedded input
|
278
278
|
assert_xpath %(/*[@class="listingblock"]//pre[text()="this text is a listing"]), output, 1
|
279
279
|
end
|
280
280
|
|
@@ -283,7 +283,7 @@ this text is a listing
|
|
283
283
|
[source]
|
284
284
|
use the source, luke!
|
285
285
|
EOS
|
286
|
-
output =
|
286
|
+
output = convert_string_to_embedded input
|
287
287
|
assert_xpath %(/*[@class="listingblock"]//pre[@class="highlight"]/code[text()="use the source, luke!"]), output, 1
|
288
288
|
end
|
289
289
|
|
@@ -292,7 +292,7 @@ use the source, luke!
|
|
292
292
|
[source, perl]
|
293
293
|
die 'zomg perl sucks';
|
294
294
|
EOS
|
295
|
-
output =
|
295
|
+
output = convert_string_to_embedded input
|
296
296
|
assert_xpath %(/*[@class="listingblock"]//pre[@class="highlight"]/code[@class="language-perl"][@data-lang="perl"][text()="die 'zomg perl sucks';"]), output, 1
|
297
297
|
end
|
298
298
|
|
@@ -302,7 +302,7 @@ die 'zomg perl sucks';
|
|
302
302
|
[normal]
|
303
303
|
normal text
|
304
304
|
EOS
|
305
|
-
output =
|
305
|
+
output = convert_string_to_embedded input
|
306
306
|
assert_xpath %(/*[@class="literalblock"]), output, 1
|
307
307
|
assert_xpath %(/*[@class="paragraph"]), output, 1
|
308
308
|
end
|
@@ -314,7 +314,7 @@ normal text
|
|
314
314
|
normal text
|
315
315
|
--
|
316
316
|
EOS
|
317
|
-
output =
|
317
|
+
output = convert_string_to_embedded input
|
318
318
|
assert_xpath %(/*[@class="literalblock"]), output, 1
|
319
319
|
assert_xpath %(/*[@class="openblock"]), output, 1
|
320
320
|
end
|
@@ -324,7 +324,7 @@ normal text
|
|
324
324
|
literal text
|
325
325
|
+
|
326
326
|
EOS
|
327
|
-
output =
|
327
|
+
output = convert_string_to_embedded input
|
328
328
|
assert_xpath %(/*[@class="literalblock"]), output, 1
|
329
329
|
assert_xpath %(/*[@class="literalblock"]//pre[text() = "literal text"]), output, 1
|
330
330
|
assert_xpath %(/*[@class="paragraph"]), output, 1
|
@@ -338,7 +338,7 @@ normal text
|
|
338
338
|
[quote]
|
339
339
|
Famous quote.
|
340
340
|
EOS
|
341
|
-
output =
|
341
|
+
output = convert_string input
|
342
342
|
assert_xpath '//*[@class = "quoteblock"]', output, 1
|
343
343
|
assert_xpath '//*[@class = "quoteblock"]//p', output, 0
|
344
344
|
assert_xpath '//*[@class = "quoteblock"]//*[contains(text(), "Famous quote.")]', output, 1
|
@@ -350,14 +350,14 @@ Famous quote.
|
|
350
350
|
A famouse quote.
|
351
351
|
+
|
352
352
|
EOS
|
353
|
-
output =
|
353
|
+
output = convert_string_to_embedded input
|
354
354
|
assert_css '.quoteblock:root', output, 1
|
355
355
|
assert_css '.paragraph:root', output, 1
|
356
356
|
assert_xpath %(/*[@class="paragraph"]/p[text() = "+"]), output, 1
|
357
357
|
end
|
358
358
|
|
359
359
|
test "verse paragraph" do
|
360
|
-
output =
|
360
|
+
output = convert_string("[verse]\nFamous verse.")
|
361
361
|
assert_xpath '//*[@class = "verseblock"]', output, 1
|
362
362
|
assert_xpath '//*[@class = "verseblock"]/pre', output, 1
|
363
363
|
assert_xpath '//*[@class = "verseblock"]//p', output, 0
|
@@ -370,7 +370,7 @@ A famouse quote.
|
|
370
370
|
_GET /groups/link:#group-id[\{group-id\}]_
|
371
371
|
EOS
|
372
372
|
|
373
|
-
output =
|
373
|
+
output = convert_string_to_embedded input
|
374
374
|
assert_includes output, '<pre class="content"><em>GET /groups/<a href="#group-id">{group-id}</a></em></pre>'
|
375
375
|
end
|
376
376
|
|
@@ -381,7 +381,7 @@ _GET /groups/link:#group-id[\{group-id\}]_
|
|
381
381
|
*Hey Jude*
|
382
382
|
EOS
|
383
383
|
|
384
|
-
output =
|
384
|
+
output = convert_string_to_embedded input
|
385
385
|
assert_includes output, '*Hey Jude*'
|
386
386
|
end
|
387
387
|
end
|
@@ -389,19 +389,19 @@ _GET /groups/link:#group-id[\{group-id\}]_
|
|
389
389
|
context "special" do
|
390
390
|
test "note multiline syntax" do
|
391
391
|
Asciidoctor::ADMONITION_STYLES.each do |style|
|
392
|
-
assert_xpath "//div[@class='admonitionblock #{style.downcase}']",
|
392
|
+
assert_xpath "//div[@class='admonitionblock #{style.downcase}']", convert_string("[#{style}]\nThis is a winner.")
|
393
393
|
end
|
394
394
|
end
|
395
395
|
|
396
396
|
test "note block syntax" do
|
397
397
|
Asciidoctor::ADMONITION_STYLES.each do |style|
|
398
|
-
assert_xpath "//div[@class='admonitionblock #{style.downcase}']",
|
398
|
+
assert_xpath "//div[@class='admonitionblock #{style.downcase}']", convert_string("[#{style}]\n====\nThis is a winner.\n====")
|
399
399
|
end
|
400
400
|
end
|
401
401
|
|
402
402
|
test "note inline syntax" do
|
403
403
|
Asciidoctor::ADMONITION_STYLES.each do |style|
|
404
|
-
assert_xpath "//div[@class='admonitionblock #{style.downcase}']",
|
404
|
+
assert_xpath "//div[@class='admonitionblock #{style.downcase}']", convert_string("#{style}: This is important, fool!")
|
405
405
|
end
|
406
406
|
end
|
407
407
|
|
@@ -414,7 +414,7 @@ _GET /groups/link:#group-id[\{group-id\}]_
|
|
414
414
|
Content goes here
|
415
415
|
****
|
416
416
|
EOS
|
417
|
-
result =
|
417
|
+
result = convert_string(input)
|
418
418
|
assert_xpath "//*[@class='sidebarblock']//p", result, 1
|
419
419
|
end
|
420
420
|
|
@@ -428,7 +428,7 @@ Last line of sidebar.
|
|
428
428
|
endif::[]
|
429
429
|
EOS
|
430
430
|
|
431
|
-
result =
|
431
|
+
result = convert_string_to_embedded input
|
432
432
|
assert_equal %(<div class="sidebarblock">
|
433
433
|
<div class="content">
|
434
434
|
First line of sidebar.
|
@@ -439,7 +439,7 @@ Last line of sidebar.
|
|
439
439
|
end
|
440
440
|
|
441
441
|
context 'Styled Paragraphs' do
|
442
|
-
test 'should wrap text in simpara for styled paragraphs when
|
442
|
+
test 'should wrap text in simpara for styled paragraphs when converted to DocBook' do
|
443
443
|
input = <<-EOS
|
444
444
|
= Book
|
445
445
|
:doctype: book
|
@@ -470,7 +470,7 @@ Wise words from a wise person.
|
|
470
470
|
Make it what you want.
|
471
471
|
EOS
|
472
472
|
|
473
|
-
output =
|
473
|
+
output = convert_string input, :backend => 'docbook'
|
474
474
|
assert_css 'abstract > simpara', output, 1
|
475
475
|
assert_css 'partintro > simpara', output, 1
|
476
476
|
assert_css 'sidebar > simpara', output, 1
|
@@ -485,12 +485,12 @@ Make it what you want.
|
|
485
485
|
Make it what you want.
|
486
486
|
EOS
|
487
487
|
|
488
|
-
output =
|
488
|
+
output = convert_string_to_embedded input
|
489
489
|
assert_css '.openblock', output, 1
|
490
490
|
assert_css '.openblock p', output, 0
|
491
491
|
end
|
492
492
|
|
493
|
-
test 'should wrap text in simpara for styled paragraphs with title when
|
493
|
+
test 'should wrap text in simpara for styled paragraphs with title when converted to DocBook' do
|
494
494
|
input = <<-EOS
|
495
495
|
= Book
|
496
496
|
:doctype: book
|
@@ -523,7 +523,7 @@ As you can see here.
|
|
523
523
|
Wise words from a wise person.
|
524
524
|
EOS
|
525
525
|
|
526
|
-
output =
|
526
|
+
output = convert_string input, :backend => 'docbook'
|
527
527
|
assert_css 'abstract > title', output, 1
|
528
528
|
assert_xpath '//abstract/title[text() = "Abstract title"]', output, 1
|
529
529
|
assert_css 'abstract > title + simpara', output, 1
|
@@ -545,14 +545,14 @@ Wise words from a wise person.
|
|
545
545
|
context 'Inline doctype' do
|
546
546
|
test 'should only format and output text in first paragraph when doctype is inline' do
|
547
547
|
input = "http://asciidoc.org[AsciiDoc] is a _lightweight_ markup language...\n\nignored"
|
548
|
-
output =
|
548
|
+
output = convert_string input, :doctype => 'inline'
|
549
549
|
assert_equal '<a href="http://asciidoc.org">AsciiDoc</a> is a <em>lightweight</em> markup language…​', output
|
550
550
|
end
|
551
551
|
|
552
552
|
test 'should output nil and warn if first block is not a paragraph' do
|
553
553
|
input = '* bullet'
|
554
554
|
using_memory_logger do |logger|
|
555
|
-
output =
|
555
|
+
output = convert_string input, :doctype => 'inline'
|
556
556
|
assert_nil output
|
557
557
|
assert_message logger, :WARN, '~no inline candidate'
|
558
558
|
end
|