Spiderjjr45 (talk | contribs) No edit summary Tag: Reverted |
Spiderjjr45 (talk | contribs) (Undo revision 27568 by Spiderjjr45 (talk)) Tag: Undo |
||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
Line 10: | Line 9: | ||
return "Article content not available" | return "Article content not available" | ||
end | end | ||
-- Count the words | -- Count the words |
Revision as of 18:33, 24 January 2024
Documentation for this module may be created at Module:Wordcount/doc
local p = {} function p.count(frame) -- Get the content of the current article local content = mw.title.getCurrentTitle():getContent() -- Check if content is not nil if content == nil then return "Article content not available" end -- Count the words local _, wordCount = string.gsub(content, "%S+", "") -- Return the word count return tostring(wordCount) .. " words" end return p