commit 29211b1c1663048aed7a0c35102c8f35b678a489
parent 7defa608e1cbc4b8dcdf26a25181ddc9d3e9d3da
Author: nibo <nibo@relim.de>
Date: Sat, 14 Sep 2024 16:16:26 +0200
parser: Add style to metadata item 'subtitle'
The subtitles style can only be changed via the config file.
Diffstat:
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/chordpro.c b/chordpro.c
@@ -707,6 +707,9 @@ struct Style *cho_style_new_from_config(enum SongFragmentType ftype)
case SF_TITLE:
printable_item = config_printable_item_get(g_config->output->printable_items, "title");
return cho_style_duplicate(printable_item->style);
+ case SF_SUBTITLE:
+ printable_item = config_printable_item_get(g_config->output->printable_items, "subtitle");
+ return cho_style_duplicate(printable_item->style);
default:
printable_item = config_printable_item_get(g_config->output->printable_items, "text");
return cho_style_duplicate(printable_item->style);
@@ -2387,6 +2390,11 @@ struct ChoSong **cho_songs_parse(FILE *fp, struct Config *config)
g_current_ftype = SF_TITLE;
songs[so]->metadata[m]->style = cho_style_new_default();
g_current_ftype = g_prev_ftype;
+ } else if (strcmp(directive_name, "subtitle") == 0) {
+ g_prev_ftype = g_current_ftype;
+ g_current_ftype = SF_SUBTITLE;
+ songs[so]->metadata[m]->style = cho_style_new_default();
+ g_current_ftype = g_prev_ftype;
}
m++;
}
@@ -2939,6 +2947,8 @@ static const char *cho_debug_the_song_fragment_type(enum SongFragmentType ftype)
return "SF_TEXT";
case SF_TITLE:
return "SF_TITLE";
+ case SF_SUBTITLE:
+ return "SF_SUBTITLE";
case SF_LABEL:
return "SF_LABEL";
}
diff --git a/chordpro.h b/chordpro.h
@@ -115,6 +115,7 @@ enum SongFragmentType {
SF_TOC,
SF_TEXT,
SF_TITLE,
+ SF_SUBTITLE,
SF_LABEL
};