Module:CanonicalForms: Difference between revisions

// via Wikitext Extension for VSCode
// via Wikitext Extension for VSCode
 
Line 1: Line 1:
-- Module:CanonicalForms
--[[
-- Normalizes strings by removing wiki markup and mapping to canonical values.
* Name: CanonicalForms
-- Mapping tables:
* Author: Mark W. Datysgeld
--  * canonical: Display value (automatically included in case-insensitive matching)
* Description: Text normalization utility that removes wiki markup and maps user input to canonical values using configurable lookup tables
--  * synonyms: Additional case-insensitive terms mapped to canonical
* Notes: Example usage: local mapping = { { canonical = "gTLD", synonyms = {"generic", "g"} }, { canonical = "ccTLD", synonyms = {"country", "cc"} } }; local canonical, css, category = require('Module:CanonicalForms').normalize(inputString, mapping)
--  * [optional] css: CSS class
]]
--  * [optional] category: Auto-assigned category
--
-- Example:
--  local mapping = {
--    { canonical = "gTLD", synonyms = {"generic", "g"} },
--    { canonical = "ccTLD", synonyms = {"country", "cc"} }
--  }
--  local canonical, css, category = require('Module:CanonicalForms').normalize(inputString, mapping)
--


local CanonicalForms = {}
local CanonicalForms = {}