Siirry sisältöön

Moduuli:Kitarakirja/LuettelonSointuote

Wikikirjastosta

Tämän moduulin ohjeistuksen voi tehdä sivulle Moduuli:Kitarakirja/LuettelonSointuote/ohje

local p = {}

local sointuote = require("Moduuli:Kitarakirja/Sointuote")


function p.LuettelonSointuote(frame)
    local title = mw.title:getCurrentTitle()

    if frame:getParent():getTitle() == title.fullText then
	-- Ei transkluudausta.
	return sointuote.Sointuote(frame)
    else
	-- Ollaan transkluudaavalla sivulla.
	local chord1, chord2 = mw.ustring.match(title.fullText, "^Kitarakirja/Sointuluettelo:([A-G][♯♭])/([A-G][♯♭])")
	if chord1 and chord1 == chord2 then
	    local note = chord1:lower()
	    if mw.ustring.find(frame.args.nuotit1, note) then
		frame.args.nuotit2 = nil
	    elseif mw.ustring.find(frame.args.nuotit2, note) then
		frame.args.nuotit1 = frame.args.nuotit2
		frame.args.nuotit2 = nil
	    end
	    
	end
	    
	return sointuote.Sointuote(frame)
    end
end

return p