Module:Get short description
Appearance
From Wikipedia, the free encyclopedia
Not to be confused with Module:GetShortDescription.
Implements {{get short description }}.
The above documentation is transcluded from Module:Get short description/doc. (edit | history)
Editors can experiment in this module's sandbox (edit | diff) and testcases (create) pages.
Subpages of this module.
Editors can experiment in this module's sandbox (edit | diff) and testcases (create) pages.
Subpages of this module.
localp={} localfunctiongetContent(title) localsuccess,titleObj=pcall(mw.title.new,title) ifnotsuccessthenreturnnilend returntitleObj:getContent() end functionp.main(frame,title) localtitle=frame.args[1] localwikitext=getContent(title) ifwikitext==nilthenreturn""end wikitext=frame:preprocess(wikitext) localstartIndex,endIndex=string.find(wikitext,"<div class=\"shortdescription nomobile noexcerpt noprint searchaux\" style=\"display:none\">") ifstartIndex==nilthen returnnil end localdescriptionStart=endIndex+1 localdescriptionEnd=string.find(wikitext,"</div>",descriptionStart) ifdescriptionEnd==nilthen returnnil end returnstring.sub(wikitext,descriptionStart,descriptionEnd-1) end returnp