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' .. | ||
' |format=count\n' .. | ' |format=count\n' .. | ||
'}}' | '}}' | ||
| Line 235: | Line 233: | ||
-- Parse document page names from the result | -- Parse document page names from the result | ||
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> | -- 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;"> | 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;', | 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 | local uploadLinkHtml = '<div style="font-style:italic;"><a href="' .. tostring(uploadUrl) .. '" class="external">Upload a document</a></div>' | ||
addFullRow(tbl, | addFullRow(tbl, uploadLinkHtml, 'padding:0.2em 0.4em;', true) | ||
end | end | ||