Vorlage:Hilio/doc
Diese Seite ist die Dokumentations-Unterseite der Vorlage Hilio |
Die Vorlage {{Hilio}} ruft den Modul Hili mit dem Unterprogramm hilio auf und bewirkt eine syntaktische Einfärbung des Programmcodes. Für das Funktionieren ist die [Erweiterung Syntaxhighlight][1] erforderlich.
Der Unterschied zur Vorlage {{Hili}} besteht darin, dass nur der Lilypond-Code nur für festgelegte Benutzeraccounts angezeigt wird.
Alle Vorlagen mit Scribunto-Aufrufen: Alle module, Cats, Coco, Countdown, Dokumentation bearbeiten, DurTonleiter, Ensemble, Hili, Hilio, Klavierscore, Lenplus, Lilypond, LSR, Lua/cats, Lua/catx, Lua/eiffel, Lua/ensemble, Lua/hili, Lua/hilio, Lua/lenplus, Lua/lily, Lua/midi, Lua/pianoduet, Lua/rep, Lua/scale, Lua/score, Lua/staffgroup, Lua/svg, Lua/tag, Lua/vb, Midi, Mixi, PHP, Php, Pianoduet, Rep, Scale, Scheme, Score, SQL, Tag, Tonleiter, Vb, Vorlage
Parameter
Name | Beschreibung | Standard | Status | |
---|---|---|---|---|
mus | Lilypond Score | \relative c'' { c4 d e } | optional | |
lang | Sprache deren Syntax angewendet werden woll | latex | optional |
Kopiervorlagen
|mus=
|lang=}}
|mus=
|lang=}}
Anwendung
{{Hilio}}
{{Hilio|mus=\markup "ABC"|width=50em}}
Code
<includeonly>
<onlyinclude><div><div style="display: inline-block; margin: 0; width: {{{width|auto}}}">{{#invoke:Lilypond|hilio}}</div></div></onlyinclude>
</includeonly>
{{Dokumentation}}
Lua-Code
function p.hilio(frame)
-- Syntaxhighlighting von Lilypond-Code
-- wird nur bei Adminaccount angezeigt
-- standardmäßig als Latex formatiert, weil es keine spezielle Lilypond-Syntax gibt
local a = frame.args -- Direktaufruf via invoke
local b = frame:getParent().args -- Aufruf via Vorlage
local mus = music
for k, v in pairs(a) do
if string.lower(k) ~= "lang" then -- damit kann der Parameter beliebig benannt werden, nur lang wird ausgenommen
mus = v
break
end
end
for k, v in pairs(b) do
if string.lower(k) ~= "lang" then -- damit kann der Parameter beliebig benannt werden, nur lang wird ausgenommen
mus = v
break
end
end
local _lang = a.lang or b.lang or 'latex'
local _ = frame:extensionTag { name = 'syntaxhighlight', content = mus, args = { lang = _lang } }
return frame:preprocess('')
end