Skip to content

Commit

Permalink
Fix otlabel and ntlabel positions in graphviz-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
kovzol committed Jan 6, 2025
1 parent a1f8edd commit 687e27d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions statements/pbrst.y
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,26 @@ void create_diagram() {
}
}
strcat(D, ";\n");
// Ensure that the otlabel precedes the first OT node:
if (ot_blocks_ns[ob]>0) {
int covering_col = ot_blocks[ob][0][0]; // TODO: not elegant, merge with previous section
int fragment = ot_coverings[ob][covering_col];
strcat(D, " otlabel");
sprintf(intbuffer, "%d", ob+1); // OT headline number
strcat(D, intbuffer);
strcat(D, "->");
if (fragment == 0) {
strcat(D, "u");
sprintf(intbuffer, "%d", ob+1);
strcat(D, intbuffer);
strcat(D, "_0");
} else { // fragment != 0
strcat(D, "i");
sprintf(intbuffer, "%d", fragment); // interval number
strcat(D, intbuffer);
}
strcat(D, " [style=invisible];\n");
}
strcat(D, " }\n"); // Finish subgraph.
}

Expand Down Expand Up @@ -1154,6 +1174,11 @@ void create_diagram() {
strcat(D, intbuffer);
}
strcat(D, ";\n");
// Ensure that the ntlabel precedes the first NT node:
if (nt_blocks_n>0) {
strcat(D, " ntlabel->nt0 [style=invisible];\n");
}

strcat(D, " }\n"); // Finish subgraph.
strcat(D, refs); // Add references (outside the subgraphs).
// Set up hierarchy between NT headline and OT headlines with invisible edges:
Expand Down

0 comments on commit 687e27d

Please sign in to comment.