Module:CRTModel: Difference between revisions

No edit summary
No edit summary
Line 244: Line 244:
docPage = trim(docPage)
docPage = trim(docPage)
if docPage and docPage ~= '' then
if docPage and docPage ~= '' then
-- Get type and URL
-- Get type and URL - use + to get raw values without formatting
local typeQuery = '{{#show:' .. docPage .. '|?Has document type}}'
local typeQuery = '{{#show:' .. docPage .. '|?Has document type|+sep=,}}'
local urlQuery = '{{#show:' .. docPage .. '|?Has document URL}}'
local urlQuery = '{{#show:' .. docPage .. '|?Has document URL|+sep=,}}'
local docType = trim(frame:preprocess(typeQuery))
local docType = trim(frame:preprocess(typeQuery))
Line 254: Line 254:
local displayText = (docType and docType ~= '') and docType or 'Document'
local displayText = (docType and docType ~= '') and docType or 'Document'
-- Create list item with link - use :wikitext with bracket syntax instead
-- Create list item with link using bracket syntax
local li = ul:tag('li')
local li = ul:tag('li')
li:wikitext('[' .. docUrl .. ' ' .. displayText .. ']')
li:wikitext('[' .. docUrl .. ' ' .. displayText .. ']')
Line 265: Line 265:
td:node(ul)
td:node(ul)
-- Add upload link using wikitext bracket syntax
-- Add upload link
local uploadDiv = mw.html.create('div')
local uploadDiv = mw.html.create('div')
uploadDiv:css('margin-top', '0.5em'):css('font-style', 'italic')
uploadDiv:css('margin-top', '0.5em'):css('font-style', 'italic')
Line 272: Line 272:
td:node(uploadDiv)
td:node(uploadDiv)
else
else
-- Just show the upload link using wikitext bracket syntax
-- Just show the upload link
local uploadDiv = mw.html.create('div')
local uploadDiv = mw.html.create('div')
uploadDiv:css('font-style', 'italic')
uploadDiv:css('font-style', 'italic')
MediaWiki Appliance - Powered by TurnKey Linux