More efficient wordcount.lua example.
This commit is contained in:
parent
a89d4aa924
commit
e5e8350fcb
1 changed files with 1 additions and 2 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue