summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2019-03-14 23:55:19 -0600
committerGitHub <noreply@github.com>2019-03-14 23:55:19 -0600
commit2fc6d228248a5dbec486b798efb5102013f67b27 (patch)
treeeecaeee0a12b25a33f39e924dd84d3576e20c806 /test
parent94c28f2383c2cb860cd0d4ec9fb459f1a058e835 (diff)
resolves #1444 rename header_footer option to standalone (PR #3146)
* still honor header_footer option as fallback for backwards compatibility
Diffstat (limited to 'test')
-rw-r--r--test/api_test.rb38
-rw-r--r--test/attributes_test.rb8
-rw-r--r--test/blocks_test.rb24
-rw-r--r--test/converter_test.rb2
-rw-r--r--test/document_test.rb91
-rw-r--r--test/extensions_test.rb14
-rw-r--r--test/invoker_test.rb10
-rw-r--r--test/links_test.rb40
-rw-r--r--test/lists_test.rb16
-rw-r--r--test/manpage_test.rb24
-rw-r--r--test/options_test.rb2
-rw-r--r--test/reader_test.rb8
-rw-r--r--test/sections_test.rb2
-rw-r--r--test/substitutions_test.rb4
-rw-r--r--test/tables_test.rb14
-rw-r--r--test/test_helper.rb11
-rw-r--r--test/text_test.rb4
17 files changed, 178 insertions, 134 deletions
diff --git a/test/api_test.rb b/test/api_test.rb
index e00b0e56..f5700711 100644
--- a/test/api_test.rb
+++ b/test/api_test.rb
@@ -940,7 +940,19 @@ context 'API' do
assert_equal Asciidoctor.method(:convert), Asciidoctor.method(:render)
end
- test 'should convert source document to string when to_file is false' do
+ test 'should convert source document to standalone document string when to_file is false and standalone is true' do
+ sample_input_path = fixture_path('sample.adoc')
+
+ output = Asciidoctor.convert_file sample_input_path, standalone: true, to_file: false
+ refute_empty output
+ assert_xpath '/html', output, 1
+ assert_xpath '/html/head', output, 1
+ assert_xpath '/html/body', output, 1
+ assert_xpath '/html/head/title[text() = "Document Title"]', output, 1
+ assert_xpath '/html/body/*[@id="header"]/h1[text() = "Document Title"]', output, 1
+ end
+
+ test 'should convert source document to standalone document string when to_file is false and header_footer is true' do
sample_input_path = fixture_path('sample.adoc')
output = Asciidoctor.convert_file sample_input_path, header_footer: true, to_file: false
@@ -955,7 +967,7 @@ context 'API' do
test 'lines in output should be separated by line feed' do
sample_input_path = fixture_path('sample.adoc')
- output = Asciidoctor.convert_file sample_input_path, header_footer: true, to_file: false
+ output = Asciidoctor.convert_file sample_input_path, standalone: true, to_file: false
refute_empty output
lines = output.split("\n")
assert_equal lines.size, output.split(/\r\n|\r|\n/).size
@@ -978,7 +990,7 @@ context 'API' do
test 'should link to default stylesheet by default when safe mode is SECURE or greater' do
sample_input_path = fixture_path('basic.adoc')
- output = Asciidoctor.convert_file sample_input_path, header_footer: true, to_file: false
+ output = Asciidoctor.convert_file sample_input_path, standalone: true, to_file: false
assert_css 'html:root > head > link[rel="stylesheet"][href^="https://fonts.googleapis.com"]', output, 1
assert_css 'html:root > head > link[rel="stylesheet"][href="./asciidoctor.css"]', output, 1
end
@@ -990,7 +1002,7 @@ context 'API' do
text
EOS
- output = Asciidoctor.convert input, safe: Asciidoctor::SafeMode::SERVER, header_footer: true
+ output = Asciidoctor.convert input, safe: Asciidoctor::SafeMode::SERVER, standalone: true
assert_css 'html:root > head > link[rel="stylesheet"][href^="https://fonts.googleapis.com"]', output, 1
assert_css 'html:root > head > link[rel="stylesheet"][href="./asciidoctor.css"]', output, 0
stylenode = xmlnodes_at_css 'html:root > head > style', output, 1
@@ -1007,7 +1019,7 @@ context 'API' do
text
EOS
- output = Asciidoctor.convert input, header_footer: true
+ output = Asciidoctor.convert input, standalone: true
assert_css 'html:root > head > link[rel="stylesheet"][href^="https://fonts.googleapis.com"]', output, 1
assert_css 'html:root > head > link[rel="stylesheet"][href="./asciidoctor.css"]', output, 1
end
@@ -1021,7 +1033,7 @@ context 'API' do
#[{ 'linkcss!' => '' }, { 'linkcss' => nil }, { 'linkcss' => false }].each do |attrs|
[{ 'linkcss!' => '' }, { 'linkcss' => nil }].each do |attrs|
- output = Asciidoctor.convert input, header_footer: true, attributes: attrs
+ output = Asciidoctor.convert input, standalone: true, attributes: attrs
assert_css 'html:root > head > link[rel="stylesheet"][href^="https://fonts.googleapis.com"]', output, 1
assert_css 'html:root > head > link[rel="stylesheet"][href="./asciidoctor.css"]', output, 0
stylenode = xmlnodes_at_css 'html:root > head > style', output, 1
@@ -1033,7 +1045,7 @@ context 'API' do
test 'should embed default stylesheet if safe mode is less than SECURE and linkcss is unset from API' do
sample_input_path = fixture_path('basic.adoc')
- output = Asciidoctor.convert_file sample_input_path, header_footer: true, to_file: false,
+ output = Asciidoctor.convert_file sample_input_path, standalone: true, to_file: false,
safe: Asciidoctor::SafeMode::SAFE, attributes: { 'linkcss!' => '' }
assert_css 'html:root > head > style', output, 1
stylenode = xmlnodes_at_css 'html:root > head > style', output, 1
@@ -1049,7 +1061,7 @@ context 'API' do
text
EOS
- output = Asciidoctor.convert input, header_footer: true, attributes: { 'stylesheet!' => '' }
+ output = Asciidoctor.convert input, standalone: true, attributes: { 'stylesheet!' => '' }
assert_css 'html:root > head > link[rel="stylesheet"][href^="https://fonts.googleapis.com"]', output, 0
assert_css 'html:root > head > link[rel="stylesheet"]', output, 0
end
@@ -1061,11 +1073,11 @@ context 'API' do
text
EOS
- output = Asciidoctor.convert input, header_footer: true, attributes: { 'stylesheet' => './custom.css' }
+ output = Asciidoctor.convert input, standalone: true, attributes: { 'stylesheet' => './custom.css' }
assert_css 'html:root > head > link[rel="stylesheet"][href^="https://fonts.googleapis.com"]', output, 0
assert_css 'html:root > head > link[rel="stylesheet"][href="./custom.css"]', output, 1
- output = Asciidoctor.convert input, header_footer: true, attributes: { 'stylesheet' => 'file:///home/username/custom.css' }
+ output = Asciidoctor.convert input, standalone: true, attributes: { 'stylesheet' => 'file:///home/username/custom.css' }
assert_css 'html:root > head > link[rel="stylesheet"][href="file:///home/username/custom.css"]', output, 1
end
@@ -1076,13 +1088,13 @@ context 'API' do
text
EOS
- output = Asciidoctor.convert input, header_footer: true, attributes: { 'stylesheet' => 'custom.css', 'stylesdir' => './stylesheets' }
+ output = Asciidoctor.convert input, standalone: true, attributes: { 'stylesheet' => 'custom.css', 'stylesdir' => './stylesheets' }
assert_css 'html:root > head > link[rel="stylesheet"][href="./stylesheets/custom.css"]', output, 1
end
test 'should resolve custom stylesheet to embed relative to stylesdir' do
sample_input_path = fixture_path('basic.adoc')
- output = Asciidoctor.convert_file sample_input_path, header_footer: true, safe: Asciidoctor::SafeMode::SAFE, to_file: false,
+ output = Asciidoctor.convert_file sample_input_path, standalone: true, safe: Asciidoctor::SafeMode::SAFE, to_file: false,
attributes: { 'stylesheet' => 'custom.css', 'stylesdir' => './stylesheets', 'linkcss!' => '' }
stylenode = xmlnodes_at_css 'html:root > head > style', output, 1
styles = stylenode.content
@@ -1173,7 +1185,7 @@ context 'API' do
sample_input = '{outfilesuffix}'
sample_output_path = fixture_path('result.htm')
begin
- Asciidoctor.convert sample_input, to_file: sample_output_path, header_footer: false
+ Asciidoctor.convert sample_input, to_file: sample_output_path
assert File.exist?(sample_output_path)
output = File.read(sample_output_path)
refute_empty output
diff --git a/test/attributes_test.rb b/test/attributes_test.rb
index e731d125..26eafe59 100644
--- a/test/attributes_test.rb
+++ b/test/attributes_test.rb
@@ -352,10 +352,10 @@ context 'Attributes' do
].each do |attributes|
doc = document_from_string '== Heading', attributes: attributes
refute doc.attr?('sectids')
- assert_css '#_heading', (doc.convert header_footer: false), 0
+ assert_css '#_heading', (doc.convert standalone: false), 0
doc = document_from_string %(:sectids:\n\n== Heading), attributes: attributes
assert doc.attr?('sectids')
- assert_css '#_heading', (doc.convert header_footer: false), 1
+ assert_css '#_heading', (doc.convert standalone: false), 1
end
end
@@ -1071,7 +1071,7 @@ context 'Attributes' do
EOS
doc = document_from_string input
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
assert_equal 1, doc.attributes['mycounter']
assert_xpath '//p[text()="1"]', output, 2
end
@@ -1088,7 +1088,7 @@ context 'Attributes' do
EOS
doc = document_from_string input
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
assert_equal 1, doc.attributes['mycounter']
assert_xpath '//p[text()="before: 1 2 3"]', output, 1
assert_xpath '//p[text()="after: 1"]', output, 1
diff --git a/test/blocks_test.rb b/test/blocks_test.rb
index f1906a37..c6a536ae 100644
--- a/test/blocks_test.rb
+++ b/test/blocks_test.rb
@@ -959,8 +959,8 @@ context 'Blocks' do
line three
....
EOS
- [true, false].each do |header_footer|
- output = convert_string input, header_footer: header_footer
+ [true, false].each do |standalone|
+ output = convert_string input, standalone: standalone
assert_xpath '//pre', output, 1
assert_xpath '//pre/text()', output, 1
text = xmlnodes_at_xpath('//pre/text()', output, 1).text
@@ -983,8 +983,8 @@ context 'Blocks' do
line three
----
EOS
- [true, false].each do |header_footer|
- output = convert_string input, header_footer: header_footer
+ [true, false].each do |standalone|
+ output = convert_string input, standalone: standalone
assert_xpath '//pre', output, 1
assert_xpath '//pre/text()', output, 1
text = xmlnodes_at_xpath('//pre/text()', output, 1).text
@@ -1010,8 +1010,8 @@ context 'Blocks' do
____
--
EOS
- [true, false].each do |header_footer|
- output = convert_string input, header_footer: header_footer
+ [true, false].each do |standalone|
+ output = convert_string input, standalone: standalone
assert_xpath '//*[@class="verseblock"]/pre', output, 1
assert_xpath '//*[@class="verseblock"]/pre/text()', output, 1
text = xmlnodes_at_xpath('//*[@class="verseblock"]/pre/text()', output, 1).text
@@ -1040,7 +1040,7 @@ context 'Blocks' do
....
EOS
- doc = document_from_string input, header_footer: false
+ doc = document_from_string input, standalone: false
block = doc.blocks.first
assert_equal ['', '', ' first line', '', 'last line', '', '{empty}', ''], block.lines
result = doc.convert
@@ -1552,7 +1552,7 @@ context 'Blocks' do
++++
EOS
- doc = document_from_string input, header_footer: false
+ doc = document_from_string input, standalone: false
block = doc.blocks[1]
assert_equal ['', '', ' first line', '', 'last line', '', ''], block.lines
result = doc.convert
@@ -1752,7 +1752,7 @@ context 'Blocks' do
EOS
using_memory_logger do |logger|
- doc = document_from_string input, backend: :docbook, header_footer: false
+ doc = document_from_string input, backend: :docbook, standalone: false
actual = doc.convert
if asciimath_available
assert_equal expect, actual.strip
@@ -1853,7 +1853,7 @@ context 'Blocks' do
stemblock = doc.blocks[0]
assert_equal :stem, stemblock.context
assert_equal 'asciimath', stemblock.attributes['style']
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
assert_css '.stemblock', output, 1
nodes = xmlnodes_at_xpath '//*[@class="content"]/child::text()', output
assert_equal '\$sqrt(3x-1)+(1+x)^2 &lt; y\$', nodes.first.to_s.strip
@@ -3350,7 +3350,7 @@ context 'Blocks' do
....
EOS
- doc = document_from_string input, header_footer: false
+ doc = document_from_string input, standalone: false
block = doc.blocks.first
assert_equal [:attributes, :specialcharacters, :macros], block.subs
result = doc.convert
@@ -3363,7 +3363,7 @@ context 'Blocks' do
_hey now_ <1>
EOS
- doc = document_from_string input, header_footer: false
+ doc = document_from_string input, standalone: false
block = doc.blocks.first
assert_equal [:specialcharacters], block.subs
result = doc.convert
diff --git a/test/converter_test.rb b/test/converter_test.rb
index 57a7ddc7..359e8c2b 100644
--- a/test/converter_test.rb
+++ b/test/converter_test.rb
@@ -400,7 +400,7 @@ context 'Converter' do
doc = document_from_string input, converter: converter
assert_equal converter, doc.converter
assert_equal 'xml', (doc.attr 'htmlsyntax')
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
assert_includes output, '<img src="sunset.jpg" alt="sunset"/>'
end
diff --git a/test/document_test.rb b/test/document_test.rb
index 68baa95f..05509903 100644
--- a/test/document_test.rb
+++ b/test/document_test.rb
@@ -150,7 +150,7 @@ context 'Document' do
cases.each do |attr_val, markup|
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, safe: Asciidoctor::SafeMode::SERVER, attributes: %(linkcss copycss! #{attr_val})
+ standalone: true, safe: Asciidoctor::SafeMode::SERVER, attributes: %(linkcss copycss! #{attr_val})
refute_empty output
assert_css 'script[src="modernizr.js"]', output, markup[:head_script]
assert_css 'meta[http-equiv="imagetoolbar"]', output, markup[:meta]
@@ -164,7 +164,7 @@ context 'Document' do
test 'should include docinfo header even if noheader attribute is set' do
sample_input_path = fixture_path('basic.adoc')
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo' => 'private-header', 'noheader' => '' }
+ standalone: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo' => 'private-header', 'noheader' => '' }
refute_empty output
assert_css 'body > nav.navbar', output, 1
assert_css 'body > nav.navbar + #content', output, 1
@@ -173,7 +173,7 @@ context 'Document' do
test 'should include docinfo footer even if nofooter attribute is set' do
sample_input_path = fixture_path('basic.adoc')
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo1' => '', 'nofooter' => '' }
+ standalone: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo1' => '', 'nofooter' => '' }
refute_empty output
assert_css 'body > a#top', output, 1
end
@@ -182,7 +182,7 @@ context 'Document' do
sample_input_path = fixture_path 'basic.adoc'
attrs = { 'docinfo' => 'shared', 'source-highlighter' => 'highlight.js', 'linkcss' => '', 'copycss' => nil }
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, safe: :safe, attributes: attrs
+ standalone: true, safe: :safe, attributes: attrs
assert_css 'link[rel=stylesheet] + meta[http-equiv=imagetoolbar]', output, 1
assert_css 'meta[http-equiv=imagetoolbar] + *', output, 0
assert_css 'script + a#top', output, 1
@@ -193,25 +193,25 @@ context 'Document' do
sample_input_path = fixture_path('basic.adoc')
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo' => '', 'docinfodir' => 'custom-docinfodir' }
+ standalone: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo' => '', 'docinfodir' => 'custom-docinfodir' }
refute_empty output
assert_css 'script[src="bootstrap.js"]', output, 1
assert_css 'meta[name="robots"]', output, 0
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo1' => '', 'docinfodir' => 'custom-docinfodir' }
+ standalone: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo1' => '', 'docinfodir' => 'custom-docinfodir' }
refute_empty output
assert_css 'script[src="bootstrap.js"]', output, 0
assert_css 'meta[name="robots"]', output, 1
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo2' => '', 'docinfodir' => './custom-docinfodir' }
+ standalone: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo2' => '', 'docinfodir' => './custom-docinfodir' }
refute_empty output
assert_css 'script[src="bootstrap.js"]', output, 1
assert_css 'meta[name="robots"]', output, 1
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo2' => '', 'docinfodir' => 'custom-docinfodir/subfolder' }
+ standalone: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo2' => '', 'docinfodir' => 'custom-docinfodir/subfolder' }
refute_empty output
assert_css 'script[src="bootstrap.js"]', output, 0
assert_css 'meta[name="robots"]', output, 0
@@ -221,13 +221,13 @@ context 'Document' do
sample_input_path = fixture_path('basic.adoc')
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, backend: 'docbook', safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo' => '' }
+ standalone: true, backend: 'docbook', safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo' => '' }
refute_empty output
assert_css 'productname', output, 0
assert_css 'copyright', output, 1
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, backend: 'docbook', safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo1' => '' }
+ standalone: true, backend: 'docbook', safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo1' => '' }
refute_empty output
assert_css 'productname', output, 1
assert_xpath '//xmlns:productname[text()="Asciidoctorâ„¢"]', output, 1
@@ -236,7 +236,7 @@ context 'Document' do
assert_css 'copyright', output, 0
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, backend: 'docbook', safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo2' => '' }
+ standalone: true, backend: 'docbook', safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo2' => '' }
refute_empty output
assert_css 'productname', output, 1
assert_xpath '//xmlns:productname[text()="Asciidoctorâ„¢"]', output, 1
@@ -247,7 +247,7 @@ context 'Document' do
test 'should use header docinfo in place of default header' do
output = Asciidoctor.convert_file fixture_path('sample.adoc'), to_file: false,
- header_footer: true, backend: 'docbook', safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo' => 'private-header', 'noheader' => '' }
+ standalone: true, backend: 'docbook', safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo' => 'private-header', 'noheader' => '' }
refute_empty output
assert_css 'article > info', output, 1
assert_css 'article > info > title', output, 1
@@ -259,19 +259,19 @@ context 'Document' do
sample_input_path = fixture_path('basic.adoc')
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo' => '' }
+ standalone: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo' => '' }
refute_empty output
assert_css 'body script', output, 1
assert_css 'a#top', output, 0
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo1' => '' }
+ standalone: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo1' => '' }
refute_empty output
assert_css 'body script', output, 0
assert_css 'a#top', output, 1
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo2' => '' }
+ standalone: true, safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo2' => '' }
refute_empty output
assert_css 'body script', output, 1
assert_css 'a#top', output, 1
@@ -281,20 +281,20 @@ context 'Document' do
sample_input_path = fixture_path('basic.adoc')
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, backend: 'docbook', safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo' => '' }
+ standalone: true, backend: 'docbook', safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo' => '' }
refute_empty output
assert_css 'article > revhistory', output, 1
assert_xpath '/xmlns:article/xmlns:revhistory/xmlns:revision/xmlns:revnumber[text()="1.0"]', output, 1 # verifies substitutions are performed
assert_css 'glossary', output, 0
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, backend: 'docbook', safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo1' => '' }
+ standalone: true, backend: 'docbook', safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo1' => '' }
refute_empty output
assert_css 'article > revhistory', output, 0
assert_css 'glossary[xml|id="_glossary"]', output, 1
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, backend: 'docbook', safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo2' => '' }
+ standalone: true, backend: 'docbook', safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo2' => '' }
refute_empty output
assert_css 'article > revhistory', output, 1
assert_xpath '/xmlns:article/xmlns:revhistory/xmlns:revision/xmlns:revnumber[text()="1.0"]', output, 1 # verifies substitutions are performed
@@ -310,7 +310,7 @@ context 'Document' do
$VERBOSE = nil # disable warnings since we have to modify constants
Encoding.default_external = Encoding.default_internal = Encoding::IBM437
sample_input_path = fixture_path('basic.adoc')
- output = Asciidoctor.convert_file sample_input_path, to_file: false, header_footer: true,
+ output = Asciidoctor.convert_file sample_input_path, to_file: false, standalone: true,
backend: 'docbook', safe: Asciidoctor::SafeMode::SERVER, attributes: { 'docinfo' => 'private,shared' }
refute_empty output
assert_css 'productname', output, 1
@@ -329,13 +329,13 @@ context 'Document' do
sample_input_path = fixture_path('basic.adoc')
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, safe: Asciidoctor::SafeMode::SERVER
+ standalone: true, safe: Asciidoctor::SafeMode::SERVER
refute_empty output
assert_css 'script[src="modernizr.js"]', output, 0
assert_css 'meta[http-equiv="imagetoolbar"]', output, 0
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, backend: 'docbook', safe: Asciidoctor::SafeMode::SERVER
+ standalone: true, backend: 'docbook', safe: Asciidoctor::SafeMode::SERVER
refute_empty output
assert_css 'productname', output, 0
assert_css 'copyright', output, 0
@@ -345,13 +345,13 @@ context 'Document' do
sample_input_path = fixture_path('basic.adoc')
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, attributes: { 'docinfo2' => '' }
+ standalone: true, attributes: { 'docinfo2' => '' }
refute_empty output
assert_css 'script[src="modernizr.js"]', output, 0
assert_css 'meta[http-equiv="imagetoolbar"]', output, 0
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true, backend: 'docbook', attributes: { 'docinfo2' => '' }
+ standalone: true, backend: 'docbook', attributes: { 'docinfo2' => '' }
refute_empty output
assert_css 'productname', output, 0
assert_css 'copyright', output, 0
@@ -362,7 +362,7 @@ context 'Document' do
using_memory_logger do |logger|
output = Asciidoctor.convert_file sample_input_path,
to_file: false,
- header_footer: true,
+ standalone: true,
safe: :server,
attributes: { 'docinfo' => '', 'bootstrap-version' => nil, 'linkcss' => '', 'attribute-missing' => 'drop-line' }
refute_empty output
@@ -376,7 +376,7 @@ context 'Document' do
sample_input_path = fixture_path 'subs.adoc'
output = Asciidoctor.convert_file sample_input_path,
to_file: false,
- header_footer: true,
+ standalone: true,
safe: :server,
attributes: { 'docinfo' => '', 'docinfosubs' => 'attributes,replacements', 'linkcss' => '' }
refute_empty output
@@ -1039,8 +1039,8 @@ context 'Document' do
assert_xpath '//*[@id="footer-text"][normalize-space(text())=""]', result, 1
end
- test 'no header footer' do
- doc = document_from_string "= Document Title\n\ncontent", header_footer: false
+ test 'should create embedded document if standalone option passed to constructor is false' do
+ doc = (Asciidoctor::Document.new "= Document Title\n\ncontent", standalone: false).parse
assert doc.attr?('embedded')
result = doc.convert
assert_xpath '/html', result, 0
@@ -1050,6 +1050,39 @@ context 'Document' do
assert_xpath '/*[@class="paragraph"]', result, 1
end
+ test 'should create embedded document if standalone option passed to convert method is false' do
+ doc = (Asciidoctor::Document.new "= Document Title\n\ncontent", standalone: true).parse
+ refute doc.attr?('embedded')
+ result = doc.convert standalone: false
+ assert_xpath '/html', result, 0
+ assert_xpath '/h1', result, 1
+ assert_xpath '/*[@id="header"]', result, 0
+ assert_xpath '/*[@id="footer"]', result, 0
+ assert_xpath '/*[@class="paragraph"]', result, 1
+ end
+
+ test 'should create embedded document if deprecated header_footer option is false' do
+ doc = (Asciidoctor::Document.new "= Document Title\n\ncontent", header_footer: false).parse
+ assert doc.attr?('embedded')
+ result = doc.convert
+ assert_xpath '/html', result, 0
+ assert_xpath '/h1', result, 0
+ assert_xpath '/*[@id="header"]', result, 0
+ assert_xpath '/*[@id="footer"]', result, 0
+ assert_xpath '/*[@class="paragraph"]', result, 1
+ end
+
+ test 'should create embedded document if header_footer option passed to convert method is false' do
+ doc = (Asciidoctor::Document.new "= Document Title\n\ncontent", header_footer: true).parse
+ refute doc.attr?('embedded')
+ result = doc.convert header_footer: false
+ assert_xpath '/html', result, 0
+ assert_xpath '/h1', result, 1
+ assert_xpath '/*[@id="header"]', result, 0
+ assert_xpath '/*[@id="footer"]', result, 0
+ assert_xpath '/*[@class="paragraph"]', result, 1
+ end
+
test 'enable title in embedded document by unassigning notitle attribute' do
input = <<~'EOS'
= Document Title
@@ -1236,7 +1269,7 @@ context 'Document' do
doc = document_from_string input, safe: :safe, attributes: { 'htmlsyntax' => 'xml' }
assert_equal 'html5', doc.backend
assert_equal 'xml', (doc.attr 'htmlsyntax')
- result = doc.convert header_footer: false
+ result = doc.convert standalone: false
assert_equal '<hr/>', result
end
@@ -1250,7 +1283,7 @@ context 'Document' do
doc = document_from_string input, safe: :safe
assert_equal 'html5', doc.backend
assert_equal 'xml', (doc.attr 'htmlsyntax')
- result = doc.convert header_footer: false
+ result = doc.convert standalone: false
assert_equal '<hr/>', result
end
diff --git a/test/extensions_test.rb b/test/extensions_test.rb
index b2d6b9b1..c4ecd9c4 100644
--- a/test/extensions_test.rb
+++ b/test/extensions_test.rb
@@ -1503,7 +1503,7 @@ context 'Extensions' do
sample_input_path = fixture_path('basic.adoc')
output = Asciidoctor.convert_file sample_input_path, to_file: false,
- header_footer: true,
+ standalone: true,
safe: Asciidoctor::SafeMode::SERVER,
attributes: { 'docinfo' => '' }
refute_empty output
@@ -1544,7 +1544,7 @@ context 'Extensions' do
test 'should assign alt attribute to image block if alt is not provided' do
input = 'cat_in_sink::25[]'
- doc = document_from_string input, header_footer: false, extension_registry: create_cat_in_sink_block_macro
+ doc = document_from_string input, standalone: false, extension_registry: create_cat_in_sink_block_macro
image = doc.blocks[0]
assert_equal 'cat in sink day 25', (image.attr 'alt')
assert_equal 'cat in sink day 25', (image.attr 'default-alt')
@@ -1554,7 +1554,7 @@ context 'Extensions' do
test 'should create an image block if mandatory attributes are provided' do
input = 'cat_in_sink::30[cat in sink (yes)]'
- doc = document_from_string input, header_footer: false, extension_registry: create_cat_in_sink_block_macro
+ doc = document_from_string input, standalone: false, extension_registry: create_cat_in_sink_block_macro
image = doc.blocks[0]
assert_equal 'cat in sink (yes)', (image.attr 'alt')
refute(image.attr? 'default-alt')
@@ -1564,7 +1564,7 @@ context 'Extensions' do
test 'should not assign caption on image block if title is not set on custom block macro' do
input = 'cat_in_sink::30[]'
- doc = document_from_string input, header_footer: false, extension_registry: create_cat_in_sink_block_macro
+ doc = document_from_string input, standalone: false, extension_registry: create_cat_in_sink_block_macro
output = doc.convert
assert_xpath '/*[@class="imageblock"]/*[@class="title"]', output, 0
end
@@ -1574,14 +1574,14 @@ context 'Extensions' do
.Cat in Sink?
cat_in_sink::30[]
EOS
- doc = document_from_string input, header_footer: false, extension_registry: create_cat_in_sink_block_macro
+ doc = document_from_string input, standalone: false, extension_registry: create_cat_in_sink_block_macro
output = doc.convert
assert_xpath '/*[@class="imageblock"]/*[@class="title"][text()="Figure 1. Cat in Sink?"]', output, 1
end
test 'should assign id and role on list items unordered' do
input = 'santa_list::ulist[]'
- doc = document_from_string input, header_footer: false, extension_registry: create_santa_list_block_macro
+ doc = document_from_string input, standalone: false, extension_registry: create_santa_list_block_macro
output = doc.convert
assert_xpath '/div[@class="ulist"]/ul/li[@class="friendly"][@id="santa-list-guillaume"]', output, 1
assert_xpath '/div[@class="ulist"]/ul/li[@class="kind contributor java"]', output, 1
@@ -1593,7 +1593,7 @@ context 'Extensions' do
test 'should assign id and role on list items ordered' do
input = 'santa_list::olist[]'
- doc = document_from_string input, header_footer: false, extension_registry: create_santa_list_block_macro
+ doc = document_from_string input, standalone: false, extension_registry: create_santa_list_block_macro
output = doc.convert
assert_xpath '/div[@class="olist"]/ol/li[@class="friendly"][@id="santa-list-guillaume"]', output, 1
assert_xpath '/div[@class="olist"]/ol/li[@class="kind contributor java"]', output, 1
diff --git a/test/invoker_test.rb b/test/invoker_test.rb
index 7ea19c61..7470c684 100644
--- a/test/invoker_test.rb
+++ b/test/invoker_test.rb
@@ -462,10 +462,12 @@ context 'Invoker' do
end
test 'should suppress header footer if specified' do
- invoker = invoke_cli_to_buffer %w(-s -o -)
- output = invoker.read_output
- assert_xpath '/html', output, 0
- assert_xpath '/*[@id="preamble"]', output, 1
+ [%w(-s -o -), %w(-e -o -)].each do |flags|
+ invoker = invoke_cli_to_buffer flags
+ output = invoker.read_output
+ assert_xpath '/html', output, 0
+ assert_xpath '/*[@id="preamble"]', output, 1
+ end
end
test 'should write page for each alternate manname' do
diff --git a/test/links_test.rb b/test/links_test.rb
index b049bcdb..6f72adb3 100644
--- a/test/links_test.rb
+++ b/test/links_test.rb
@@ -58,9 +58,9 @@ context 'Links' do
test 'qualified url with label containing square brackets using link macro' do
str = 'http://example.com[[bracket1\]]'
- doc = document_from_string str, header_footer: false, doctype: 'inline'
+ doc = document_from_string str, standalone: false, doctype: 'inline'
assert_match '<a href="http://example.com">[bracket1]</a>', doc.convert, 1
- doc = document_from_string str, header_footer: false, backend: 'docbook', doctype: 'inline'
+ doc = document_from_string str, standalone: false, backend: 'docbook', doctype: 'inline'
assert_match '<link xl:href="http://example.com">[bracket1]</link>', doc.convert, 1
end
@@ -341,7 +341,7 @@ context 'Links' do
test 'inline ref with reftext converted to DocBook' do
%w([[tigers,<Tigers>]] anchor:tigers[<Tigers>]).each do |anchor|
doc = document_from_string %(Here you can read about tigers.#{anchor}), backend: :docbook
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
assert_kind_of Asciidoctor::Inline, doc.catalog[:refs]['tigers']
assert_equal '<Tigers>', doc.catalog[:refs]['tigers'].text
assert_includes output, '<anchor xml:id="tigers" xreflabel="&lt;Tigers&gt;"/>'
@@ -421,13 +421,13 @@ context 'Links' do
test 'should not interpret path sans extension in xref with angled bracket syntax in compat mode' do
using_memory_logger do |logger|
- doc = document_from_string '<<tigers#>>', header_footer: false, attributes: { 'compat-mode' => '' }
+ doc = document_from_string '<<tigers#>>', standalone: false, attributes: { 'compat-mode' => '' }
assert_xpath '//a[@href="#tigers#"][text() = "[tigers#]"]', doc.convert, 1
end
end
test 'xref using angled bracket syntax with path sans extension' do
- doc = document_from_string '<<tigers#>>', header_footer: false
+ doc = document_from_string '<<tigers#>>', standalone: false
assert_xpath '//a[@href="tigers.html"][text() = "tigers.html"]', doc.convert, 1
end
@@ -476,75 +476,75 @@ context 'Links' do
end
test 'xref using angled bracket syntax with path sans extension using docbook backend' do
- doc = document_from_string '<<tigers#>>', header_footer: false, backend: 'docbook'
+ doc = document_from_string '<<tigers#>>', standalone: false, backend: 'docbook'
assert_match '<link xl:href="tigers.xml">tigers.xml</link>', doc.convert, 1
end
test 'xref using angled bracket syntax with ancestor path sans extension' do
- doc = document_from_string '<<../tigers#,tigers>>', header_footer: false
+ doc = document_from_string '<<../tigers#,tigers>>', standalone: false
assert_xpath '//a[@href="../tigers.html"][text() = "tigers"]', doc.convert, 1
end
test 'xref using angled bracket syntax with absolute path sans extension' do
- doc = document_from_string '<</path/to/tigers#,tigers>>', header_footer: false
+ doc = document_from_string '<</path/to/tigers#,tigers>>', standalone: false
assert_xpath '//a[@href="/path/to/tigers.html"][text() = "tigers"]', doc.convert, 1
end
test 'xref using angled bracket syntax with path and extension' do
using_memory_logger do |logger|
- doc = document_from_string '<<tigers.adoc>>', header_footer: false
+ doc = document_from_string '<<tigers.adoc>>', standalone: false
assert_xpath '//a[@href="#tigers.adoc"][text() = "[tigers.adoc]"]', doc.convert, 1
end
end
test 'xref using angled bracket syntax with path and extension with hash' do
- doc = document_from_string '<<tigers.adoc#>>', header_footer: false
+ doc = document_from_string '<<tigers.adoc#>>', standalone: false
assert_xpath '//a[@href="tigers.html"][text() = "tigers.html"]', doc.convert, 1
end
test 'xref using angled bracket syntax with path and extension with fragment' do
- doc = document_from_string '<<tigers.adoc#id>>', header_footer: false
+ doc = document_from_string '<<tigers.adoc#id>>', standalone: false
assert_xpath '//a[@href="tigers.html#id"][text() = "tigers.html"]', doc.convert, 1
end
test 'xref using macro syntax with path and extension in compat mode' do
using_memory_logger do |logger|
- doc = document_from_string 'xref:tigers.adoc[]', header_footer: false, attributes: { 'compat-mode' => '' }
+ doc = document_from_string 'xref:tigers.adoc[]', standalone: false, attributes: { 'compat-mode' => '' }
assert_xpath '//a[@href="#tigers.adoc"][text() = "[tigers.adoc]"]', doc.convert, 1
end
end
test 'xref using macro syntax with path and extension' do
- doc = document_from_string 'xref:tigers.adoc[]', header_footer: false
+ doc = document_from_string 'xref:tigers.adoc[]', standalone: false
assert_xpath '//a[@href="tigers.html"][text() = "tigers.html"]', doc.convert, 1
end
test 'xref using angled bracket syntax with path and fragment' do
- doc = document_from_string '<<tigers#about>>', header_footer: false
+ doc = document_from_string '<<tigers#about>>', standalone: false
assert_xpath '//a[@href="tigers.html#about"][text() = "tigers.html"]', doc.convert, 1
end
test 'xref using angled bracket syntax with path, fragment and text' do
- doc = document_from_string '<<tigers#about,About Tigers>>', header_footer: false
+ doc = document_from_string '<<tigers#about,About Tigers>>', standalone: false
assert_xpath '//a[@href="tigers.html#about"][text() = "About Tigers"]', doc.convert, 1
end
test 'xref using angled bracket syntax with path and custom relfilesuffix and outfilesuffix' do
attributes = { 'relfileprefix' => '../', 'outfilesuffix' => '/' }
- doc = document_from_string '<<tigers#about,About Tigers>>', header_footer: false, attributes: attributes
+ doc = document_from_string '<<tigers#about,About Tigers>>', standalone: false, attributes: attributes
assert_xpath '//a[@href="../tigers/#about"][text() = "About Tigers"]', doc.convert, 1
end
test 'xref using angled bracket syntax with path and custom relfilesuffix' do
attributes = { 'relfilesuffix' => '/' }
- doc = document_from_string '<<tigers#about,About Tigers>>', header_footer: false, attributes: attributes
+ doc = document_from_string '<<tigers#about,About Tigers>>', standalone: false, attributes: attributes
assert_xpath '//a[@href="tigers/#about"][text() = "About Tigers"]', doc.convert, 1
end
test 'xref using angled bracket syntax with path which has been included in this document' do
using_memory_logger do |logger|
in_verbose_mode do
- doc = document_from_string '<<tigers#about,About Tigers>>', header_footer: false
+ doc = document_from_string '<<tigers#about,About Tigers>>', standalone: false
doc.catalog[:includes]['tigers'] = true
output = doc.convert
assert_xpath '//a[@href="#about"][text() = "About Tigers"]', output, 1
@@ -556,7 +556,7 @@ context 'Links' do
test 'xref using angled bracket syntax with nested path which has been included in this document' do
using_memory_logger do |logger|
in_verbose_mode do
- doc = document_from_string '<<part1/tigers#about,About Tigers>>', header_footer: false
+ doc = document_from_string '<<part1/tigers#about,About Tigers>>', standalone: false
doc.catalog[:includes]['part1/tigers'] = true
output = doc.convert
assert_xpath '//a[@href="#about"][text() = "About Tigers"]', output, 1
@@ -839,7 +839,7 @@ context 'Links' do
doc = document_from_string input, safe: :unsafe, base_dir: (File.join fixturedir, 'subdir')
assert_includes doc.catalog[:includes], '../section-a'
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
assert_xpath '//a[@href="#section-a"][text()="Section A"]', output, 1
end
diff --git a/test/lists_test.rb b/test/lists_test.rb
index 32e080b1..4d1379d1 100644
--- a/test/lists_test.rb
+++ b/test/lists_test.rb
@@ -396,7 +396,7 @@ context "Bulleted lists (:ulist)" do
colist = doc.blocks[0].items[0].blocks[-1]
assert_equal :colist, colist.context
refute_equal 'source', colist.style
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
assert_css 'ul', output, 1
assert_css 'ul > li', output, 1
assert_css 'ul > li > p', output, 1
@@ -813,7 +813,7 @@ context "Bulleted lists (:ulist)" do
refs = doc.catalog[:refs]
assert refs.key?('mount-evans')
assert refs.key?('grays-peak')
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
assert_xpath '(//p)[1]/a[@href="#grays-peak"][text()="Grays Peak"]', output, 1
assert_xpath '(//p)[1]/a[@href="#mount-evans"][text()="Mount Evans"]', output, 1
end
@@ -833,7 +833,7 @@ context "Bulleted lists (:ulist)" do
refs = doc.catalog[:refs]
assert refs.key?('step-2')
assert refs.key?('step-4')
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
assert_xpath '(//p)[1]/a[@href="#step-2"][text()="Step 2"]', output, 1
assert_xpath '(//p)[1]/a[@href="#step-4"][text()="Step 4"]', output, 1
end
@@ -2383,7 +2383,7 @@ context "Description lists (:dlist)" do
refs = doc.catalog[:refs]
assert refs.key?('mount-evans')
assert refs.key?('grays-peak')
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
assert_xpath '(//p)[1]/a[@href="#grays-peak"][text()="Grays Peak"]', output, 1
assert_xpath '(//p)[1]/a[@href="#mount-evans"][text()="Mount Evans"]', output, 1
assert_xpath '//dl', output, 1
@@ -3342,14 +3342,14 @@ context "Description lists (:dlist)" do
* [[[Fowler_1997,1]]] Fowler M. _Analysis Patterns: Reusable Object Models_. Addison-Wesley. 1997.
EOS
- doc = document_from_string input, header_footer: false
+ doc = document_from_string input, standalone: false
tmmm_ref = doc.catalog[:refs]['TMMM']
refute_nil tmmm_ref
assert_nil tmmm_ref.reftext
fowler_1997_ref = doc.catalog[:refs]['Fowler_1997']
refute_nil fowler_1997_ref
assert_equal '[1]', fowler_1997_ref.reftext
- result = doc.convert header_footer: false
+ result = doc.convert standalone: false
assert_xpath '//a[@href="#Fowler_1997"]', result, 1
assert_xpath '//a[@href="#Fowler_1997"][text()="[1]"]', result, 1
assert_xpath '//a[@id="Fowler_1997"]', result, 1
@@ -5043,7 +5043,7 @@ context 'Checklists' do
assert checklist.items[1].attr?('checked')
refute checklist.items[4].attr?('checkbox')
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
assert_css '.ulist.checklist', output, 1
assert_xpath %((/*[@class="ulist checklist"]/ul/li)[1]/p[text()="#{decode_char 10063} todo"]), output, 1
assert_xpath %((/*[@class="ulist checklist"]/ul/li)[2]/p[text()="#{decode_char 10003} done"]), output, 1
@@ -5080,7 +5080,7 @@ context 'Checklists' do
assert checklist.option?('checklist')
assert checklist.option?('interactive')
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
assert_css '.ulist.checklist', output, 1
assert_css '.ulist.checklist li input[type="checkbox"]', output, 2
assert_css '.ulist.checklist li input[type="checkbox"][disabled]', output, 0
diff --git a/test/manpage_test.rb b/test/manpage_test.rb
index b08a52e6..29c60235 100644
--- a/test/manpage_test.rb
+++ b/test/manpage_test.rb
@@ -36,7 +36,7 @@ context 'Manpage' do
test 'should output multiple mannames in NAME section' do
input = SAMPLE_MANPAGE_HEADER.sub(/^command - /, 'command, alt_command - ')
- output = Asciidoctor.convert input, backend: :manpage, header_footer: true
+ output = Asciidoctor.convert input, backend: :manpage, standalone: true
assert_includes output.lines, %(command, alt_command \\- does stuff\n)
end
@@ -58,7 +58,7 @@ context 'Manpage' do
EOS
attrs = { 'manname' => 'foobar', 'manpurpose' => 'puts some foo on the bar' }
- doc = Asciidoctor.load input, backend: :manpage, header_footer: true, attributes: attrs
+ doc = Asciidoctor.load input, backend: :manpage, standalone: true, attributes: attrs
assert_equal 'foobar', (doc.attr 'manname')
assert_equal ['foobar'], (doc.attr 'mannames')
assert_equal 'puts some foo on the bar', (doc.attr 'manpurpose')
@@ -90,14 +90,14 @@ context 'Manpage' do
When you need to put some foo on the bar.
EOS
- doc = Asciidoctor.load input, backend: :manpage, header_footer: true
+ doc = Asciidoctor.load input, backend: :manpage, standalone: true
assert_equal 'puts some foo on the bar', (doc.attr 'manpurpose')
end
test 'should parse malformed document with warnings' do
input = 'garbage in'
using_memory_logger do |logger|
- doc = Asciidoctor.load input, backend: :manpage, header_footer: true, attributes: { 'docname' => 'cmd' }
+ doc = Asciidoctor.load input, backend: :manpage, standalone: true, attributes: { 'docname' => 'cmd' }
assert_equal 'cmd', doc.attr('manname')
assert_equal ['cmd'], doc.attr('mannames')
assert_equal '.1', doc.attr('outfilesuffix')
@@ -142,13 +142,13 @@ context 'Manpage' do
test 'should define default linkstyle' do
input = SAMPLE_MANPAGE_HEADER
- output = Asciidoctor.convert input, backend: :manpage, header_footer: true
+ output = Asciidoctor.convert input, backend: :manpage, standalone: true
assert_includes output.lines, %(. LINKSTYLE blue R < >\n)
end
test 'should use linkstyle defined by man-linkstyle attribute' do
input = SAMPLE_MANPAGE_HEADER
- output = Asciidoctor.convert input, backend: :manpage, header_footer: true, attributes: { 'man-linkstyle' => 'cyan B \[fo] \[fc]' }
+ output = Asciidoctor.convert input, backend: :manpage, standalone: true, attributes: { 'man-linkstyle' => 'cyan B \[fo] \[fc]' }
assert_includes output.lines, %(. LINKSTYLE cyan B \\[fo] \\[fc]\n)
end
@@ -157,14 +157,14 @@ context 'Manpage' do
:man-linkstyle: cyan R < >
#{SAMPLE_MANPAGE_HEADER}
EOS
- output = Asciidoctor.convert input, backend: :manpage, header_footer: true
+ output = Asciidoctor.convert input, backend: :manpage, standalone: true
assert_includes output.lines, %(. LINKSTYLE cyan R &lt; &gt;\n)
input = <<~EOS.chop
:man-linkstyle: pass:[cyan R < >]
#{SAMPLE_MANPAGE_HEADER}
EOS
- output = Asciidoctor.convert input, backend: :manpage, header_footer: true
+ output = Asciidoctor.convert input, backend: :manpage, standalone: true
assert_includes output.lines, %(. LINKSTYLE cyan R < >\n)
end
end
@@ -251,7 +251,7 @@ context 'Manpage' do
Describe this thing.
EOS
- output = Asciidoctor.convert input, backend: :manpage, header_footer: true, attributes: {
+ output = Asciidoctor.convert input, backend: :manpage, standalone: true, attributes: {
'manmanual' => %(General\nCommands\nManual),
'mansource' => %(Control\nAll\nThe\nThings\n5.0),
}
@@ -264,7 +264,7 @@ context 'Manpage' do
context 'Backslash' do
test 'should not escape spaces for empty manual or source fields' do
input = SAMPLE_MANPAGE_HEADER.lines.select {|l| !l.start_with?(':man ') }
- output = Asciidoctor.convert input, backend: :manpage, header_footer: true
+ output = Asciidoctor.convert input, backend: :manpage, standalone: true
assert_match ' Manual: \ \&', output
assert_match ' Source: \ \&', output
assert_match(/^\.TH "COMMAND" .* "\\ \\&" "\\ \\&"$/, output)
@@ -736,7 +736,7 @@ context 'Manpage' do
old_source_date_epoch = ENV.delete 'SOURCE_DATE_EPOCH'
begin
ENV['SOURCE_DATE_EPOCH'] = '1234123412'
- output = Asciidoctor.convert SAMPLE_MANPAGE_HEADER, backend: :manpage, header_footer: true
+ output = Asciidoctor.convert SAMPLE_MANPAGE_HEADER, backend: :manpage, standalone: true
assert_match(/Date: 2009-02-08/, output)
assert_match(/^\.TH "COMMAND" "1" "2009-02-08" "Command 1.2.3" "Command Manual"$/, output)
ensure
@@ -752,7 +752,7 @@ context 'Manpage' do
old_source_date_epoch = ENV.delete 'SOURCE_DATE_EPOCH'
begin
ENV['SOURCE_DATE_EPOCH'] = 'aaaaaaaa'
- Asciidoctor.convert SAMPLE_MANPAGE_HEADER, backend: :manpage, header_footer: true
+ Asciidoctor.convert SAMPLE_MANPAGE_HEADER, backend: :manpage, standalone: true
assert false
rescue
assert true
diff --git a/test/options_test.rb b/test/options_test.rb
index 2b6f597e..d0dfd814 100644
--- a/test/options_test.rb
+++ b/test/options_test.rb
@@ -91,7 +91,7 @@ context 'Options' do
options = Asciidoctor::Cli::Options.parse!(%w(-w -v -s -d book test/fixtures/sample.adoc))
assert_equal 2, options[:verbose]
- assert_equal false, options[:header_footer]
+ assert_equal false, options[:standalone]
assert_equal 'book', options[:attributes]['doctype']
assert_equal 1, options[:input_files].size
assert_equal 'test/fixtures/sample.adoc', options[:input_files][0]
diff --git a/test/reader_test.rb b/test/reader_test.rb
index 84760ee2..c30c9fa0 100644
--- a/test/reader_test.rb
+++ b/test/reader_test.rb
@@ -606,7 +606,7 @@ class ReaderTest < Minitest::Test
test 'include directive is enabled when safe mode is less than SECURE' do
input = 'include::fixtures/include-file.adoc[]'
- doc = document_from_string input, safe: :safe, header_footer: false, base_dir: DIRNAME
+ doc = document_from_string input, safe: :safe, standalone: false, base_dir: DIRNAME
output = doc.convert
assert_match(/included content/, output)
assert doc.catalog[:includes]['fixtures/include-file']
@@ -619,7 +619,7 @@ class ReaderTest < Minitest::Test
----
EOS
- doc = document_from_string input, safe: :safe, header_footer: false, base_dir: DIRNAME
+ doc = document_from_string input, safe: :safe, standalone: false, base_dir: DIRNAME
assert doc.catalog[:includes].empty?
end
@@ -629,7 +629,7 @@ class ReaderTest < Minitest::Test
include_file_with_sp = File.join DIRNAME, 'fixtures', 'include file.adoc'
begin
FileUtils.cp include_file, include_file_with_sp
- doc = document_from_string input, safe: :safe, header_footer: false, base_dir: DIRNAME
+ doc = document_from_string input, safe: :safe, standalone: false, base_dir: DIRNAME
output = doc.convert
assert_match(/included content/, output)
ensure
@@ -643,7 +643,7 @@ class ReaderTest < Minitest::Test
include_file_with_sp = File.join DIRNAME, 'fixtures', 'include file.adoc'
begin
FileUtils.cp include_file, include_file_with_sp
- doc = document_from_string input, safe: :safe, header_footer: false, base_dir: DIRNAME
+ doc = document_from_string input, safe: :safe, standalone: false, base_dir: DIRNAME
output = doc.convert
assert_match(/included content/, output)
ensure
diff --git a/test/sections_test.rb b/test/sections_test.rb
index 9bbfe4b7..dfd1907b 100644
--- a/test/sections_test.rb
+++ b/test/sections_test.rb
@@ -1823,7 +1823,7 @@ context 'Sections' do
sect.number += 1
end
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
assert_xpath '//h2[text()="2. Somewhere in the Middle"]', output, 1
assert_xpath '//h2[text()="3. The End"]', output, 1
end
diff --git a/test/substitutions_test.rb b/test/substitutions_test.rb
index d624ad3e..7908198a 100644
--- a/test/substitutions_test.rb
+++ b/test/substitutions_test.rb
@@ -1142,7 +1142,7 @@ context 'Substitutions' do
test 'should escape concealed index term if second bracket is preceded by a backslash' do
input = %[National Institute of Science and Technology (#{BACKSLASH}((NIST)))]
- doc = document_from_string input, header_footer: false
+ doc = document_from_string input, standalone: false
output = doc.convert
assert_xpath '//p[text()="National Institute of Science and Technology (((NIST)))"]', output, 1
assert doc.catalog[:indexterms].empty?
@@ -1150,7 +1150,7 @@ context 'Substitutions' do
test 'should only escape enclosing brackets if concealed index term is preceded by a backslash' do
input = %[National Institute of Science and Technology #{BACKSLASH}(((NIST)))]
- doc = document_from_string input, header_footer: false
+ doc = document_from_string input, standalone: false
output = doc.convert
assert_xpath '//p[text()="National Institute of Science and Technology (NIST)"]', output, 1
term = doc.catalog[:indexterms].first
diff --git a/test/tables_test.rb b/test/tables_test.rb
index a60d8d28..8a993cb4 100644
--- a/test/tables_test.rb
+++ b/test/tables_test.rb
@@ -12,7 +12,7 @@ context 'Tables' do
|=======
EOS
cells = [%w(A B C), %w(a b c), %w(1 2 3)]
- doc = document_from_string input, header_footer: false
+ doc = document_from_string input, standalone: false
table = doc.blocks[0]
assert 100, table.columns.map {|col| col.attributes['colpcwidth'] }.reduce(:+)
output = doc.convert
@@ -338,7 +338,7 @@ context 'Tables' do
assert_equal expected_pcwidths[i], table_row0[i].attributes['colpcwidth']
assert_equal '', table_row0[i].attributes['autowidth-option']
end
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
assert_css 'table', output, 1
assert_css 'table colgroup col', output, 4
assert_css 'table colgroup col[style]', output, 1
@@ -361,7 +361,7 @@ context 'Tables' do
assert_equal 25, table_row0[i].attributes['colpcwidth']
assert_equal '', table_row0[i].attributes['autowidth-option']
end
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
assert_css 'table', output, 1
assert_css 'table[style*="width: 50%;"]', output, 1
assert_css 'table colgroup col', output, 4
@@ -1292,7 +1292,7 @@ context 'Tables' do
assert_equal 6, body_cell_1_3.inner_document.lineno
note = (body_cell_1_3.inner_document.find_by context: :admonition)[0]
assert_equal 9, note.lineno
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
# NOTE JRuby matches the table inside the admonition block if the class is not specified on the table
assert_css 'table.tableblock > tbody > tr', output, 2
@@ -1316,7 +1316,7 @@ context 'Tables' do
assert_equal 2, tbody[0][0].lineno
assert_equal 3, tbody[0][0].inner_document.lineno
assert_equal 4, tbody[1][0].lineno
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
assert_css 'td', output, 2
assert_xpath '(//td)[1]//*[@class="literalblock"]', output, 1
assert_xpath '(//td)[2]//*[@class="paragraph"]', output, 1
@@ -1371,7 +1371,7 @@ context 'Tables' do
refs = doc.catalog[:refs]
assert refs.key?('mount-evans')
assert refs.key?('grays-peak')
- output = doc.convert header_footer: false
+ output = doc.convert standalone: false
assert_xpath '(//p)[1]/a[@href="#grays-peak"][text()="Grays Peak"]', output, 1
assert_xpath '(//p)[1]/a[@href="#mount-evans"][text()="Mount Evans"]', output, 1
assert_xpath '(//table/tbody/tr)[1]//td//a[@id="mount-evans"]', output, 1
@@ -1765,7 +1765,7 @@ context 'Tables' do
nobody:x:99:99:Nobody:/:/sbin/nologin
|===
EOS
- doc = document_from_string input, header_footer: false
+ doc = document_from_string input, standalone: false
table = doc.blocks[0]
assert 100, table.columns.map {|col| col.attributes['colpcwidth'] }.reduce(:+)
output = doc.convert
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 97f15a37..563f756c 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -194,9 +194,7 @@ class Minitest::Test
end
def block_from_string(src, opts = {})
- opts[:header_footer] = false
- doc = document_from_string src, opts
- doc.blocks.first
+ (document_from_string src, (opts.merge standalone: false)).blocks.first
end
def convert_string(src, opts = {})
@@ -212,8 +210,7 @@ class Minitest::Test
end
def convert_string_to_embedded(src, opts = {})
- opts[:header_footer] = false
- document_from_string(src, opts).convert
+ (document_from_string src, (opts.merge standalone: false)).convert
end
def convert_inline_string(src, opts = {})
@@ -227,9 +224,9 @@ class Minitest::Test
end
def assign_default_test_options(opts)
- opts[:header_footer] = true unless opts.key? :header_footer
+ opts[:standalone] = true unless opts.key? :standalone
opts[:parse] = true unless opts.key? :parse
- if opts[:header_footer]
+ if opts[:standalone]
# don't embed stylesheet unless test requests the default behavior
if opts.has_key? :linkcss_default
opts.delete(:linkcss_default)
diff --git a/test/text_test.rb b/test/text_test.rb
index 882d6a51..0318d281 100644
--- a/test/text_test.rb
+++ b/test/text_test.rb
@@ -9,7 +9,7 @@ context "Text" do
end
test "proper encoding to handle utf8 characters in embedded document using html backend" do
- output = example_document(:encoding, header_footer: false).convert
+ output = example_document(:encoding, standalone: false).convert
assert_xpath '//p', output, 4
assert_xpath '//a', output, 1
end
@@ -21,7 +21,7 @@ context "Text" do
end
test 'proper encoding to handle utf8 characters in embedded document using docbook backend' do
- output = example_document(:encoding, header_footer: false, attributes: { 'backend' => 'docbook' }).convert
+ output = example_document(:encoding, standalone: false, attributes: { 'backend' => 'docbook' }).convert
assert_xpath '//simpara', output, 4
assert_xpath '//link', output, 1
end