Difference between pages "Module:Infobox" and "Module:Infobox/sandbox"

(Difference between pages)
Jump to: navigation, search
Page 1
Page 2
(added max width)
 
 
Line 2: Line 2:
 
-- This module implements {{Infobox}}
 
-- This module implements {{Infobox}}
 
--
 
--
+
 
 
local p = {}
 
local p = {}
  
Line 49: Line 49:
 
end
 
end
 
end
 
end
 +
-- the next two lines add a newline at the end of lists for the PHP parser
 +
-- https://en.wikipedia.org/w/index.php?title=Template_talk:Infobox_musical_artist&oldid=849054481
 +
-- remove when [[:phab:T191516]] is fixed or OBE
 +
s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n')
 +
s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n')
 
return s
 
return s
 
else
 
else
Line 139: Line 144:
 
     root
 
     root
 
         :tag('caption')
 
         :tag('caption')
            :css('color', 'black') -- These and the following :css() should be added to the wiki's CSS
 
            :css('font-weight', 'bold')
 
            :css('text-align', 'center')
 
            :css('margin', '0')
 
            :css('padding', '0')
 
 
             :addClass(args.titleclass)
 
             :addClass(args.titleclass)
 
             :cssText(args.titlestyle)
 
             :cssText(args.titlestyle)
Line 216: Line 216:
 
             data = tostring(data),
 
             data = tostring(data),
 
             datastyle = args.imagestyle,
 
             datastyle = args.imagestyle,
             class = "infobox-image" .. (args.imageclass or ""),
+
             class = args.imageclass,
 
             rowclass = args['imagerowclass' .. tostring(num)]
 
             rowclass = args['imagerowclass' .. tostring(num)]
 
         })
 
         })
Line 268: Line 268:
 
local function renderTrackingCategories()
 
local function renderTrackingCategories()
 
     if args.decat ~= 'yes' then
 
     if args.decat ~= 'yes' then
         if #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
+
    if args.child == 'yes' then
 +
        if args.title then
 +
            root:wikitext('[[Category:Pages which use embedded infobox templates with the title parameter]]')
 +
        end
 +
         elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then
 
             root:wikitext('[[Category:Articles which use infobox templates with no data rows]]')
 
             root:wikitext('[[Category:Articles which use infobox templates with no data rows]]')
        end
 
        if args.child == 'yes' and args.title then
 
            root:wikitext('[[Category:Pages which use embedded infobox templates with the title parameter]]')
 
 
         end
 
         end
 
     end
 
     end
Line 284: Line 285:
 
          
 
          
 
         root
 
         root
             :addClass((args.subbox ~= 'yes') and 'infobox' or nil)
+
             :addClass((args.subbox ~= 'yes') and 'infobox-sandbox' or nil)
 
             :addClass(args.bodyclass)
 
             :addClass(args.bodyclass)
 
              
 
              
Line 298: Line 299:
 
                     :css('float', 'none')
 
                     :css('float', 'none')
 
                     :css('background-color', 'transparent')
 
                     :css('background-color', 'transparent')
            else
 
                root --the following should probably be in the wiki's CSS instead
 
                    :css('min-width', '22em')
 
                    :css('max-width', '32em')
 
                    :css('border-collapse', 'separate')
 
                    :css('border-spacing', '3px')
 
 
             end
 
             end
 
         root
 
         root