diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2022-06-13 00:51:56 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2022-06-13 00:57:13 -0600 |
| commit | fb3f1790c786c2cbb6dc61cd5c43f91ecb147fc9 (patch) | |
| tree | f3e40b71c2ceca11f38c039a4f830bbf4304a15c /docs/modules | |
| parent | d2c89495437c28f4bb18fabd343075cc4d1a7155 (diff) | |
emphasize that the table role extended converter can be used for other block types
Diffstat (limited to 'docs/modules')
| -rw-r--r-- | docs/modules/extend/examples/pdf-converter-table-role.rb | 1 | ||||
| -rw-r--r-- | docs/modules/extend/pages/use-cases.adoc | 15 |
2 files changed, 10 insertions, 6 deletions
diff --git a/docs/modules/extend/examples/pdf-converter-table-role.rb b/docs/modules/extend/examples/pdf-converter-table-role.rb index 5599e63d..5dd811c1 100644 --- a/docs/modules/extend/examples/pdf-converter-table-role.rb +++ b/docs/modules/extend/examples/pdf-converter-table-role.rb @@ -8,7 +8,6 @@ class PDFConverterTableRole < (Asciidoctor::Converter.for 'pdf') save_theme do role_entries.each do |name, val| theme[%(table_#{name.to_s.delete_prefix key_prefix})] = val - theme.delete_field name end super end diff --git a/docs/modules/extend/pages/use-cases.adoc b/docs/modules/extend/pages/use-cases.adoc index c674e88a..639d7dfa 100644 --- a/docs/modules/extend/pages/use-cases.adoc +++ b/docs/modules/extend/pages/use-cases.adoc @@ -295,18 +295,18 @@ image: float-gap: [12, 6] ---- -== Theme table using custom role +== Theme table using roles The converter only supports custom roles on paragraphs and phrases. -You can use an extended converter to add support for a custom role on other blocks, such as tables. +You can use an extended converter to add this capability to tables. -.Extended converter that supports a role on a table +.Extended converter that supports a custom role on a table [,ruby] ---- include::example$pdf-converter-table-role.rb[] ---- -This converter allows you to specify any theme key that is supported by tables for a table with the specified role. +This extended converter allows you to specify any theme key on the custom role that's supported for tables. The role must be defined under a special role name `<table>` (to avoid clashing with other role names). Here's an example of a custom table role named `thick` that increases the width of the table border and grid lines. @@ -320,7 +320,12 @@ role: grid-width: 2 ---- -You can apply this role to a table by adding `.thick` to the first positional attribute in the block attribute line above the table. +You apply this role to a table by prepending `.thick` to the first positional attribute in the block attribute line above the table. + +As written, the extended converter only supports the first role on the table. +It could be enhanced to support an arbitrary number of roles, with each successive role cascading (like CSS). + +TIP: You can use the technique shown in this extended converter to add role-based theming to any other block type recognized by the theme (e.g., code, sidebar, etc). == Theme admonition per type |
