Module talk:Styles

From Touhou Wiki
Jump to navigation Jump to search

Documentation[edit]

For general notes on adding functions, please see Module talk:Common.

To use functions and constants from this library add the following code:

require("Module:Styles")

addstyle(tbl, val)[edit]

Makes adding styles to html tags a bit easier. Automatically skips empty styles and assures that added style ends with a semicolon.

Sample usage:

local function test(frame)
  local span = {}
  span[#span+1] = '<span style="text-align: center;'
  addstyle(span, frame.args['style1'])
  addstyle(span, frame.args['style2'])
  -- ...
  span[#span+1] = '">'

  -- add content

  span[#span+1] = '</span>'

  return table.concat(span)
end