Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Ukedown" markdown for ukebook #1

Open
smudgefarrier opened this issue Jul 16, 2017 · 8 comments
Open

"Ukedown" markdown for ukebook #1

smudgefarrier opened this issue Jul 16, 2017 · 8 comments

Comments

@smudgefarrier
Copy link

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):

  • "\([A-Z][a-z0-9#]*\)" is a chord like (C) or (F#sus4), will allow things like (C-G-C) or (Am - Single strum) or (C///). Will automatically add the chord diagrams.
  • "\[[A-Za-z0-9_]+\]" is a label like [intro], will allow things like [intro - repeat 4 times]
  • "x[0-9]+ repeats like x2 formatted in bold italics
  • "^|" to draw a box around a stanza (like a chorus to repeat later).
  • Not a box but has this, "|" to indicates barlines.
  • Not a chord but matches "([A-Za-z0-9_ ]+) a second voice

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
Copy link

lanky commented Jul 19, 2017

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
Copy link
Author

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
Copy link
Author

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
Copy link
Owner

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

  • You probably want to add \+ in your chord regex to catch augmented chords.
  • I'm worried about overloading the pipe character like this - how will this behave if you want to start a line in a repeat box with a barline? I mean it's unlikely to happen in reality, but it's more important that if someone tries to do it this doesn't bork the whole page.

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
Copy link

lanky commented Jul 24, 2017

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

@lanky
Copy link

lanky commented Jul 24, 2017

@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
Copy link
Author

@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
Copy link
Author

smudgefarrier commented Jul 27, 2017

@lanky you can see the first public commit at e068e2b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants