Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
a57aed0715 | |||
2712f9ff52 |
@ -1,6 +1,6 @@
|
|||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "0.5.1"
|
version = "0.5.4"
|
||||||
author = "Jonathan Bernard"
|
author = "Jonathan Bernard"
|
||||||
description = "Chord chart formatter compatible with Planning Center Online"
|
description = "Chord chart formatter compatible with Planning Center Online"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@ -12,3 +12,9 @@ bin = @["pco_chords"]
|
|||||||
# Dependencies
|
# Dependencies
|
||||||
|
|
||||||
requires "nim >= 1.6.6", "docopt", "zero_functional"
|
requires "nim >= 1.6.6", "docopt", "zero_functional"
|
||||||
|
|
||||||
|
# Dependencies from git.jdbernard.com/jdb/nim-package
|
||||||
|
requires "update_nim_package_version"
|
||||||
|
|
||||||
|
task updateVersion, "Update the version of this tool.":
|
||||||
|
exec "update_nim_package_version pco_chords 'src/pco_chordspkg/cliconstants.nim'"
|
||||||
|
@ -38,7 +38,12 @@ when isMainModule:
|
|||||||
if args["--transpose"]: parseInt($args["--transpose"])
|
if args["--transpose"]: parseInt($args["--transpose"])
|
||||||
else: 0
|
else: 0
|
||||||
|
|
||||||
let outputHtml = ast.toHtml(transpose, args["--number-chart"])
|
let outputHtml =
|
||||||
|
if args["--large-print"]:
|
||||||
|
ast.toHtml(transpose, args["--number-chart"],
|
||||||
|
stylesheets = @[LARGE_PRINT_STYLESHEET])
|
||||||
|
else:
|
||||||
|
ast.toHtml(transpose, args["--number-chart"])
|
||||||
|
|
||||||
if args["--output"]: writeFile($args["--output"], outputHtml)
|
if args["--output"]: writeFile($args["--output"], outputHtml)
|
||||||
else: stdout.write(outputHtml)
|
else: stdout.write(outputHtml)
|
||||||
|
@ -88,9 +88,9 @@ func renderPitchInKey*(
|
|||||||
var scaleNames: array[(ord(high(ChordChartPitch)) + 1), string]
|
var scaleNames: array[(ord(high(ChordChartPitch)) + 1), string]
|
||||||
if useSharps.isNone:
|
if useSharps.isNone:
|
||||||
scaleNames = case key
|
scaleNames = case key
|
||||||
of A, B, C, D, E, G:
|
of A, B, D, E, G:
|
||||||
["G#", "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G"]
|
["G#", "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G"]
|
||||||
of Af, Bf, Df, Ef, F:
|
of Af, Bf, C, Df, Ef, F:
|
||||||
["A♭", "A", "B♭", "B", "C", "D♭", "D", "E♭", "E", "F", "G♭", "G"]
|
["A♭", "A", "B♭", "B", "C", "D♭", "D", "E♭", "E", "F", "G♭", "G"]
|
||||||
of Gf:
|
of Gf:
|
||||||
["A♭", "A", "B♭", "C♭", "C", "D♭", "D", "E♭", "E", "F", "G♭", "G"]
|
["A♭", "A", "B♭", "C♭", "C", "D♭", "D", "E♭", "E", "F", "G♭", "G"]
|
||||||
@ -259,7 +259,7 @@ proc parsePitch*(ctx: ParserContext, keyValue: string): ChordChartPitch =
|
|||||||
# see regexr.com/70nv1
|
# see regexr.com/70nv1
|
||||||
let CHORD_REGEX =
|
let CHORD_REGEX =
|
||||||
"([b#♭♮𝄫𝄪]?[A-G1-7][b#♭♮𝄫𝄪]?)" & # chord root
|
"([b#♭♮𝄫𝄪]?[A-G1-7][b#♭♮𝄫𝄪]?)" & # chord root
|
||||||
"(([mM1-9#b♭♮𝄫𝄪Δ+oøoø][0-9]?|min|maj|aug|dim|sus|6\\/9|\\([1-9#b♭]+\\))*)" & # chord flavor/type
|
"((min|maj|aug|dim|sus|6\\/9|[mM1-9#b♭♮𝄫𝄪Δ+oøoø][0-9]?|\\([1-9#b♭]+\\))*)" & # chord flavor/type
|
||||||
"(\\/([b#♭♮𝄫𝄪]?[A-G1-7][b#♭♮𝄫𝄪]?))?" # optional bass
|
"(\\/([b#♭♮𝄫𝄪]?[A-G1-7][b#♭♮𝄫𝄪]?))?" # optional bass
|
||||||
let CHORD_PAT = re(CHORD_REGEX)
|
let CHORD_PAT = re(CHORD_REGEX)
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const PCO_CHORDS_VERSION* = "0.5.1"
|
const PCO_CHORDS_VERSION* = "0.5.4"
|
||||||
|
|
||||||
const USAGE* = """Usage:
|
const USAGE* = """Usage:
|
||||||
pco_chords [options]
|
pco_chords [options]
|
||||||
@ -23,6 +23,7 @@ Options:
|
|||||||
--help Print this usage information
|
--help Print this usage information
|
||||||
--debug Enable debug logging.
|
--debug Enable debug logging.
|
||||||
--echo-args Echo the input parameters.
|
--echo-args Echo the input parameters.
|
||||||
|
--large-print Use the large type styling.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
const ONLINE_HELP* = """
|
const ONLINE_HELP* = """
|
||||||
|
@ -52,7 +52,7 @@ h3 .section-text {
|
|||||||
.line {
|
.line {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: flex-end;
|
align-items: end;
|
||||||
|
|
||||||
margin-left: 0.5em;
|
margin-left: 0.5em;
|
||||||
margin-bottom: 0.5em;
|
margin-bottom: 0.5em;
|
||||||
@ -65,10 +65,104 @@ h3 .section-text {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.word.space-after { margin-right: 0.5em; }
|
.word.space-after { margin-right: 0.5em; }
|
||||||
|
.word.no-chord { align-self: flex-end; }
|
||||||
|
|
||||||
.chord {
|
.chord {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin-right: 0.5em;
|
margin-right: 0.5em;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chord .flavor {
|
||||||
|
font-variant-position: super;
|
||||||
|
}
|
||||||
|
|
||||||
|
.song-order h3 {
|
||||||
|
font-style: italic;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.song-order li {
|
||||||
|
list-style: none;
|
||||||
|
margin-left: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen {
|
||||||
|
body { margin: 1em; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
.page-contents { column-count: 2; }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
"""
|
||||||
|
|
||||||
|
const LARGE_PRINT_STYLESHEET* = """
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-contents {
|
||||||
|
column-width: 336px;
|
||||||
|
column-width: 3.5in;
|
||||||
|
}
|
||||||
|
|
||||||
|
.column-break { margin-bottom: auto; }
|
||||||
|
|
||||||
|
h2 { font-size: 1.25em; }
|
||||||
|
|
||||||
|
section {
|
||||||
|
break-inside: avoid;
|
||||||
|
padding-top: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: 1.125rem;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 .section-text {
|
||||||
|
font-style: italic;
|
||||||
|
font-size: 1em;
|
||||||
|
font-weight: normal;
|
||||||
|
margin: 0 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: baseline;
|
||||||
|
|
||||||
|
margin-left: 0.5em;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.word {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.word.space-after { margin-right: 0.5em; }
|
||||||
|
.word.no-chord { align-self: flex-end; }
|
||||||
|
|
||||||
|
.lyric {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chord {
|
||||||
|
font-style: italic;
|
||||||
|
font-weight: 500;
|
||||||
|
margin-right: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chord .flavor {
|
.chord .flavor {
|
||||||
@ -191,6 +285,7 @@ proc toHtml(ctx: var FormatContext, node: ChordChartNode, indent: string): strin
|
|||||||
result &= "<span class='word"
|
result &= "<span class='word"
|
||||||
#if node.spaceBefore: result&=" space-before"
|
#if node.spaceBefore: result&=" space-before"
|
||||||
if node.spaceAfter: result&=" space-after"
|
if node.spaceAfter: result&=" space-after"
|
||||||
|
if node.chord.isNone: result&=" no-chord"
|
||||||
result &= "'>"
|
result &= "'>"
|
||||||
|
|
||||||
if node.chord.isSome:
|
if node.chord.isSome:
|
||||||
@ -254,7 +349,7 @@ proc toHtml*(
|
|||||||
result = """<!doctype html>
|
result = """<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>""" & cc.metadata.title & "</title>\p"
|
<title>""" & cc.metadata.title & " — " & $ctx.currentKey & "</title>\p"
|
||||||
|
|
||||||
for ss in stylesheets:
|
for ss in stylesheets:
|
||||||
if ss.startsWith("<style>"): result &= ss
|
if ss.startsWith("<style>"): result &= ss
|
||||||
|
Loading…
x
Reference in New Issue
Block a user