You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A prerequisite to this bug is to fix the bug described in #35.
When the entities object is correctly passed to the WebVTTCueTextParser on line 177 as described in the issue above, there are some problems with parsing escape entities.
As you can see if the escape characters & are not followed by ; or the end of the string (undefined) but instead followed by another alphanumeric character, the escape characters are not properly parsed.
Solution
I believe some conditional logic needs to be updated or added in lines 632-670 to account for escape entities that are followed by an alphanumeric character.
The text was updated successfully, but these errors were encountered:
Looks like this is an issue with the parsing logic, along with the default entities list.
The default entities list includes no semicolons (presumably intended to allow more lenient parsing), so the current parsing logic for > yields >; rather than >. In addition, the intended lenient parsing also fails unless it happens to be at the end of the node, because the parser relies on hitting ";" or the end of the node to parse the entity.
I guess for many use cases the lenient parsing isn't necessary, so this can be worked around by instead passing a list of well-formed default entities to the constructor:
constraw='> < &'constbrokenParser=newWebVTTParser()brokenParser.parse(`WEBVTT\n\n00:00.000 --> 00:10.000\n${raw}\n`,'metadata').cues[0].tree.children[0].value// result: '>; <; &;'// same as default entities list but well-formedconstentities={'&': '&','<': '<','>': '>','‎': '\u200e','‏': '\u200f',' ': '\u00A0',}constfixedParser=newWebVTTParser(entities)fixedParser.parse(`WEBVTT\n\n00:00.000 --> 00:10.000\n${raw}\n`,'metadata').cues[0].tree.children[0].value// result: '> < &'
A prerequisite to this bug is to fix the bug described in #35.
When the entities object is correctly passed to the WebVTTCueTextParser on line 177 as described in the issue above, there are some problems with parsing escape entities.
Steps to Reproduce
As you can see if the escape characters
&
are not followed by;
or the end of the string (undefined) but instead followed by another alphanumeric character, the escape characters are not properly parsed.Solution
I believe some conditional logic needs to be updated or added in lines 632-670 to account for escape entities that are followed by an alphanumeric character.
The text was updated successfully, but these errors were encountered: