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

Improve format of gabc output #905

Closed
rpspringuel opened this issue Feb 11, 2016 · 6 comments
Closed

Improve format of gabc output #905

rpspringuel opened this issue Feb 11, 2016 · 6 comments
Assignees
Milestone

Comments

@rpspringuel
Copy link
Contributor

While they don't mean anything to the program, line breaks are extremely useful to making a gabc file more human readable (especially when studying diffs). I thus propose that when generating gabc output the command line tool insert a few.

Off hand I would say that a line break should be introduced after bar syllables and after a explicit line break indication (i.e. a z or Z, with its modifiers) in the score.

@eroux
Copy link
Contributor

eroux commented Feb 11, 2016

Good idea yes

@eroux eroux added this to the 5.0 milestone Feb 11, 2016
@eschwab
Copy link
Contributor

eschwab commented Feb 12, 2016

I tried to do something but ran into a difficulty.

diff --git a/src/gabc/gabc-write.c b/src/gabc/gabc-write.c
index 46ac340..65280ad 100644
--- a/src/gabc/gabc-write.c
+++ b/src/gabc/gabc-write.c
@@ -1034,7 +1034,13 @@ static void gabc_write_gregorio_syllable(FILE *f, gregorio_syllable *syllable,
     {
         fprintf(f, ") ");
     } else {
-        fprintf(f, ")");
+        if (syllable->elements[0]->type == GRE_BAR
+            || syllable->elements[0]->type == GRE_END_OF_LINE)
+        {
+            fprintf(f, ")\n");
+        } else {
+            fprintf(f, ")");
+        }
     }
 }

The if is always returning false and I presume that this is a type mismatch between the elements of the comparison. I am not really sure how to fix that. Also this may be too simple of a solution and it possibly would be better to have a function handle writing the ). Not sure.

@henryso
Copy link
Contributor

henryso commented Feb 12, 2016

You are putting the check in the place which catches the middle of syllables. The chance of there being a bar or end of line there is pretty low. People don't typically put stuff like syl(:)lab(z)le(g), and, in fact, putting a newline there would be a bad idea, as it would end the syllable in the wrong place. You want to do the check in the previous clause, that prints ") ". You probably also want to check more than just the first element in the syllable. Perhaps gabc_write_gregorio_elements can return whether it detected a bar or newline.

eschwab added a commit to eschwab/gregorio that referenced this issue Feb 13, 2016
After bar syllables and manual linebreaks.
@eschwab
Copy link
Contributor

eschwab commented Feb 13, 2016

I have something that seems to be working for me. I'm fine with holding it until after the feature freeze of 4.1 is made. Unless we want this in 4.1.

@henryso
Copy link
Contributor

henryso commented Feb 13, 2016

If this is what you have in 1824d90, I don't object to this being merged now.

@eroux
Copy link
Contributor

eroux commented Feb 13, 2016

Ok for me too

eschwab added a commit to eschwab/gregorio that referenced this issue Feb 13, 2016
eschwab added a commit to eschwab/gregorio that referenced this issue Feb 13, 2016
After bar syllables and manual linebreaks.
@henryso henryso modified the milestones: 4.1, 5.0 Feb 14, 2016
@henryso henryso closed this as completed Feb 14, 2016
rpspringuel added a commit to rpspringuel/gregorio that referenced this issue Feb 15, 2016
* develop:
  Resolve conflict.
  Fix gregorio-project#905: Add linebreaks to gabc output.
  Update CHANGELOG for fixing gregorio-project#905.
  Fix gregorio-project#905: Add linebreaks to gabc output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants