summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-11-12 21:55:10 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2017-11-12 21:55:10 -0800
commite5e8350fcb3ea321efc28aaf88413677b3c97613 (patch)
tree63356f5e01dc5c6881146669c899bfec8fd7c68c /doc
parenta89d4aa924e0515bf8860aaf30a7a50cf5a08e0c (diff)
More efficient wordcount.lua example.
Diffstat (limited to 'doc')
-rw-r--r--doc/lua-filters.md3
1 files changed, 1 insertions, 2 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md
index cee4240c7..a5c9905ab 100644
--- a/doc/lua-filters.md
+++ b/doc/lua-filters.md
@@ -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,