jm-welch/PyChord

Document formatting tags

jm-welch opened this issue · 0 comments

Overview

General specification for recognizing document/formatting tags. Each tag should have its own feature description, as well.

Requirement

  • Identified by curly braces, {}
  • Support both short and long forms for tags: {title} = {t}
  • Tags containing text should follow a {tag: text} guideline. RegEx: /^[ \t]?\{(?P<tag>tag_id):[ \t]?(?P<text>tag_text)}/
  • In general, lines containing tags will be omitted from the song's output. Some positional/formatting tags (ex: {comment: Comment here}) will remain
  • Document-level tags should be stored separately from the song, to allow for song management features later
  • Document-level tags should be included in the output given by the str() method, formatted according to their own specifications

Some example tags:

Tag               Short  Type        Purpose
---------------   -----  ----        -------
title             t      document    Identify title of song
subtitle          st     document    Text to immediately follow the title
key               k      document    Document key and keep separate for management interface
start_of_chorus   soc    formatting  Signify start of chorus formatting block
end_of_chorus     eoc    formatting  End of chorus formatting block
comment           c      formatting  Non-lyric comment formatting block

Example

Sample input:

{title: Wild Rover}
{subtitle: trad.}

I've [1]been a wild rover for many a [4]year
And I [5]spent all my money on whiskey and [1]beer,
And [1]now I'm returning with gold in great [4]store
And I [5]never will play the wild rover no [1]more.

Sample output:

>> song.title
Wild Rover
>> song.subtitle
trad.
>> str(song)

Wild Rover
trad.

     1                            4
I've been a wild rover for many a year
      5                                 1
And I spent all my money on whiskey and beer,
    1                                    4
And now I'm returning with gold in great store
      5                                 1
And I never will play the wild rover no more.