Module:Get short description
Appearance
Implements {{get short description}}.
local p = {}
function p.main(frame)
local title = frame.args.page
local nomatch = frame.args.nomatch or ""
page = mw.title.new(title)
if not page then
--bad title
return showerror('<strong class="error">No page given</strong>')
end
local content = page:getContent()
if not content then
--page does not exist
return showerror('<strong class="error">'..title..' does not exist</strong>')
end
content = frame:preprocess(content) -- expand content
return mw.ustring.match(content, '<div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">([^<]+)') or nomatch
end
return p