summaryrefslogtreecommitdiff
path: root/docs/modules/extend/examples
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2022-05-17 04:51:35 -0600
committerGitHub <noreply@github.com>2022-05-17 04:51:35 -0600
commit2c6f8f231c6b4933e41278f561137e2021cbafee (patch)
tree154173208869b4fb7f46fab38cc8b11188412c2f /docs/modules/extend/examples
parenta0eb966cb37ddcd816f6abea6dc591132ba2a733 (diff)
resolves #1597 add example of extended converter that adds change bars to paragraphs (PR #2186)
Diffstat (limited to 'docs/modules/extend/examples')
-rw-r--r--docs/modules/extend/examples/pdf-converter-change-bars.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/modules/extend/examples/pdf-converter-change-bars.rb b/docs/modules/extend/examples/pdf-converter-change-bars.rb
new file mode 100644
index 00000000..887a395d
--- /dev/null
+++ b/docs/modules/extend/examples/pdf-converter-change-bars.rb
@@ -0,0 +1,15 @@
+class PDFConverterChangeBars < (Asciidoctor::Converter.for 'pdf')
+ register_for 'pdf'
+
+ def convert_paragraph node
+ start_cursor = cursor
+ super
+ if node.role? 'changed'
+ float do
+ bounding_box [bounds.left - 4, start_cursor], width: 2, height: (start_cursor - cursor) do
+ fill_bounds 'FF0000'
+ end
+ end
+ end
+ end
+end