From 805ddbcadbd77369db4308346c8c3030020cc525 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 25 May 2017 17:42:36 +0100 Subject: [PATCH] Add wordcount --- md_pdf/build/context.py | 2 ++ setup.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/md_pdf/build/context.py b/md_pdf/build/context.py index 84102d2..0d14468 100644 --- a/md_pdf/build/context.py +++ b/md_pdf/build/context.py @@ -1,4 +1,5 @@ from md_pdf.consts import TEMPLATES_DIR, STATIC_DIR +from word_count import word_count EXTRA_CONTEXT = { @@ -11,4 +12,5 @@ def get_context(config, content): context = config['context'].copy() context['title'] = config['title'] context = dict(context, **EXTRA_CONTEXT) + context['word_count'] = word_count(content) return context diff --git a/setup.py b/setup.py index a099a3a..6094970 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,8 @@ setup( "progressbar2==3.16.0", "pypandoc==1.3.3", "pyscss==1.3.5", - "PyYAML==3.12" + "PyYAML==3.12", + "word-count==0.1.0" ], setup_requires=['setuptools_scm'], packages=find_packages(),