Module:Galbox: Difference between revisions

Want an adless experience? Log in or Create an account.
be a tiny bit smarter finding the caption (last item, unless it's 'right')
(allow display names that differ from page names)
(be a tiny bit smarter finding the caption (last item, unless it's 'right'))
Line 15: Line 15:
       local fileParts = mw.text.split( file, '|' )
       local fileParts = mw.text.split( file, '|' )
       local fileName = fileParts[1]
       local fileName = fileParts[1]
       local fileCaption = fileParts[3] -- TODO need to be smarter about this. for now, assuming fileName|right|fileCaption
       local fileCaption = fileParts[#fileParts] ~= 'right' and fileParts[#fileParts] -- TODO need to be smarter about this. for now, assuming the last item is either 'right' or the caption
       gallery:addFile( fileName or 'No Image.png', '[[' .. (link or section.name) .. '|' .. (fileCaption or section.name) .. ']]', {
       gallery:addFile( fileName or 'No Image.png', '[[' .. (link or section.name) .. '|' .. (fileCaption or section.name) .. ']]', {
         link = section.name,
         link = section.name,