Module:Listbox: Difference between revisions

Jump to navigation Jump to search
Want an adless experience? Log in or Create an account.
remove {{Main}} regex since it is always expanded now
(add AoL, LttP, LA to staging. gonna do all four before going live)
(remove {{Main}} regex since it is always expanded now)
Line 6: Line 6:
     :tag( 'ul' )
     :tag( 'ul' )
   for _, section in ipairs( sections ) do
   for _, section in ipairs( sections ) do
    local mainTemplate = section.summary:match( '%{%{Main|(.-)}}' )
     -- !!!! This may break if Template:Main is modified !!!!
     -- !!!! This may break if Template:Main is modified !!!!
     local expandedMainTemplate = section.summary:match( 'Main article: %[%[(.-)]]' )
     local expandedMainTemplate = section.summary:match( 'Main article: %[%[(.-)]]' )
     local link = mainTemplate and mw.text.split( mainTemplate, '|' )[1] or expandedMainTemplate and mw.text.split( expandedMainTemplate, '|' )[1]
     local link = expandedMainTemplate and mw.text.split( expandedMainTemplate, '|' )[1]
     list:tag( 'li' )
     list:tag( 'li' )
       :wikitext( '[[' .. (link or section.name) .. '|' .. section.name .. ']]' )
       :wikitext( '[[' .. (link or section.name) .. '|' .. section.name .. ']]' )

Navigation menu