summaryrefslogtreecommitdiff
path: root/docs/modules/extend/examples/breakable-tables-tree-processor.rb
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2023-06-27 23:54:51 -0600
committerDan Allen <dan.j.allen@gmail.com>2023-06-28 03:25:23 -0600
commit5ae2ea41688b03e84df4581d9fd1ab6b6c1026ef (patch)
treee128da5925e958cb84a758bdcc8225dbf94b614a /docs/modules/extend/examples/breakable-tables-tree-processor.rb
parent9c12ed5f067a337b22ed1e2131697f0122e6cae8 (diff)
document how to add breakable option to all tables at runtime using Asciidoctor extension
Diffstat (limited to 'docs/modules/extend/examples/breakable-tables-tree-processor.rb')
-rw-r--r--docs/modules/extend/examples/breakable-tables-tree-processor.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/modules/extend/examples/breakable-tables-tree-processor.rb b/docs/modules/extend/examples/breakable-tables-tree-processor.rb
new file mode 100644
index 00000000..5311aab1
--- /dev/null
+++ b/docs/modules/extend/examples/breakable-tables-tree-processor.rb
@@ -0,0 +1,12 @@
+Asciidoctor::Extensions.register do
+ tree_processor do
+ process do |doc|
+ doc.find_by context: :table do |table|
+ unless (table.option? 'breakable') || (table.option? 'unbreakable')
+ table.set_option 'breakable'
+ end
+ end
+ doc
+ end
+ end
+end