abc2svg
View Ticket
Not logged in
Ticket UUID: f632b51e4da81e3bd8292a30d078a5810488b878
Title: Broken rhythm doesn't work in web version
Status: Open Type: Code_Defect
Severity: Severe Priority: Immediate
Subsystem: Resolution: Open
Last Modified: 2021-01-27 09:45:39
Version Found In:
User Comments:
selfthinker added as text/plain on 2021-01-11 23:35:10:
When using abcweb-1.js and snd-1.js in a web page, broken rhythm doesn't work. The documentation says to use > instead of > in HTML, but that doesn't help and doesn't seem to change anything.

For example...

X:4
T:Test 4
K:C
C>D E>F G>A B>c|

... produces an odd construct with way too many notes and a few error messages.

Or this example (from the abcnotation.com website)...

X:1
T:Broken rhythm markers
M:C
K:C
A>A A2>A2 A>>A A2>>>A2|]

... (with or without >) produces only errors and no SVG.

moinejf added as text/x-fossil-plain on 2021-01-14 16:32:21:
Maybe the documentation is not clear.
There are 3 ways to include ABC in HTML with abcweb-1.js:

1) just put the ABC code mixed with the HTML code.
   In this case, the characters '<', '>' and '&' are modified by the HTML parser of the browser and translated to &gt;, &lt; and &amp;.
   To avoid this problem, the ABC code must be wrapped in a HTML comment (<!-- .. -->) inside the ABC code.
   Indeed, if there is '&gt;' in the ABC code, it is parsed as such, i.e. voice overlay '&', note 'g', bad character 't' and ignored character ';'.

2) wrap the ABC code in HTML elements of class "abc".
   In this case, the characters '<', '>' and '&' are still modified by the HTML browser, but the sequences &gt;, &lt; and &amp; are translated back to '<', '>' and '&' by abcweb-1.js before being given to the ABC parser.
   So, inside these HTML elements you may write '>' or '&gt;' for a same result.

3) wrap the ABC code in <script type="text/vnd.abc"> .. </script>.
   In this case, the browser does not change any character, nor does abcweb-1.js. The ABC code is given to the ABC parser as it has been written.

selfthinker added as text/plain on 2021-01-24 20:17:44:
Thanks for the response. I have an "abc" class around the code and it was still not working. I dug a bit deeper to try and find what the problem with my specific implementation is and found the issue.

This code works as it should:

<div class="abc">
X:4
T:Test 4
K:C
C&gt;D E&gt;F G&gt;A B&gt;c|
</div>

But as soon as there is another class it breaks:

<div class="abc other-class">
X:4
T:Test 4
K:C
C&gt;D E&gt;F G&gt;A B&gt;c|
</div>

moinejf added as text/x-fossil-plain on 2021-01-27 09:45:39:
This problem should be fixed by the commit [16278b1c38].
Thanks for the report.