k Admin heeft de pagina Module:Format title for sorting hernoemd naar Module:Format for sorting zonder een doorverwijzing achter te laten
Geen bewerkingssamenvatting
Regel 4: Regel 4:


local mDiacritics = require('Module:Diacritics')
local mDiacritics = require('Module:Diacritics')
local mConvertNumerals = require('Module:ConvertNumerals')
local mPadNumbers = require('Module:Pad numbers')


local p = {}
local p = {}
Regel 26: Regel 28:
end
end


local function convertToArabic( str )
str = mConvertToNumerals.toArabicNum( str )
return str
end
local function padNumbers( str )
str = mPadNumbers.main( str, 5 )
return str
end
--[[
Currently used for strings of type Page with appropriate collation
]]--
function p.main( frame )
function p.main( frame )
local str = ""
local str = ""
Regel 34: Regel 49:
if str == nil then
if str == nil then
error("...")
error("...")
else
return str
end
end
--[[
Used for strings of type Text, hence the need for padding with leading zeroes
]]--
function p.textString( frame )
local str = "0"
str = mw.text.unstrip(frame.args[1])
str = string.lower( str )
str = removeDiacritics( str )
--str = removePunctuation( str )
str = padNumbers( str )
--@todo - provide default if operation failed:
--str = convertToArabic( str )
if str == nil then
error("...")
elseif str == "" then
return "0"
else
else
return str
return str

Versie van 10 aug 2023 13:11

Module:Format for sorting

Description
Test using main:

hallo hallo d d hello this is 45567 ff

tests using textString

series 45.567.1 ? = Luafout in Module:Pad_numbers op regel 39: attempt to index field 'args' (a nil value)

Roman numeral

Luafout in Module:Pad_numbers op regel 39: attempt to index field 'args' (a nil value)

Luafout in Module:Pad_numbers op regel 39: attempt to index field 'args' (a nil value)

minimalStrip

Scriptfout: de functie "minimalStrip" bestaat niet.

main

drukkerij uitgeverij sdfsdf de eik antwerpen



--[[
-- {{#invoke:Strip title for sorting|main|...}}
]]--

local mDiacritics = require('Module:Diacritics')
local mConvertNumerals = require('Module:ConvertNumerals')
local mPadNumbers = require('Module:Pad numbers')

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

local function convertToArabic( str )
	str = mConvertToNumerals.toArabicNum( str )
	return str
end

local function padNumbers( str )
	str = mPadNumbers.main( str, 5 )
	return str
end

--[[
Currently used for strings of type Page with appropriate collation
]]--
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

--[[
Used for strings of type Text, hence the need for padding with leading zeroes
]]--
function p.textString( frame )
	local str = "0"
	str = mw.text.unstrip(frame.args[1])
	str = string.lower( str )
	str = removeDiacritics( str )
	--str = removePunctuation( str )
	str = padNumbers( str )
	--@todo - provide default if operation failed:
	--str = convertToArabic( str )
	
	if str == nil then
		error("...")
	elseif str == "" then
		return "0"
	else
		return str
	end
end

return p