Module:Cite Q/sandbox: Difference between revisions

Content deleted Content added
maxvals for getPropOfProp
+debug rendering;
Line 209:
function citeq.cite_q (frame)
local citeq_args = {};
local _debug=false; -- when set to anything, causes cite q to render <code><nowiki>{{citation|...}}</nowiki></code>
 
for k, v in pairs(frame:getParent().args) do
if '_debug' == k then
citeq_args[k] = v
_debug = true; -- set a flag but don't pass |_debug= to {{citation}}
else
citeq_args[k] = v
end
end
 
Line 337 ⟶ 342:
if editor_count > 8 then -- convention in astronomy journals
citeq_args['display-editors'] = citeq_args['display-editors'] or 3
end
 
if _debug then -- if |_debug=<anything>, write a nowiki'd version to see what the {{citation}} template looks like
local debug_args = {'{{citation'}; -- init with citation template
for p, v in pairs (citeq_args) do -- spin through citeq_args and
table.insert (debug_args, p..'='..v); -- add parameter name = value
end
-- make the nowiki'd string and done
return table.concat ({'<code>', frame:callParserFunction ('#tag:nowiki', table.concat (debug_args, ' |') .. '}}'), '</code>'})
end