birdcolour / Ukebook

A project to make writing, compiling, editing and distributing ukulele songbooks to groups of people much easier.
GNU General Public License v3.0
4 stars 0 forks source link

"Ukedown" markdown for ukebook #1

Open smudgefarrier opened 7 years ago

smudgefarrier commented 7 years ago

Hi,

I'm suggesting we introduce a simple markdown-esque method for submitting ukulele songs - "Ukedown". Submitting songs in word (or odt) is heavyweight and feature rich, whereas what we really want is the right features to keep transcribed songs readable and simple for all, and to format it easily for different outputs (whether traditional pdf or small screen phones) without requiring submitters to tailor their submissions for all output formats and devices. I expect this to make it simpler for everyone to submit songs, and make tracking of diffs, comments, and alternations easier.

I'm going to start on doing this, might as well get things moving. I'm sharing this to give others visibility, and to see if anything thinks this is a bad idea, has suggestions or better alternatives, etc.

My first milestone is to have a simple javascript convertor for a textarea with css to match the current song book format. It should be mostly copy paste existing songs to port them over. Basic ukedown is something like this (regexp made up just for example):

As an example (using a the boxed section because it won't be copy paste able and is a bit different).

|[chorus]
|(C) This is a boxed chor(Am)us
|(G) It spans multi(G)ple lines.

I expect this to produce html like:

<div class="boxed">
<p>
<span class="label">chorus</span><br />
<span class="chord">C</span> This is a boxed chor<span class="chord">Am</span>us<br />
<span class="chord">G</span> It spans multi<span class="chord">G</span>ple lines.<br />
</p>
</div>

With the stylesheet being like this:

.label {
    font-weight:bold;
}

.label:before {
    content: "[";
}

.label:after {
    content: "]";
}

.chord {
    font-weight:bold;
}

.chord:before {
    content: "(";
}

.chord:after {
    content: ")";
}

.boxed {
    border:1px solid black;
    padding-bottom:0.2em;
    margin-top: 1em;
    margin-bottom: 1em;
}

.boxed > p {
    margin-top: 0;
    margin-bottom:1em;
}

.boxed > p:last-child {
    margin-bottom:0;
}

Thanks in advance for any feedback, Mark

lanky commented 7 years ago

You're going to have fun distinguishing between chords and 'second voice' given that they're more or less the same in the current songbook format, but otherwise this looks great.

smudgefarrier commented 7 years ago

Thanks for the feedback, I'm hoping that most second voices don't start with uppercase A (only lowercase a), i.e. if it doesn't match this \(NC|([A-G][b#m]?([5679+]|sus[24]|maj7|dim7?|add9|aug)?) (that seems to cover most chords so far) it will be treated as a second voice. In the rare case they conflict, I'll add an explicit way to indicate a second voice instead of a chord (e.g. 2\([^)]+\)).

smudgefarrier commented 7 years ago

To keep others informed (although I'm not sure who is following this), significant progress has been made on this and it also now creates chord diagrams automatically using svg. Attached is a print out from chrome in both the London - Example.pdf and BUJ - Example.pdf formats.

birdcolour commented 7 years ago

This looks fantastic, great work! Only a couple of minor issues there for me on a few edge cases:

Also, how are the diagrams created/where are they pulled from? Being able to add custom chords (different voicings, funky jazz chords etc.) is definitely a must-have for me, since the alternative I have used has been to piece them together in MS paint...

lanky commented 7 years ago

@smudgefarrier - Are you hosting this on github also? you have no repositories here :)

lanky commented 7 years ago

@birdcolour @smudgefarrier - to catch that edge case, why not just use (more or less) standard markdown in that situation? ^|(.*)|$ -> while it's an edge case that someone might decide to put in pipe at the start or in the middle of a line, an entire line encapsulated by pipes should be considered a box or part of one.

smudgefarrier commented 7 years ago

@birdcolour I wondered what the difference between aug and +, was now I know there isn't one, thanks. The pipe causes no problems that you're worried about as I don't use regex for paragraphs and sections (these require something akin to real parsing). Chords, no plans to make it so users can add their own, but easy enough for dev using svg and will make it possible to use alternate fingerings. E.g.

            "A" : [
                [0,0,0,8,8],
                [1,0,1,0,0],
                [2,2,0,0,0],
            ],

@lanky only on my personal pc at the moment, not ready to share yet. Hopefully in less than a week.

smudgefarrier commented 7 years ago

@lanky you can see the first public commit at e068e2bd5b991bfd99270abd15259c40cd1ff410