Modul:Citation/utilities: Unterschied zwischen den Versionen
replace character references and entities
K (link) |
(replace character references and entities) |
||
| Zeile 3: | Zeile 3: | ||
suite = 'Citation', | suite = 'Citation', | ||
sub = 'utilities', | sub = 'utilities', | ||
serial = '2020-04- | serial = '2020-04-17', | ||
} | } | ||
| Zeile 134: | Zeile 134: | ||
end | end | ||
-- replace character references and entities | |||
s = mw.text.decode( s, true ) | |||
-- replace characters | -- replace characters | ||
s = mw.ustring.gsub( s, '%.%.%.', '…' ) | s = mw.ustring.gsub( s, '%.%.%.', '…' ) | ||
| Zeile 146: | Zeile 148: | ||
end | end | ||
-- replace dashes with hyphens | |||
return mw.ustring.gsub( '' .. pages, '[–‒—]', '-' ); | |||
end | end | ||
| Zeile 168: | Zeile 163: | ||
-- zero-width joiner, zero-width space, soft hyphen | -- zero-width joiner, zero-width space, soft hyphen | ||
local i, value | local i, value | ||
-- remove characters: soft hyphen, LTR mark, RTL mark | |||
for i, value in ipairs( { '', '', '' } ) do | |||
for i, value in ipairs( { ' | |||
s = mw.ustring.gsub( s, value, '' ) | s = mw.ustring.gsub( s, value, '' ) | ||
end | end | ||