commit 69e439cf4aa92e3f2d1e5cdf4023bbe1f06e67b4
parent b3a116831e8abf8553f93971fa94b755a6b51504
Author: nibo <nibo@relim.de>
Date: Thu, 15 Aug 2024 03:09:09 +0200
Prefix comments with 'INFO: '
Diffstat:
5 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/chordpro.c b/chordpro.c
@@ -110,7 +110,7 @@ static const char *chord_extensions_major[] = {
};
static const char *chord_extensions_minor[] = {
- // https://www.chordpro.org/beta/chordpro-chords/#extensions-for-minor-chords
+ // INFO: https://www.chordpro.org/beta/chordpro-chords/#extensions-for-minor-chords
"#5",
"#5",
"m11",
@@ -119,7 +119,7 @@ static const char *chord_extensions_minor[] = {
"-6",
"m69",
"-69",
- "m7b5", // same as 'h7'
+ "m7b5",
"-7b5",
"m7-5",
"-7-5",
@@ -141,7 +141,7 @@ static const char *chord_extensions_minor[] = {
"-sus4", "-sus9",
"m7sus4",
"-7sus4",
- // custom
+ // INFO: custom
"m7",
"m9",
"m",
@@ -2008,7 +2008,7 @@ struct ChoSong **cho_songs_parse(FILE *fp, struct Config *config)
}
if (buf == '\n') {
if (prev_buf == '\\') {
- // This will later overwrite the backslash
+ // INFO: This will later overwrite the backslash
te--;
break;
}
@@ -2123,7 +2123,7 @@ struct ChoSong **cho_songs_parse(FILE *fp, struct Config *config)
fprintf(stderr, "WARN: Formatting directive '%s' has no value.\n", directive_name);
break;
case DT_PREAMBLE:
- // The only preamble directive is 'new_song'
+ // INFO: The only preamble directive is 'new_song'
cho_line_item_free(songs[so]->sections[se]->lines[li]->lyrics[ly]);
free(songs[so]->sections[se]->lines[li]->lyrics);
free(songs[so]->sections[se]->lines[li]);
@@ -2152,7 +2152,6 @@ struct ChoSong **cho_songs_parse(FILE *fp, struct Config *config)
songs[so]->sections[se]->lines[li]->lyrics[ly] = cho_line_item_new();
break;
case DT_FONT:
- // Reset to default
sprop.ftype = directive->ftype;
sprop.type = directive->sprop;
switch (directive->sprop) {
@@ -2524,7 +2523,7 @@ struct ChoSong **cho_songs_parse(FILE *fp, struct Config *config)
tags = realloc(tags, (ta+1) * sizeof(struct Tag *));
tags[ta] = cho_tag_new();
state = STATE_MARKUP_TAG_BEGIN;
- // If we don't use 'goto' we loose the first character of the begin tag name
+ // INFO: If we don't use 'goto' we loose the first character of the begin tag name
goto MARKUP_TAG_BEGIN;
case STATE_MARKUP_TAG_END:
if (buf == '>') {
diff --git a/chordpro.h b/chordpro.h
@@ -1,16 +1,14 @@
#include "config.h"
-/* ChordPro markup language <https://chordpro.org/chordpro/chordpro_markup> */
#ifndef _CHORDPRO_H_
#define _CHORDPRO_H_
#define LENGTH(x) (sizeof x / sizeof x[0])
-// #define RISE_MAX
#define EMPTY -1.0
#define DEFAULT_FONT_SIZE 14.0
#define DEFAULT_TITLE_FONT_SIZE 18.0
-// Based on https://stackoverflow.com/a/417184
+// INFO: Based on https://stackoverflow.com/a/417184
#define URL_MAX_LEN 2000
#define FONT_NAME_MAX 100
diff --git a/out_pdf.c b/out_pdf.c
@@ -973,7 +973,7 @@ static bool annots_create(pdfio_file_t *pdf, pdfio_array_t *annots, struct Text
static bool out_pdf_set_title(pdfio_file_t *pdf, struct ChoSong **songs)
{
- // Set pdf title only if single song exist
+ // INFO: Set pdf title only if single song exist
if (songs[0] && !songs[1]) {
const char *title;
title = cho_metadata_get(songs[0]->metadata, "title");
diff --git a/out_pdf.h b/out_pdf.h
@@ -3,6 +3,7 @@
#define MEDIABOX_HEIGHT 878.0
#define MEDIABOX_WIDTH 631.0
#define VERTICAL_MARGIN 40.0
+#define MARGIN_BOTTOM 180.0
#define PADDING 80.0
#define LINE_LEN MEDIABOX_WIDTH - PADDING * 2
#define MIN_CHORD_GAP_WIDTH 5.0
diff --git a/todo b/todo
@@ -10,14 +10,12 @@ chords
define chords
chord diagrams
strict and relaxed parsing makes no difference!?
-introduce parse errors: make parser bulletproof
- still very unclear to me when the parser should warn
- and continue execution and when it should fail and
- stop execution
+make parser bulletproof
+ should it just parse valid input correctly
+ and crash on invalid input?
*_to_string functions sometimes return stringified enum and sometimes config value
allow {start_of_*},{end_of_*} custom directives
parse environment directive value when: label="Verse 1"
# pdf output
break lines when too long
-create a new page when text too long