diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-11-12 21:55:10 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-11-12 21:55:10 -0800 |
commit | e5e8350fcb3ea321efc28aaf88413677b3c97613 (patch) | |
tree | 63356f5e01dc5c6881146669c899bfec8fd7c68c /doc | |
parent | a89d4aa924e0515bf8860aaf30a7a50cf5a08e0c (diff) | |
download | pandoc-e5e8350fcb3ea321efc28aaf88413677b3c97613.tar.gz |
More efficient wordcount.lua example.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/lua-filters.md | 3 |
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, |