Nieuwe pagina aangemaakt met '---- -- local mDiacritics = require('Module:Diacritics') local p = {}' |
Geen bewerkingssamenvatting |
||
| Regel 1: | Regel 1: | ||
--[[ | --[[ | ||
-- | -- {{#invoke:Strip title for sorting|main|...}} | ||
]]-- | ]]-- | ||
| Regel 6: | Regel 6: | ||
local p = {} | local p = {} | ||
local function removePunctuation( str ) | |||
local str = str | |||
str = string.gsub( str, "%-?[%p%.]+", "" ) | |||
local addchars ={ "‘", "’", "“", "”" } | |||
for i, v in ipairs( addchars ) do | |||
str = string.gsub(str, v, "") | |||
end | |||
if str == nil then | |||
error(" No string received. " ) | |||
else | |||
return str | |||
end | |||
end | |||
local function removeDiacritics( str ) | |||
str = mDiacritics.strip_diacrits( str ) | |||
return str | |||
end | |||
function p.main( frame ) | |||
local str = "" | |||
str = mw.text.unstrip(frame.args[1]) | |||
str = removeDiacritics( str ) | |||
str = string.lower( str ) | |||
str = removePunctuation( str ) | |||
if str == nil then | |||
error("...") | |||
else | |||
return str | |||
end | |||
end | |||
Versie van 25 jan 2023 17:03
Module:Format for sorting
Description
Test using main:
Scriptfout: de module heeft de waarde nil teruggegeven. Dit moet een exporttabel zijn.
tests using textString
series 45.567.1 ? = Scriptfout: de module heeft de waarde nil teruggegeven. Dit moet een exporttabel zijn.
- Roman numeral
Scriptfout: de module heeft de waarde nil teruggegeven. Dit moet een exporttabel zijn.
Scriptfout: de module heeft de waarde nil teruggegeven. Dit moet een exporttabel zijn.
minimalStrip
Scriptfout: de module heeft de waarde nil teruggegeven. Dit moet een exporttabel zijn.
main
Scriptfout: de module heeft de waarde nil teruggegeven. Dit moet een exporttabel zijn.--[[
-- {{#invoke:Strip title for sorting|main|...}}
]]--
local mDiacritics = require('Module:Diacritics')
local p = {}
local function removePunctuation( str )
local str = str
str = string.gsub( str, "%-?[%p%.]+", "" )
local addchars ={ "‘", "’", "“", "”" }
for i, v in ipairs( addchars ) do
str = string.gsub(str, v, "")
end
if str == nil then
error(" No string received. " )
else
return str
end
end
local function removeDiacritics( str )
str = mDiacritics.strip_diacrits( str )
return str
end
function p.main( frame )
local str = ""
str = mw.text.unstrip(frame.args[1])
str = removeDiacritics( str )
str = string.lower( str )
str = removePunctuation( str )
if str == nil then
error("...")
else
return str
end
end
