Wikipedia:Lua/Modul/Coordinates/en
Vorlagenprogrammierung | Diskussionen | Lua | Unterseiten | |||
Modul | Deutsch | English
|
Modul: | Dokumentation |
Coordinates
– Module with functions for coordinates (geo, sky).
German Wikipedia does not maintain this module until further notice.
Functions for templates
[Quelltext bearbeiten]- kmlTitle
- Replace characters that cause problems in
kmlexport
by similar simplified surrogates. - Then remove any remaining character which makes trouble.
- Parameters:
- 1
- Label text
- Evaluate: adjusted label text – if that would be empty, the original text will be returned
Hack for kmlexport 2017/18
[Quelltext bearbeiten]This tool has problems on decoding the URL when characters appear which need three octets in UTF-8. That happens from codepoint U+0800 (204810) upwards.
The function kmlTitle
remedies that temporarily.
Other Wiki projects might copy the following module directly:
or include the three functions into a local Module:Coordinates (d:Q7348344).
In templates it can be used then by
{{#invoke:Coordinates|kmlTitle|Some title for geohack}}
or respectively (as is)
{{#invoke:Coordinates/kml|kmlTitle|Some title for geohack}}
For substitution of problematic characters by surrogates the following two modules might be provided locally:
If they are missing the hack will work as well, but cannot replace by similar characters.
Test case: „ỹ—jajaja“ „ỹ—jajaja“
→ "y-jajaja""y-jajaja"
Functions for Lua modules (API)
[Quelltext bearbeiten]The function described above can be used by other modules per require()
for a label text show
:
local lucky, kmlHack = pcall( require, "Module:Coordinates/kml" )
if type( kmlHack ) == "table" then
show = kmlHack._kmlTitle( show )
end