aboutsummaryrefslogtreecommitdiff
path: root/mammoth/conversion.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-07-07 22:33:46 +0100
committerMichael Williamson <mike@zwobble.org>2016-07-07 22:33:46 +0100
commit99d1e7324fb2df19fdd011734191359e49c0fa43 (patch)
treee6d7c5b95478241bda59f63a6933fd600ef4343e /mammoth/conversion.py
parent193a63febc5595c80b66c444138ef9414cb41a72 (diff)
Use overall comment count for comment numbering
This matches the behaviour in Word more closely.
Diffstat (limited to 'mammoth/conversion.py')
-rw-r--r--mammoth/conversion.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/mammoth/conversion.py b/mammoth/conversion.py
index d58fe6a..85d8ec5 100644
--- a/mammoth/conversion.py
+++ b/mammoth/conversion.py
@@ -2,7 +2,6 @@
from __future__ import unicode_literals
-import collections
from functools import partial
import base64
@@ -68,7 +67,6 @@ class _DocumentConverter(documents.ElementVisitor):
self._ignore_empty_paragraphs = ignore_empty_paragraphs
self._note_references = note_references
self._referenced_comments = []
- self._comment_count_by_initials = collections.defaultdict(lambda: 0)
self._convert_image = convert_image
self._comments = comments
@@ -212,8 +210,7 @@ class _DocumentConverter(documents.ElementVisitor):
def visit_comment_reference(self, reference):
def nodes():
comment = self._comments[reference.comment_id]
- self._comment_count_by_initials[comment.author_initials] += 1
- count = self._comment_count_by_initials[comment.author_initials]
+ count = len(self._referenced_comments) + 1
label = "[{0}{1}]".format(_comment_author_label(comment), count)
self._referenced_comments.append((label, comment))
return [