Modul:Vorlage:Vers
| Vorlagenprogrammierung | Diskussionen | Lua | Unterseiten | ||
| Modul | Deutsch
|
Modul: | Dokumentation | ||
Diese Seite enthält Code in der Programmiersprache Lua. Einbindungszahl Cirrus
-- Export
local p = { }
function p.uc_html(c)
return "&#x" .. mw.ustring.format("%04x;", mw.ustring.codepoint(c))
end
function p.special_escape(c)
r, n = mw.ustring.gsub(c, "[a-zA-Z]", {
["a"] = "<small>○</small>"; -- äoilische Basis u. unbestimmte Silbe
["b"] = "̆"; -- Breve
["B"] = "⏜"; -- Brücke
["E"] = "<span style='font-size:xx-small;'>└─┴─┘</span>"; -- 5 Mora
["f"] = "ˌ"; -- Versfuß
["F"] = "<span style='font-size:xx-small;'>└───┘</span>"; -- 4 Mora = ganze Note
["G"] = "<span style='font-size:xx-small;'>└──╴</span>"; -- 3 Mora = 3/4 Note
["h"] = " ́"; -- Haupthebung
["H"] = "<span style='font-size:xx-small;'>──</span>"; -- 2 Mora = halbe Note
["i"] = "<span style='text-decoration:underline;'>◠</span>"; -- Indifferenz
["I"] = "◠<span style='line-height:100%;font-size:150%;'>̣</span>"; -- Indifferenz (alternativ)
["k"] = "<span style='line-height:100%;vertical-align:-40%;text-decoration:overline'><span style='vertical-align:45%;'>◡</span></span>"; -- Kürze oder Länge
["l"] = "<span style='line-height:100%;vertical-align:30%;text-decoration:underline'><span style='vertical-align:25%;'>◡</span></span>"; -- Länge oder Kürze
["m"] = "̄"; -- Macron
["M"] = "͞"; -- doppelter Macron
["n"] = " ̀"; -- Nebenhebung
["o"] = "<span style='vertical-align:-15%;font-size:small;'>(</span>◡<span style='vertical-align:-15%;font-size:small;'>)</span>"; -- optionale kurze Silbe
["s"] = "⫽"; -- Strophenende
["u"] = " "; -- unbetont (Platzhalter für Betonungszeichen)
["v"] = "/"; -- Versende
["w"] = "¦"; -- häufiges Wortende
-- [""] = ""; --
})
if n ~= 0 then return r end
return p.uc_html(c)
end
function p.do_convert (str)
str,_ = mw.ustring.gsub(str, "\\([^a-zA-Z])", p.uc_html)
str,_ = mw.ustring.gsub(str, "!!", " ‖ "); -- THIN SPACE + DOUBLE VERTICAL LINE + THIN SPACE
str,_ = mw.ustring.gsub(str, ".", {
["/"] = "—"; -- EM DASH
["-"] = "◡"; -- LOWER HALF CIRCLE
["'"] = "́"; -- COMBINING ACUTE ACCENT
["~"] = "̀"; -- COMBINING GRAVE ACCENT
["_"] = "̱"; -- COMBINING MACRON BELOW
-- ["^"] = "∧"; -- LOGICAL AND
["\n"] = "<br/>\n"; -- Line break + new line
["!"] = " | "; -- THIN SPACE + VERTICAL BAR + THIN SPACE
})
str,_ = mw.ustring.gsub(str, "%%", "×"); -- MULTIPLICATION SIGN
str,_ = mw.ustring.gsub(str, "[§$+*]", {
["§"] = "<span style='line-height:100%;vertical-align:30%;text-decoration:underline'><span style='vertical-align:25%;'>◡◡</span></span>";
["$"] = "<span style='line-height:100%;vertical-align:-40%;text-decoration:overline'><span style='vertical-align:45%;'>◡◡</span></span>";
["+"] = "<span style='font-size:x-small;vertical-align:10%;'>◡</span>";
["*"] = "<span style='font-size:x-small;vertical-align:-10%;'>◠</span>";
})
str,_ = mw.ustring.gsub(str, "\\([a-zA-Z])", p.special_escape)
return str
end
function p.convert (frame)
local str = frame.args[1]
return p.do_convert(str)
end
return p
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.