Skip to content

Commit

Permalink
Use new number_of_words plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
iBug committed May 22, 2020
1 parent 5d3a2d7 commit b3e0b34
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions _plugins/number_of_words.rb
@@ -1,8 +1,13 @@
CJK_REGEX = /\p{Han}|\p{Katakana}|\p{Hiragana}|\p{Hangul}/
CJK_CLASS = %!\p{Han}\p{Katakana}\p{Hiragana}\p{Hangul}!
CJK_REGEX = %r![#{CJK_CLASS}]!o
WORD_REGEX = %r![#{CJK_CLASS}\s]!o

module Jekyll
module Filters
def number_of_words input
input.scan(CJK_REGEX).length + input.gsub(CJK_REGEX, ' ').split.length
cjk_count = input.scan(CJK_REGEX).length
return input.split.length if cjk_count.zero?
cjk_count + input.scan(WORD_REGEX).length
end
end
end
2 changes: 1 addition & 1 deletion script/deploy-actions.sh
Expand Up @@ -18,7 +18,7 @@ e_info "Adding commit info"
git config user.name "${GIT_USER:-GitHub}"
git config user.email "${GIT_EMAIL:-noreply@github.com}"
git add --all
git commit --message "${COMMIT_MSG}" --message "$source_msg" &>/dev/null
git commit --quiet --message "${COMMIT_MSG}" --message "$source_msg"

e_info "Pushing to GitHub"
SSH_AUTH_SOCK=none \
Expand Down

0 comments on commit b3e0b34

Please sign in to comment.