summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-07-07 22:27:20 +0100
committerMichael Williamson <mike@zwobble.org>2016-07-07 22:27:20 +0100
commit30d04c156a26f40cb7f4cf72d66c3f29bb87ff60 (patch)
tree24162bb36f52851865ba332e454339e00ab7be4f
parenta080fc59a3fca08bdc6e23a2eeae440f5c7047b3 (diff)
Use overall comment count for comment numbering
This matches the behaviour in Word more closely.
-rw-r--r--lib/document-to-html.js6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/document-to-html.js b/lib/document-to-html.js
index 1b3a3df..eb7c8e1 100644
--- a/lib/document-to-html.js
+++ b/lib/document-to-html.js
@@ -30,7 +30,6 @@ function DocumentConversion(options, comments) {
var noteReferences = [];
var referencedComments = [];
- var commentCountByInitials = {};
options = _.extend({ignoreEmptyParagraphs: true}, options);
var idPrefix = options.idPrefix === undefined ? "" : options.idPrefix;
@@ -247,10 +246,7 @@ function DocumentConversion(options, comments) {
function convertCommentReference(reference, messages) {
return findHtmlPath(reference, htmlPaths.ignore).wrap(function() {
var comment = comments[reference.commentId];
- if (commentCountByInitials[comment.authorInitials] === undefined) {
- commentCountByInitials[comment.authorInitials] = 0;
- }
- var count = ++commentCountByInitials[comment.authorInitials];
+ var count = referencedComments.length + 1;
var label = "[" + comment.authorInitials + count + "]";
referencedComments.push({label: label, comment: comment});
// TODO: remove duplication with note references