Module:CRTModel: Difference between revisions

No edit summary
No edit summary
Line 213: Line 213:
' [[Category:Documents]]\n' ..
' [[Category:Documents]]\n' ..
' [[Has related CRT model::' .. fullPageName .. ']]\n' ..
' [[Has related CRT model::' .. fullPageName .. ']]\n' ..
' |?Has document type\n' ..
' |?Has document URL\n' ..
' |format=count\n' ..
' |format=count\n' ..
'}}'
'}}'
Line 235: Line 233:
-- Parse document page names from the result
-- Parse document page names from the result
-- The result format is typically "PageName1, PageName2, ..." or line-separated
for docPage in docPagesResult:gmatch('[^\n,]+') do
for docPage in docPagesResult:gmatch('[^\n,]+') do
docPage = trim(docPage)
docPage = trim(docPage)
Line 248: Line 245:
if docUrl and docUrl ~= '' then
if docUrl and docUrl ~= '' then
local linkText = docType or 'Document'
local linkText = docType or 'Document'
docListHtml = docListHtml .. '<li>[' .. docUrl .. ' ' .. linkText .. ']</li>'
-- Use HTML anchor tag instead of wikitext syntax
docListHtml = docListHtml .. '<li><a href="' .. mw.text.encode(docUrl) .. '" class="external">' .. mw.text.encode(linkText) .. '</a></li>'
end
end
end
end
Line 255: Line 253:
docListHtml = docListHtml .. '</ul>'
docListHtml = docListHtml .. '</ul>'
-- Add the documents list and upload link
-- Add the documents list and upload link (also as HTML anchor)
local combinedHtml = docListHtml .. '<div style="margin-top:0.5em; font-style:italic;">[' .. tostring(uploadUrl) .. ' Upload a document]</div>'
local combinedHtml = docListHtml .. '<div style="margin-top:0.5em; font-style:italic;"><a href="' .. tostring(uploadUrl) .. '" class="external">Upload a document</a></div>'
addFullRow(tbl, combinedHtml, 'padding:0.2em 0.4em;', false)
addFullRow(tbl, combinedHtml, 'padding:0.2em 0.4em;', true)
else
else
-- Just show the upload link
-- Just show the upload link as HTML anchor
local uploadLinkWikitext = '<div style="font-style:italic;">[' .. tostring(uploadUrl) .. ' Upload a document]</div>'
local uploadLinkHtml = '<div style="font-style:italic;"><a href="' .. tostring(uploadUrl) .. '" class="external">Upload a document</a></div>'
addFullRow(tbl, uploadLinkWikitext, 'padding:0.2em 0.4em;', false)
addFullRow(tbl, uploadLinkHtml, 'padding:0.2em 0.4em;', true)
end
end


MediaWiki Appliance - Powered by TurnKey Linux