Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
e832b91443 | |||
2acfb42a38 |
@ -1,6 +1,6 @@
|
||||
# Package
|
||||
|
||||
version = "0.3.1"
|
||||
version = "0.4.1"
|
||||
author = "Jonathan Bernard"
|
||||
description = "Chord chart formatter compatible with Planning Center Online"
|
||||
license = "MIT"
|
||||
|
@ -1,4 +1,4 @@
|
||||
import std/logging, std/nre, std/strtabs, std/strutils
|
||||
import std/[nre, strtabs, strutils]
|
||||
import zero_functional
|
||||
|
||||
type
|
||||
@ -189,7 +189,7 @@ func parsePitch*(ctx: ParserContext, keyValue: string): ChordChartPitch =
|
||||
of "gs", "gis", "g#", "ab", "a♭", "af", "aes": return ChordChartPitch.Af
|
||||
of "g𝄪", "a", "a♮", "b𝄫": return ChordChartPitch.A
|
||||
of "as", "ais", "a#", "bf", "bb", "b♭", "bes", "c𝄫": return ChordChartPitch.Bf
|
||||
of "a𝄪", "b", "ces", "cf": return ChordChartPitch.B
|
||||
of "a𝄪", "b", "cb", "ces", "cf": return ChordChartPitch.B
|
||||
of "bs", "bis", "b#", "c", "d𝄫": return ChordChartPitch.C
|
||||
of "b𝄪", "cs", "cis", "c#", "df", "db", "des": return ChordChartPitch.Df
|
||||
of "c𝄪", "d", "e𝄫": return ChordChartPitch.D
|
||||
|
@ -1,4 +1,4 @@
|
||||
const PCO_CHORDS_VERSION* = "0.3.1"
|
||||
const PCO_CHORDS_VERSION* = "0.4.1"
|
||||
|
||||
const USAGE* = """Usage:
|
||||
pco_chords [options]
|
||||
|
@ -62,6 +62,16 @@ h3 {
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
|
||||
.song-order h3 {
|
||||
font-style: italic;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.song-order li {
|
||||
list-style: none;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
@media screen {
|
||||
body { margin: 1em; }
|
||||
}
|
||||
@ -84,6 +94,14 @@ proc transpose(ctx: FormatContext, chord: ChordChartChord): string =
|
||||
|
||||
else: result = chord.original
|
||||
|
||||
func makeSongOrder(songOrder, indent: string): string =
|
||||
result = indent & "<section class=song-order>\p" &
|
||||
indent & " <h3>Song Order</h3>\p" &
|
||||
indent & " <ul>\p"
|
||||
result &= join(songOrder.split(",") -->
|
||||
map(indent & " <li>" & it.strip & "</li>\p"), "")
|
||||
result &= indent & " </ul>\p" & indent & "</section>\p"
|
||||
|
||||
proc toHtml(ctx: var FormatContext, node: ChordChartNode, indent: string): string =
|
||||
result = ""
|
||||
case node.kind
|
||||
@ -195,6 +213,10 @@ proc toHtml*(
|
||||
|
||||
result &= "<div class=page-contents>"
|
||||
result &= join(cc.nodes --> map(ctx.toHtml(it, indent & " ")), "\p")
|
||||
|
||||
if cc.metadata.contains("song order"):
|
||||
result &= makeSongOrder(cc.metadata["song order"], indent)
|
||||
|
||||
result &= "</div>"
|
||||
|
||||
result &= " </body>\p</html>"
|
||||
|
Reference in New Issue
Block a user