« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateCommentaryIndexPage.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/generateCommentaryIndexPage.js')
-rw-r--r--src/content/dependencies/generateCommentaryIndexPage.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/content/dependencies/generateCommentaryIndexPage.js b/src/content/dependencies/generateCommentaryIndexPage.js
index 2dabffac..8cc30913 100644
--- a/src/content/dependencies/generateCommentaryIndexPage.js
+++ b/src/content/dependencies/generateCommentaryIndexPage.js
@@ -1,3 +1,5 @@
+import multilingualWordCount from 'word-count';
+
 import {sortChronologically} from '#sort';
 import {accumulateSum, filterMultipleArrays, stitchArrays} from '#sugar';
 
@@ -48,11 +50,14 @@ export default {
     totalEntryCount: accumulateSum(query.entryCounts),
   }),
 
-  generate(data, relations, {html, defaultLanguage, language}) {
+  generate(data, relations, {html, language}) {
     const wordCounts =
       relations.albumBodies.map(bodies =>
         accumulateSum(bodies, body =>
-          defaultLanguage.countWords(body.slot('mode', 'multiline'))));
+          multilingualWordCount(
+            html.resolve(
+              body.slot('mode', 'multiline'),
+              {normalize: 'plain'}))));
 
     const totalWordCount =
       accumulateSum(wordCounts);