[dismiss]
The wiki is currently a work in progress. If you'd like to help out, please check the Community Portal and our getting started guide. Also, check out our sister project on poewiki.net.
Module:Sandbox/Skkias/TestDictionary: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
function p.getEntry(frame) | function p.getEntry(frame) | ||
local term = frame.args.term or "Unknown" | local term = frame.args.term or "Unknown" | ||
local category = frame.args.category or "Town" | local category = frame.args.category or "Town" | ||
if | local pageTitle = "Dictionary:" .. term | ||
return | |||
-- Attempt to fetch the page content | |||
local page = mw.title.new(pageTitle) | |||
if page and page.exists then | |||
return mw.content.getCurrentContent(pageTitle) | |||
else | else | ||
return "Entry not found." | return "Entry not found." |
Revision as of 16:07, 11 December 2024
You might want to create a documentation page for this module.
Editors can experiment in this module's sandbox and testcases pages.
Please add categories to the /doc subpage. Subpages of this module.
Editors can experiment in this module's sandbox and testcases pages.
Please add categories to the /doc subpage. Subpages of this module.
local p = {}
function p.getEntry(frame)
local term = frame.args.term or "Unknown"
local category = frame.args.category or "Town"
local pageTitle = "Dictionary:" .. term
-- Attempt to fetch the page content
local page = mw.title.new(pageTitle)
if page and page.exists then
return mw.content.getCurrentContent(pageTitle)
else
return "Entry not found."
end
end
return p