Module:Get short description

local p = {}

local function getContent(title) local success, titleObj = pcall(mw.title.new, title) if not success then return nil end return titleObj:getContent end

function p.main(frame, title) local title = frame.args[1] local wikitext = getContent(title) if wikitext == nil then return "" end wikitext = frame:preprocess(wikitext) local startIndex, endIndex = string.find(wikitext, "") if startIndex == nil then return nil end local descriptionStart = endIndex + 1 local descriptionEnd = string.find(wikitext, " ", descriptionStart) if descriptionEnd == nil then return nil end return string.sub(wikitext, descriptionStart, descriptionEnd - 1) end

return p