Einsteinian Roulette Wiki
Register
Advertisement

Documentation for this module may be created at Module:Nyars/doc

local p = {}

function addRow(table, rowHeader, rowValue)
   table:tag('tr')
        :css('vertical-align','top')
        :tag('th')
            :css('text-align', 'right')
            :css('font-size', '12px') 
            :css('width', '40%')
                :wikitext(rowHeader)
            :done()
        :tag('td')
                :wikitext(rowValue) 
end

function p.basic(frame)
    -- Create an empty string that will be returned at the end of the function
    -- New things will be added to the string as we do them
    local retString = ""
    
    -- Create an html node that will represent the table
    local table = mw.html.create('table')
    
    -- Change that node's css properties so that it has the proper style
    table
        :css('float', 'right')
        :css('margin', '0 0 0.5em 1em')
        :css('border', '1px solid limegreen')
        :css('background', 'black')
        :css('padding', '2px 5px')
        :css('color', 'green')
        :css('text-align', 'left')
        :css('font-size', '10px')
        :css('width','40%')
    
    -- Add child nodes for name row and collumn
    table:tag('tr')
        :tag('th')
            :attr('colspan',2)
            :css('text-align', 'center')
            :css('font-size','15px')
                :wikitext(frame.args.name)
    
    -- Add child nodes for offical_name row and collumns
    addRow(table,'Official Name',frame.args.official_name)
    
    -- Add child nodes for code row and collumns
    addRow(table,'Code',frame.args.code)
    
    -- Add child nodes for price rown and collumns
    addRow(table,'Price',frame.args.price)
    
    -- Add child nodes for box row and collumns
    addRow(table,'Box',frame.args.box)
    
    -- Add the table to the retString
    retString = retString .. tostring(table)
    
    -- Return the retString, after everything has been processed
    return frame:preprocess(retString)
end

function p.categorize(frame)
    -- Create an empty string that will be returned at the end of the function
    -- New things will be added to the string as we do them
    local retString = ""
    
    -- We have no idea on how to categorize artifacts
    -- so we just return a standard category
    retString = retString .. "[[Category:New_Nyars_Artifact|{{PAGENAME}}]]"
    
    -- Return the retString, after everything has been processed
    return frame:preprocess(retString)
end

return p
Advertisement