Editing Module:Navboxdl

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 7: Line 7:
 
--
 
--
 
-- - Things to implement -                                  || - Done (✗/✓) -
 
-- - Things to implement -                                  || - Done (✗/✓) -
-- * name                                                     
+
-- * name                                                     
 
-- * state  [autocollapse, collapsed, expanded, plain, off]    ✓
 
-- * state  [autocollapse, collapsed, expanded, plain, off]    ✓
-- * navbar [plain, off]                                       
+
-- * navbar [plain, off]                                       
 
-- * border [child, subgroup, none(?)]                          ✓
 
-- * border [child, subgroup, none(?)]                          ✓
 
-- * title                                                      ✓
 
-- * title                                                      ✓
Line 33: Line 33:
 
-- * aboveclass                                                ✗
 
-- * aboveclass                                                ✗
 
-- * groupclass                                                ✗
 
-- * groupclass                                                ✗
-- * listclass                                                 
+
-- * listclass                                                 
 
-- * belowclass                                                ✗
 
-- * belowclass                                                ✗
 
-- * titlegroup                                                ✗
 
-- * titlegroup                                                ✗
Line 42: Line 42:
  
 
local p = {}
 
local p = {}
local args
 
local navbar = require('Module:Navbar')._navbar
 
  
 
-- set default expand/collapse messages
 
-- set default expand/collapse messages
Line 110: Line 108:
 
             :tag('dd')
 
             :tag('dd')
 
                 :addClass('nav-desc')
 
                 :addClass('nav-desc')
                :addClass(args.listclass)
 
  
 
         -- add a class for CSS to hook off for full width
 
         -- add a class for CSS to hook off for full width
Line 117: Line 114:
 
         end
 
         end
  
        -- If the list text is a MediaWiki list,
 
        -- add a newline before and after the text,
 
        -- so that the list is correctly recognized by the MediaWiki parser.
 
 
         -- only support url and ol at the moment
 
         -- only support url and ol at the moment
 
         -- add ; and : when CSS supports it
 
         -- add ; and : when CSS supports it
         local isList = string.find(list, '^[%*#]')
+
         if string.find(list, '^[%*#]') then
        if isList then
 
 
             desc:newline()
 
             desc:newline()
 
         end
 
         end
Line 131: Line 124:
 
         end
 
         end
  
         desc:wikitext(list)
+
         body = desc
 
+
            :wikitext(list)
        if isList then
+
             :done()
             desc:newline()
 
        end
 
 
 
        body = desc:done()
 
 
     end
 
     end
  
Line 144: Line 133:
 
         :attr('data-rows', tostring(j))
 
         :attr('data-rows', tostring(j))
 
         :done()
 
         :done()
end
 
 
local function renderNavBar(titleCell)
 
 
if args.navbar ~= 'off' and args.navbar ~= 'plain' and not (not args.name and mw.getCurrentFrame():getParent():getTitle():gsub('/sandbox$', '') == 'Template:Navbox') then
 
titleCell:wikitext(navbar{
 
args.name,
 
mini = 1,
 
fontstyle = (args.basestyle or '') .. ';' .. (args.titlestyle or '') .. ';background:none transparent;border:none;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;'
 
})
 
end
 
 
 
end
 
end
  
Line 174: Line 151:
 
--
 
--
 
function p.main(frame)
 
function p.main(frame)
     args = frame:getParent().args
+
     local args = frame:getParent().args
 
     local child_borders = {
 
     local child_borders = {
 
         child = true,
 
         child = true,
Line 223: Line 200:
  
 
     -- insert header
 
     -- insert header
     local header = mw.html.create('div')
+
     navbox
        :addClass('nav-header-wrap')
 
        :done()
 
 
 
    renderNavBar(header)
 
 
 
    header
 
 
         :tag('div')
 
         :tag('div')
 
             :addClass('nav-header')
 
             :addClass('nav-header')
Line 236: Line 207:
 
             :wikitext(args.title or '{{{title}}}')
 
             :wikitext(args.title or '{{{title}}}')
 
             :done()
 
             :done()
 
    navbox
 
        :node(header)
 
        :done()
 
  
 
     navbox
 
     navbox

Please note that all contributions to Guild of Archivists may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see GoArch:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Template used on this page: