Module:Numlinks: Difference between revisions
m todo |
ArrowHead294 (talk | contribs) m Wikitext debugger option |
||
| (5 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
-- | -- This module follows [[User:Ganaram inukshuk/Provisional style guide for Lua]] | ||
local getArgs = require("Module:Arguments").getArgs | local getArgs = require("Module:Arguments").getArgs | ||
local ordinal = require("Module:Ordinal" )._ordinal | local ordinal = require("Module:Ordinal" )._ordinal | ||
| Line 80: | Line 80: | ||
-- arrow before the first link. | -- arrow before the first link. | ||
local prev_links = {} | local prev_links = {} | ||
if curr_num - num_links > | if curr_num - num_links > min_num then | ||
table.insert(prev_links, "←") | table.insert(prev_links, "←") | ||
end | end | ||
| Line 135: | Line 135: | ||
end | end | ||
end | end | ||
-- Main function | -- Main function | ||
function p.numlinks(frame) | function p.numlinks(frame) | ||
local args = getArgs(frame) | local args = getArgs(frame) | ||
local wtext = yesno(frame.args["wtext"] or args["wtext"]) | |||
-- Preprocess numeric input | -- Preprocess numeric input | ||
| Line 178: | Line 152: | ||
-- Create numbered navigation links | -- Create numbered navigation links | ||
local result = p._numlinks(args) | local result = p._numlinks(args) | ||
-- Debugger option to show Wikitext | |||
if wtext then | |||
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" | |||
end | |||
return result | return frame:preprocess(result) | ||
end | end | ||