Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
63792fe
commit 6cc040f
Showing
4 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
calc_word_count: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
layout: none | ||
--- | ||
|
||
{% if site.calc_word_count %} | ||
{% assign chapters = site.en | sort: "idx" %} | ||
{% for chapter in chapters %} | ||
{% unless chapter.homepage %} | ||
{{ chapter.content }} | ||
{% endunless %} | ||
{% endfor %} | ||
{% else %} | ||
Cat disabled. | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/node | ||
|
||
var wordCount = require('html-word-count'); | ||
var fs = require("fs"); | ||
var jsdom = require("jsdom"); | ||
|
||
var text = fs.readFileSync("_site/cat.html"); | ||
|
||
const { JSDOM } = jsdom; | ||
const { window } = new JSDOM(text); | ||
const { document } = (window).window; | ||
global.document = document; | ||
var $ = require('jquery')(window); | ||
|
||
$("pre").remove(); | ||
|
||
console.log(wordCount(document.documentElement.innerHTML)); // 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
jekyll build --config _config.yml,_conf_wc.yml | ||
./utils/_count_words.js |