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 { td {
text-align: center; text-align: center;
width: 33%;
} }
} }
} }

View file

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

View file

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

View file

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