Documentation for this module may be created at Module:Sandbox/trappist the monk/what line/doc
require('strict');
local getArgs = require ('Module:Arguments').getArgs;
local function main (frame)
local args = getArgs (frame);
local Article_content = mw.title.getCurrentTitle():getContent() or ''; -- get the content of the article or ''; new pages edited w/ve do not have 'content' until saved; ve does not preview; phab:T221625
local line_count = 0;
local target;
target = '{{tlx|line marker' .. (args[1] and '|' .. args[1] or '') ..'}}'
for line in Article_content:gmatch ('[^\n\r]*[\n\r]') do
line_count = line_count + 1;
if line:find (target, 1, true) then
return 'Found at line: ' .. line_count;
end
end
end
return {main = main}