-
Notifications
You must be signed in to change notification settings - Fork 0
/
book-statistics-chart.incl
67 lines (56 loc) · 2.87 KB
/
book-statistics-chart.incl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{% capture chapters %}{% include_relative manuscript/Book.txt %}{% endcapture %}
{% assign chapters = chapters | newline_to_br | split: "<br />" %}
{% assign chapterPaths = "" %}
{% for chapter in chapters %}
{% assign file = chapter | strip %}
{% if file != "" and file != nil %}
{% assign chapterPath = page.dir | append: "manuscript/" | append: file | relative_url %}
{% assign chapterPaths = chapterPaths | append: chapterPath %}
{% endif %}
{% endfor %}
{% assign wordCount = 0 %}
<p><table cellpadding="0" cellspacing="5" border="0" style="margin-left:25px;">
<tr style="font-weight:bolder; font-size:1.2em; text-align:center;">
<td style="text-align:left;">Title</td>
<td> </td>
<td>Counts</td>
<td>Status</td>
<td>Reviewed On</td>
</tr>
{% for page in site.pages %}
{% if chapterPaths contains page.path %}
{% assign twoWeekReview = false %}
{% assign threeDayReview = false %}
{% assign nowSeconds = site.time | date: '%s' | plus: 0 %}
{% assign twoWeeks = page.lastReviewedOn | date: '%s' | plus: 1209600 | minus: nowSeconds %}
{% assign threeDays = page.lastReviewedOn | date: '%s' | plus: 259200 | minus: nowSeconds %}
{% if twoWeeks > 0 %}{% assign twoWeekReview = true %}{% endif %}
{% if threeDays > 0 %}{% assign threeDayReview = true %}{% endif %}
{% assign newCount = page.content | number_of_words %}
{% assign wordCount = wordCount | plus: newCount %}
{% assign pageFullTitle = "<b>" | append: page.title | append: "</b>" %}
{% if page.tagline != "" and page.tagline != nil %}
{% assign pageFullTitle = pageFullTitle | append: ": " | append: page.tagline %}
{% endif %}
<tr>
<td><a href="{{ site.baseurl }}/{{ page.path | replace: '.md', '.html' }}">{{ pageFullTitle }} </a></td>
<td> </td>
<td style="text-align:right;"> {{ newCount }} words </td>
<td class="status">
<i title="stub - no content" class="fa fa-thumb-tack {% if page.status == 'stub' %}status-active{% endif %}"></i>
<i title="placeholder - limited content" class="fa fa-file-o {% if page.status == 'placeholder' %}status-active{% endif %}"></i>
<i title="draft - almost there" class="fa fa-file-text-o {% if page.status == 'draft' %}status-active{% endif %}"></i>
<i title="edit - ready for edit" class="fa fa-pencil {% if page.status == 'edit' %}status-active{% endif %}"></i>
<i title="done - ready for print" class="fa fa-check {% if page.status == 'done' %}status-active{% endif %}"></i> </td>
<td style="text-align:right; {% if twoWeekReview != true %}color:#bbb;{% endif %} {% if threeDayReview == true %}font-weight:bold;{% endif %}"> {{ page.lastReviewedOn | date: '%B %d, %Y' }}</td>
</tr>
{% endif %}
{% endfor %}
<tr>
<td style="text-align:right;"><b>Total: </b> </td>
<td> </td>
<td style="text-align:right;"> {{ wordCount }} words </td>
<td> </td>
<td> </td>
</tr>
</table></p>