Module:Index template: திருத்தங்களுக்கு இடையிலான வேறுபாடு
உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
No edit summary |
No edit summary |
||
வரிசை 27:
tag:wikitext('[[' .. page .. '|' .. label .. ']]')
if itemId ~= nil then
tag:wikitext(' [[Image:Wikidata.svg|10px|link=d:' .. itemId .. '|
if category ~= nil then
tag:wikitext('[[
end
end
வரிசை 45:
:tag('td'):wikitext(value)
end
end
function splitFileNameInFileAndPage(title)
local slashPosition = string.find(title.text, "/")
if slashPosition == nil then
return title.text,nil
else
return string.sub(title.text, 1, slashPosition - 1), string.sub(title.text, slashPosition + 1)
end
end
வரி 52 ⟶ 61:
local args = data.args
local item = data.item
local page = mw.title.getCurrentTitle()
local html = mw.html.create()
if item then
html:wikitext('[[
else
html:wikitext('[[Category: Books without a Wikidata ID]]')
end
--Left part
local left = html:tag('div')
if args.
left:css('width', '53%')
end
வரி 68 ⟶ 79:
--Image
if args.image then
local imageTitle = nil
-- this is a page number
imageTitle = mw.title.getCurrentTitle():subPageTitle(args.image)
else
-- this is an other file
end
if imageTitle == nil then
imageContainer:wikitext(args.image)
else
local imageName, imagePage = splitFileNameInFileAndPage(imageTitle)
if imagePage ~= nil then
imageContainer:wikitext('[[File:' .. imageName .. '|page=' .. imagePage .. '|250px]]')
else
imageContainer:wikitext('[[File:' .. imageName .. '|250px]]')
end
end
end
--Metadata
வரி 94 ⟶ 111:
local metadataTable = metadataContainer:tag('table')
if args.
addRow(metadataTable, '
addRow(metadataTable, '
end
else
mw.addWarning('
end
addRow(metadataTable, '
if args.volume then
html:wikitext('[[Category: Books with Volume]]')
else
html:wikitext('[[Category: Books without Volume]]')
end
if args.edition then
html:wikitext('[[Category: Books with Edition]]')
else
html:wikitext('[[Category: Books without Edition]]')
end
if args.author then
addRow(metadataTable, 'Author', withWikidataLink(args.author))
html:wikitext('[[Category: Books with Author]]')
-- html:wikitext('[[Category: Books by ' .. mw.text.nowiki(args.author) .. ']]')
-- local author = mw.text.nowiki(args.author)
-- html:wikitext('[[Category: Books by ' .. author .. ']]')
--local author = {{delink|[[args.author]]}}
--local author = {{#delink|I visited www.example.com example.com.}}
--local author = {{#invoke:delink | args.author}}
--local author = mw.text.unstrip( args.author )
--html:wikitext('[[Category: Books by ' .. author .. ']]')
else
addRow(metadataTable, 'Author', '{{Al|' .. args.author .. '}}')
end
else
html:wikitext('[[Category: Books without Author]]')
end
if args.translator then
if item then
addRow(metadataTable, 'Translator', withWikidataLink(args.translator))
html:wikitext('[[Category: Books with Translator]]')
else
addRow(metadataTable, 'Translator', '{{Al|' .. args.translator .. '}}')
end
else
html:wikitext('[[Category: Books without Translator]]')
end
if args.editor then
if item then
addRow(metadataTable, 'Editor', withWikidataLink(args.editor))
html:wikitext('[[Category: Books with Editor]]')
else
addRow(metadataTable, 'Editor', '{{Al|' .. args.editor .. '}}')
end
else
html:wikitext('[[Category: Books without Editor]]')
end
if args.illustrator then
addRow(metadataTable, 'Illustrator', withWikidataLink(args.illustrator))
html:wikitext('[[Category: Books with Illustrator]]')
else
html:wikitext('[[Category: Books without Illustrator]]')
end
if args.publisher then
if item then
addRow(metadataTable, 'Publisher', withWikidataLink(args.publisher))
html:wikitext('[[Category: Books with Publisher]]')
-- {{suppress categories|html:wikitext[[Category:No Publisher]]}}
-- {{#invoke:Suppress categories|main|html:wikitext[[Category:No Publisher]]}}
else
addRow(metadataTable, 'Publisher', withWikidataLink(args.publisher))
html:wikitext('[[Category: Books with Publisher]]')
end
else
html:wikitext('[[Category: Books with No Publisher]]')
end
if args.address then
addRow(metadataTable, 'Address', withWikidataLink(args.address))
html:wikitext('[[Category:Books with Place of Publication]]')
else
if args.publishedin then
addRow(metadataTable, 'Published In', withWikidataLink(args.publishedin))
html:wikitext('[[Category:Books with Place of Publication]]')
else
html:wikitext('[[Category:Books without Place of Publication]]')
end
end
if args.year then
addRow(metadataTable, 'Year', withWikidataLink(args.year))
html:wikitext('[[Category: Books with Year]]')
else
html:wikitext('[[Category: Books without Year]]')
end
if args.printer then
addRow(metadataTable, 'Printer', withWikidataLink(args.printer))
html:wikitext('[[Category: Books with Printer]]')
else
html:wikitext('[[Category: Books without Printer]]')
end
if args.source == 'djvu' or args.source == 'pdf' then
addRow(metadataTable, 'Source', '[[:File:' .. mw.title.getCurrentTitle().text .. '|' .. args.source .. ']]')
--add an indicator linking to the usages
html:wikitext('<indicator name="index-scan-wikidata">[[File:Wikidata Query Service Favicon.svg|20px|Wikidata items |link=https://query.wikidata.org/embed.html#' .. mw.uri.encode(query, 'PATH') .. ']]</indicator>')
else
addRow(metadataTable, '
end
if args.
addRow(metadataTable, '
elseif args.
addRow(metadataTable, '
elseif args.
addRow(metadataTable, '
elseif args.
addRow(metadataTable, '
elseif args.
addRow(metadataTable, '
addRow(metadataTable, '
else
addRow(metadataTable, '
end
addRow(metadataTable, '
if args.pages then
left:tag('div'):css('clear', 'both')
left:tag('div'):attr('id', 'pagelist'):css({
background = '#F0F0F0',
வரி 168 ⟶ 271:
}):newline():wikitext(args.pages):newline()
else
mw.addWarning('
end
if args.
local right = html:tag('div'):css({
width = '44%;',
வரி 177 ⟶ 280:
float = 'right'
})
if args.
right:tag('div'):attr('id', '
end
if args.
right:tag('hr'):css({
['margin-top'] = '1em',
['margin-bottom'] = '1em'
})
right:tag('div'):attr('id', '
end
end
if args.type == 'book' then
html:wikitext('[[
elseif args.type == 'journal' then
html:wikitext('[[
html:wikitext('[[
elseif args.type == 'dictionary' then
html:wikitext('[[
elseif args.type == 'phdthesis' then
html:wikitext('[[
end
html:wikitext('[[
if args.source ~= 'djvu' then
html:wikitext('[[Category:
elseif args.source == 'pdf' then
html: wikitext ('[[Category: PDF book]]')
elseif args.source == 'ogg' then
html: wikitext ('[[Category: OGG file]]')
elseif args.source == 'webm' then
html: wikitext ('[[Category: webm file]]')
end
if not args.
html: wikitext ('[[
end
|