lorid

convert chordpro to pdf
git clone git://git.relim.de/lorid.git
Log | Files | Refs | README | LICENSE

commit 3ce365133219e9025c90596656edf33f37289563
parent bc18e8c019758420021bc718a4b4b88bec9d3fd0
Author: nibo <nibo@relim.de>
Date:   Tue, 25 Mar 2025 13:03:55 +0100

Reorder some properties

Diffstat:
MREADME.md | 8++++++++
Mlorid_config.5 | 74+++++++++++++++++++++++++++++++++++++-------------------------------------
Msrc/config.c | 37+++++++++++++++++++------------------
Msrc/core.h | 2+-
4 files changed, 65 insertions(+), 56 deletions(-)

diff --git a/README.md b/README.md @@ -79,6 +79,14 @@ make make install ``` +## Usage + +``` +[~] lorid swing-low-sweet-chariot.cho +[~] zathura swing-low-sweet-chariot.pdf +[~] # start to play and sing... +``` + ## Documentation ``` diff --git a/lorid_config.5 b/lorid_config.5 @@ -75,47 +75,24 @@ start_song_on_new_page = Boolean Every song starts at the top of the page. .RE -.SS [output.page_no] - -At the bottom of every page a page number can be shown. - -Page numbers that belong to pages of the table of contents will be shown in the roman numeral system (I, II, III). - -Page numbers that belong to pages that show songs will be shown in the western arabic numeral system (1, 2, 3). - -show = Boolean - -=> default value: true - -.RS 4 -Control whether to show a page number at the bottom of every page. -.RE +.SS [output.chorus] -alignment = String +This section controls the output of the {chorus} directive. -=> allowed values: "left", "center", "right" +label = String -=> default value: "center" +=> default value: "Chorus" .RS 4 -This controls the page number's alignment. +If you didn't specify a directive label this is the default label text. .RE -.SS [output.toc] -show = Boolean +quote = Boolean => default value: false .RS 4 -Control whether to show the table of contents. -.RE - -title = String - -=> default value: "Table Of Contents" - -.RS 4 -The specified string will be shown centered and above the table of contents. +Control whether to print the last previously defined chorus. .RE .SS [output.chord_diagram] @@ -146,24 +123,47 @@ Predefined ukulele chord diagrams have also four frets. In case of "keyboard" the chord diagram shows part of a fingerboard. .RE -.SS [output.chorus] +.SS [output.page_no] -This section controls the output of the {chorus} directive. +At the bottom of every page a page number can be shown. -label = String +Page numbers that belong to pages of the table of contents will be shown in the roman numeral system (I, II, III). -=> default value: "Chorus" +Page numbers that belong to pages that show songs will be shown in the western arabic numeral system (1, 2, 3). + +show = Boolean + +=> default value: true .RS 4 -If you didn't specify a directive label this is the default label text. +Control whether to show a page number at the bottom of every page. .RE -quote = Boolean +alignment = String + +=> allowed values: "left", "center", "right" + +=> default value: "center" + +.RS 4 +This controls the page number's alignment. +.RE + +.SS [output.toc] +show = Boolean => default value: false .RS 4 -Control whether to print the last previously defined chorus. +Control whether to show the table of contents. +.RE + +title = String + +=> default value: "Table Of Contents" + +.RS 4 +The specified string will be shown centered and above the table of contents. .RE .SS [output.styles] diff --git a/src/config.c b/src/config.c @@ -426,10 +426,17 @@ config_load_default(void) { struct Config *config = emalloc(sizeof(struct Config)); config->metadata_separator = strdup("; "); + + config->parser = emalloc(sizeof(struct ConfigParser)); + config->parser->chords = emalloc(sizeof(struct ConfigChords)); + config->parser->chords->notation_system = NS_COMMON; + config->parser->chords->mode = PM_STRICT; + config->parser->notes = config_notes_new_default(NS_COMMON); + config->output = emalloc(sizeof(struct ConfigOutput)); - config->output->toc = emalloc(sizeof(struct ConfigToc)); - config->output->toc->show = false; - config->output->toc->title = strdup("Table Of Contents"); + config->output->notation_system = NS_COMMON; + config->output->start_song_on_new_page = true; + config->output->notes = config_notes_new_default(NS_COMMON); config->output->chorus = emalloc(sizeof(struct ConfigChorus)); config->output->chorus->label = strdup("Chorus"); config->output->chorus->quote = false; @@ -439,8 +446,9 @@ config_load_default(void) config->output->page_no = emalloc(sizeof(struct ConfigPageNo)); config->output->page_no->show = true; config->output->page_no->align = A_CENTER; - config->output->notation_system = NS_COMMON; - config->output->start_song_on_new_page = true; + config->output->toc = emalloc(sizeof(struct ConfigToc)); + config->output->toc->show = false; + config->output->toc->title = strdup("Table Of Contents"); config->output->styles[TT_CHORD] = cho_style_new(); config->output->styles[TT_CHORD]->font->name = strdup(DEFAULT_FONT); @@ -488,13 +496,6 @@ config_load_default(void) config->output->styles[TT_COMMENT_BOX] = cho_style_new(); config->output->styles[TT_COMMENT_BOX]->font->name = strdup(DEFAULT_FONT); config->output->styles[TT_COMMENT_BOX]->boxed = true; - - config->output->notes = config_notes_new_default(NS_COMMON); - config->parser = emalloc(sizeof(struct ConfigParser)); - config->parser->chords = emalloc(sizeof(struct ConfigChords)); - config->parser->chords->notation_system = NS_COMMON; - config->parser->chords->mode = PM_STRICT; - config->parser->notes = config_notes_new_default(NS_COMMON); return config; } @@ -519,18 +520,18 @@ config_print_default(void) printf("[output]\n"); printf("notation_system = \"%s\"\n", config_notation_system_to_config_string(config->output->notation_system)); printf("start_song_on_new_page = %s\n\n", config->output->start_song_on_new_page ? "true" : "false"); - printf("[output.toc]\n"); - printf("show = %s\n", config->output->toc->show ? "true" : "false"); - printf("title = \"%s\"\n\n", config->output->toc->title); - printf("[output.chord_diagram]\n"); - printf("show = %s\n", config->output->diagram->show ? "true" : "false"); - printf("instrument = \"%s\"\n\n", config_instrument_to_config_string(config->output->diagram->instrument)); printf("[output.chorus]\n"); printf("label = \"Chorus\"\n"); printf("quote = false\n\n"); + printf("[output.chord_diagram]\n"); + printf("show = %s\n", config->output->diagram->show ? "true" : "false"); + printf("instrument = \"%s\"\n\n", config_instrument_to_config_string(config->output->diagram->instrument)); printf("[output.page_no]\n"); printf("show = %s\n", config->output->page_no->show ? "true" : "false"); printf("alignment = \"%s\"\n\n", config_alignment_to_config_string(config->output->page_no->align)); + printf("[output.toc]\n"); + printf("show = %s\n", config->output->toc->show ? "true" : "false"); + printf("title = \"%s\"\n\n", config->output->toc->title); printf("[output.styles]\n"); int i; for (i = 1; i<TT_LENGTH; i++) { diff --git a/src/core.h b/src/core.h @@ -351,9 +351,9 @@ struct ConfigPageNo { struct ConfigOutput { struct ConfigChorus *chorus; - struct ConfigToc *toc; struct ConfigChordDiagram *diagram; struct ConfigPageNo *page_no; + struct ConfigToc *toc; struct ChoStyle *styles[TT_LENGTH]; struct Note **notes; enum NotationSystem notation_system;