Add wordcount to footer

This commit is contained in:
Jake Howard 2017-05-25 20:07:38 +01:00
parent 805ddbcadb
commit 243ccc4641
4 changed files with 15 additions and 2 deletions

View file

@ -55,6 +55,7 @@ body.footer, body.header {
td {
text-align: center;
width: 33%;
}
}
}

View file

@ -6,9 +6,13 @@
<body class="footer">
<table>
<tr>
<td></td>
<td>
Page <span class="page"></span> of <span class="topage"></span>
</td>
<td>
Total Words: {{ word_count }}
</td>
</tr>
</table>
<script type="text/javascript" src="../static/context.js"></script>

View file

@ -4,6 +4,13 @@
<link rel="stylesheet" href="../static/style.css" />
</head>
<body class="header">
<table>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
<script type="text/javascript" src="../static/context.js"></script>
</body>
</html>

View file

@ -11,6 +11,7 @@ EXTRA_CONTEXT = {
def get_context(config, content):
context = config['context'].copy()
context['title'] = config['title']
context = dict(context, **EXTRA_CONTEXT)
context['word_count'] = word_count(content)
context = dict(context, **EXTRA_CONTEXT, **{
'word_count': word_count(content)
})
return context