aboutsummaryrefslogtreecommitdiff
path: root/mammoth/conversion.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2024-11-30 12:07:59 +0000
committerMichael Williamson <mike@zwobble.org>2024-11-30 12:07:59 +0000
commitfe7708b65b7d479e795f379e11ab486d2d08af4e (patch)
treedda96099b6e37c8a6c203ec1c34f29031ca79a20 /mammoth/conversion.py
parentdc7a67c1010f0632fe532ae700cf5606d4aab230 (diff)
Convert checkbox document elements to HTML checkboxes
Diffstat (limited to 'mammoth/conversion.py')
-rw-r--r--mammoth/conversion.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/mammoth/conversion.py b/mammoth/conversion.py
index 33f61cc..f320471 100644
--- a/mammoth/conversion.py
+++ b/mammoth/conversion.py
@@ -165,6 +165,15 @@ class _DocumentConverter(documents.element_visitor(args=1)):
return [html.collapsible_element("a", attributes, nodes)]
+ def visit_checkbox(self, checkbox, context):
+ attributes = {"type": "checkbox"}
+
+ if checkbox.checked:
+ attributes["checked"] = "checked"
+
+ return [html.element("input", attributes)]
+
+
def visit_bookmark(self, bookmark, context):
element = html.collapsible_element(
"a",