Modul:Citation/utilities: Unterschied zwischen den Versionen
+cu.makeLink
Keine Bearbeitungszusammenfassung |
(+cu.makeLink) |
||
| Zeile 3: | Zeile 3: | ||
suite = 'Citation', | suite = 'Citation', | ||
sub = 'utilities', | sub = 'utilities', | ||
serial = '2020-03- | serial = '2020-03-28', | ||
} | } | ||
| Zeile 134: | Zeile 134: | ||
pages = ( '' .. pages ):gsub( '–', '-' ); -- replace endashes with hyphens | pages = ( '' .. pages ):gsub( '–', '-' ); -- replace endashes with hyphens | ||
return pages:gsub( '&[%w+d%];', '-' ); -- replace html entities with hyphens | return pages:gsub( '&[%w+d%];', '-' ); -- replace html entities with hyphens | ||
end | |||
function cu.makeLink( url, text ) | |||
return '[' .. url .. ' ' .. text .. ']' | |||
end | end | ||
| Zeile 140: | Zeile 144: | ||
doi = doi:gsub( '%[', '%%5B' ) | doi = doi:gsub( '%[', '%%5B' ) | ||
doi = doi:gsub( '%]', '%%5D' ) | doi = doi:gsub( '%]', '%%5D' ) | ||
return | return cu.makeLink( 'https://doi.org/' .. mw.uri.encode( doi ), doi ) | ||
end | end | ||