Compare commits
2 commits
cbc20effa7
...
6ba2af679a
| Author | SHA1 | Date | |
|---|---|---|---|
| 6ba2af679a | |||
| fcebf2ebdf |
1 changed files with 19 additions and 4 deletions
|
|
@ -64,6 +64,8 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
val REGEX_NOTE_TODROP = Regex("([drmfsltz][ia]?|[―])([₄₃₂₁¹²³⁴',]*)<")
|
val REGEX_NOTE_TODROP = Regex("([drmfsltz][ia]?|[―])([₄₃₂₁¹²³⁴',]*)<")
|
||||||
val REGEX_NOTE_SPLIT = Regex("\\$\\{[Ss]:([^\\}]+)\\}([drmfsltDRFSTz][,']*)")
|
val REGEX_NOTE_SPLIT = Regex("\\$\\{[Ss]:([^\\}]+)\\}([drmfsltDRFSTz][,']*)")
|
||||||
val REGEX_DC_REFRAIN = Regex("""\$\{R=\}\$\{D:(.*?)\}""")
|
val REGEX_DC_REFRAIN = Regex("""\$\{R=\}\$\{D:(.*?)\}""")
|
||||||
|
val REGEX_D_BLOCK = Regex("""\$\{D=\}(.*?)\$\{D!\}""", RegexOption.DOT_MATCHES_ALL)
|
||||||
|
val REGEX_OVERRIDE_TOKEN = Regex("""\$\{O:\d+\}""")
|
||||||
val KEEP_MARKERS = listOf("\${L}", "\$T")
|
val KEEP_MARKERS = listOf("\${L}", "\$T")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2172,13 +2174,13 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
loadM(value)
|
loadM(value)
|
||||||
|
|
||||||
"L" ->
|
"L" ->
|
||||||
loadL(index, value)
|
loadL(index, normalizeDBlocks(value))
|
||||||
|
|
||||||
"Y" ->
|
"Y" ->
|
||||||
loadY(index, value)
|
loadY(index, normalizeDBlocks(value))
|
||||||
|
|
||||||
"E" ->
|
"E" ->
|
||||||
loadE(index, value)
|
loadE(index, normalizeDBlocks(value))
|
||||||
|
|
||||||
"U" ->
|
"U" ->
|
||||||
loadU(value)
|
loadU(value)
|
||||||
|
|
@ -2813,6 +2815,7 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
val isDS = Regex("\\$\\{D([^:]*):").find(item)
|
val isDS = Regex("\\$\\{D([^:]*):").find(item)
|
||||||
if (isDS != null) {
|
if (isDS != null) {
|
||||||
item = item.replace(REGEX_LYRICS_COMMENT, "$2")
|
item = item.replace(REGEX_LYRICS_COMMENT, "$2")
|
||||||
|
item = decodeNestedBraces(item) // restitue les ${O:n} imbriqués
|
||||||
val signDS = isDS.groupValues[1]
|
val signDS = isDS.groupValues[1]
|
||||||
val item = when (smartLyricsType) {
|
val item = when (smartLyricsType) {
|
||||||
"E" -> smartELyrics(item.replace(" _", " "))
|
"E" -> smartELyrics(item.replace(" _", " "))
|
||||||
|
|
@ -2827,7 +2830,8 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
.addHyphens()
|
.addHyphens()
|
||||||
.split(Regex("[_/]"))
|
.split(Regex("[_/]"))
|
||||||
.forEachIndexed { i, xval ->
|
.forEachIndexed { i, xval ->
|
||||||
appendLyricsItem(stanzaNumber, i + pDS, xval)
|
// ${O:n} imbriqués sont retirés
|
||||||
|
appendLyricsItem(stanzaNumber, i + pDS, REGEX_OVERRIDE_TOKEN.replace(xval, ""))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2904,6 +2908,17 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
return REGEX_STRIP_DC.replace(lyrics, $$"\\${x:}")
|
return REGEX_STRIP_DC.replace(lyrics, $$"\\${x:}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun normalizeDBlocks(lyrics: String): String =
|
||||||
|
REGEX_D_BLOCK.replace(lyrics) { m ->
|
||||||
|
"\${D:${encodeNestedBraces(m.groupValues[1])}}"
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun encodeNestedBraces(inner: String): String =
|
||||||
|
inner.replace("\${", "\uE000").replace('}', '\uE001')
|
||||||
|
|
||||||
|
private fun decodeNestedBraces(text: String): String =
|
||||||
|
text.replace("\uE000", "\${").replace('\uE001', '}')
|
||||||
|
|
||||||
private fun defineRefrainFrom(tuoNumber: Int) {
|
private fun defineRefrainFrom(tuoNumber: Int) {
|
||||||
refrainBeginsAt = tuoNumber
|
refrainBeginsAt = tuoNumber
|
||||||
refrainEndsAt = 99999
|
refrainEndsAt = 99999
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue