More efficient wordcount.lua example.

This commit is contained in:
John MacFarlane 2017-11-12 21:55:10 -08:00
parent a89d4aa924
commit e5e8350fcb

View file

@ -408,8 +408,7 @@ words = 0
wordcount = {
Str = function(el)
-- we don't count a word if it's entirely punctuation:
local s = el.text:gsub("%p","")
if #s > 0 then
if el.text:match("%P") then
words = words + 1
end
end,