Modul:Citation: Unterschied zwischen den Versionen
+additional cleanup
KKeine Bearbeitungszusammenfassung |
(+additional cleanup) |
||
| Zeile 245: | Zeile 245: | ||
s = mw.ustring.gsub( s, '%[%[([^%[%]]*)%]%]', '%1' ) | s = mw.ustring.gsub( s, '%[%[([^%[%]]*)%]%]', '%1' ) | ||
s = s:gsub( "''+", '' ) -- multiple apostrophes | s = s:gsub( "''+", '' ) -- multiple apostrophes | ||
s = mw.ustring.gsub( s, '%[%a*:?//[^ ]+%s+([^%]]+)%]', '%1' ) -- web links | |||
s = mw.ustring.gsub( s, '%[mailto:[^ ]+%s+([^%]]+)%]', '%1' ) | |||
s = mw.ustring.gsub( s, '%[(%a*:?//[^%]]+)%]', '%1' ) | |||
s = mw.ustring.gsub( s, '%[mailto:([^%]]+)%]', '%1' ) | |||
end | end | ||
s = s:gsub( '%s%s+', ' ' ) -- multiple spaces | |||
return mw.ustring.gsub( s, '</*span%s*/*>', '' ) | return mw.ustring.gsub( s, '</*span%s*/*>', '' ) | ||
end | end | ||
| Zeile 292: | Zeile 297: | ||
end | end | ||
pages = ( '' .. pages ):gsub( '–', '-' ); -- replace endashes with hyphens | pages = ( '' .. pages ):gsub( '–', '-' ); -- replace endashes with hyphens | ||
return pages:gsub( '&%w+;', '-' ); -- replace html entities with hyphens | return pages:gsub( '&[%w+d%];', '-' ); -- replace html entities with hyphens | ||
end | end | ||
| Zeile 703: | Zeile 708: | ||
for key, value in pairs( args ) do | for key, value in pairs( args ) do | ||
args[ key ] = mw.ustring.gsub( | args[ key ] = mw.ustring.gsub( args[ key ], ' ', ' ' ) | ||
args[ key ] = mw.ustring.gsub( args[ key ], '&%w+;', '' ) -- remove entities | |||
end | end | ||
| Zeile 725: | Zeile 731: | ||
if count > 1 then | if count > 1 then | ||
args.author = getFirst( args.author, ',' ) | args.author = getFirst( args.author, ',' ) | ||
end | |||
for key, value in ipairs( { 'author', 'editor' } ) do | |||
args[ value ] = mw.ustring.gsub( args[ value ], '[%[%]!#$%%%*%+%?]', '' ) | |||
end | end | ||