summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2022-06-08 02:22:19 -0600
committerGitHub <noreply@github.com>2022-06-08 02:22:19 -0600
commit618c5880fa0386e2fdabd3f10ea48ef2db03c311 (patch)
tree2c41a26e8e61950a7a792559cf5b21df7147e7b7
parent8265abc461a8576faad9413cc8395f40c833e34c (diff)
resolves #4297 propagate :to_dir option to document of AsciiDoc table cell (PR #4298)
-rw-r--r--CHANGELOG.adoc1
-rw-r--r--lib/asciidoctor/document.rb1
-rw-r--r--test/tables_test.rb13
3 files changed, 15 insertions, 0 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc
index 757102a7..fa846fbf 100644
--- a/CHANGELOG.adoc
+++ b/CHANGELOG.adoc
@@ -51,6 +51,7 @@ Improvements::
* Target `<object>` element with image more accurately in default stylesheet
* Remove form styles from the default stylesheet (#4186)
* Set linenums option on source block when line numbering is enabled (#3313)
+ * Propagate `:to_dir` option to document of AsciiDoc table cell (#4297)
Bug Fixes::
diff --git a/lib/asciidoctor/document.rb b/lib/asciidoctor/document.rb
index bc6920f0..af5fb51d 100644
--- a/lib/asciidoctor/document.rb
+++ b/lib/asciidoctor/document.rb
@@ -259,6 +259,7 @@ class Document < AbstractBlock
@parent_document = parent_doc
options[:base_dir] ||= parent_doc.base_dir
options[:catalog_assets] = true if parent_doc.options[:catalog_assets]
+ options[:to_dir] = parent_doc.options[:to_dir] if parent_doc.options[:to_dir]
@catalog = parent_doc.catalog.merge footnotes: []
# QUESTION should we support setting attribute in parent document from nested document?
@attribute_overrides = attr_overrides = (parent_doc.instance_variable_get :@attribute_overrides).merge parent_doc.attributes
diff --git a/test/tables_test.rb b/test/tables_test.rb
index 0e033607..1132d335 100644
--- a/test/tables_test.rb
+++ b/test/tables_test.rb
@@ -1905,6 +1905,19 @@ context 'Tables' do
assert_css 'table > tbody > tr > td:nth-child(2) table > tbody > tr > td', output, 1
end
+ test 'AsciiDoc table cell should inherit to_dir option from parent document' do
+ doc = document_from_string <<~'EOS', parse: true, to_dir: testdir
+ |===
+ a|
+ AsciiDoc table cell
+ |===
+ EOS
+
+ nested_doc = (doc.blocks[0].find_by context: :document, traverse_documents: true)[0]
+ assert nested_doc.nested?
+ assert_equal doc.options[:to_dir], nested_doc.options[:to_dir]
+ end
+
test 'AsciiDoc table cell should not inherit toc setting from parent document' do
input = <<~'EOS'
= Document Title