// abc2svg - roman.js - convert the chord symbols to the RNN
// (Roman Numeral Notation)
//
// Copyright (C) 2021-2023 Jean-Francois Moine
//
// This file is part of abc2svg.
//
// abc2svg is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// abc2svg is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with abc2svg. If not, see .
//
// This module is loaded by %%roman.
//
// Parameters
// %%roman int
//
// = '1': use uppercase letters with 'm' for minor chords
// = '2': user lowercase letters for minor chords
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.roman = {
note_nm: "CDEFGAB",
// chord names
nm_M: ["I", "♯I", "II", "♭III", "III", "IV", "♯IV",
"V", "♯V", "VI", "♭VII", "VII"],
nm_m: ["I", "♭II", "II", "III", "♯III", "IV", "♭V",
"V", "VI", "♯VI", "VII", "♯VII"],
// inversions: 1st: (upper)6, 2nd: (upper)6 (lower) 4
gch_build: function(of, s) {
var gch, ix, t,
ty = this.cfmt().roman
// transpose the chord back to "C"
function set_nm(p) {
var i, o, o2, a, n,
csa = []
i = p.indexOf('/') // get the bass if any
while (i > 0) {
if (p[i - 1] != '<') // if not