aboutsummaryrefslogtreecommitdiff
path: root/mammoth/conversion.py
diff options
context:
space:
mode:
Diffstat (limited to 'mammoth/conversion.py')
-rw-r--r--mammoth/conversion.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/mammoth/conversion.py b/mammoth/conversion.py
index b449dd6..b40b0e2 100644
--- a/mammoth/conversion.py
+++ b/mammoth/conversion.py
@@ -214,14 +214,13 @@ class _DocumentConverter(documents.ElementVisitor):
comment = self._comments[reference.comment_id]
self._comment_count_by_initials[comment.author_initials] += 1
count = self._comment_count_by_initials[comment.author_initials]
- label = "{0} {1}".format(comment.author_initials, count)
+ label = "{0} {1}".format(_comment_author_label(comment), count)
self._referenced_comments.append((label, comment))
return [
# TODO: remove duplication with note references
html.element("a", {
"href": "#" + self._referent_html_id("comment", reference.comment_id),
"id": self._reference_html_id("comment", reference.comment_id),
- # TODO: handle comments without initials
}, [html.text("[{0}]".format(label))])
]
@@ -315,4 +314,9 @@ def _document_matcher_matches(matcher, element, element_type):
)
)
+
+def _comment_author_label(comment):
+ return comment.author_initials or "Comment"
+
+
_up_arrow = "↑"