Jump to content
Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
If you make an edit, a temporary account will be created for you.

Module:Newarticletext: Difference between revisions

From The Petit Planet Wiki
ReisuDesign (talk | contribs)
No edit summary
ReisuDesign (talk | contribs)
No edit summary
Line 15: Line 15:
     local output = {}
     local output = {}


    -- For Each Section
     for i, section_data in ipairs(sections) do
     for i, section_data in ipairs(sections) do
         if section_data['header'] and section_data['sections'] then
         if section_data['header'] and section_data['sections'] then
Line 22: Line 23:
             local column
             local column


            -- For Each Link Area
             for j, link_data in ipairs(section_data['sections']) do
             for j, link_data in ipairs(section_data['sections']) do
                 evenTest = j % 2
                 evenTest = j % 2
Line 42: Line 44:
                     for k, sub_link in ipairs(link_data['link']) do
                     for k, sub_link in ipairs(link_data['link']) do
                         ul:tag('li')
                         ul:tag('li')
                             :wikitext(
                             :node(
                                 preload_link(
                                 preload_link(
                                     title,
                                     title,
Line 51: Line 53:
                     end
                     end
                 else
                 else
                     column:wikitext(
                     column:node(
                         preload_link(
                         preload_link(
                             title,
                             title,
Line 73: Line 75:


function preload_link(page, preload, display)
function preload_link(page, preload, display)
     return tostring(
     return mw.html.create('a')
        mw.html.create('a')
        :attr(
            :attr('href', tostring(mw.uri.fullUrl(page)))
            'href',
            :attr('class', 'preload-plus-link')
            tostring(mw.uri.fullUrl(page))
            :attr('data-preload', tostring(preload))
        )
            :attr('data-page', tostring(page))
        :attr(
            :wikitext(display)
            'class',
    )
            'preload-plus-link'
        )
        :attr(
            'data-preload',
            tostring(preload)
        )
        :attr(
            'data-page',
            tostring(page)
        )
        :wikitext(display)
end
end