Closed egli closed 6 years ago
I've found the problem. I'm not sure whether or not to blame the Web UI though.
The regex is defined here (i.e. the same snippet as yours above): https://github.com/daisy/pipeline-mod-braille/blob/51d8a1321ae6503ba988c4a1e716fe918b3d3b39/pipeline-braille-utils/common-utils/src/main/resources/xml/data-types/transform-query.xml#L17
In the regex, the :
is escaped as \:
. This is not necessary, and when used on a pattern attribute in a modern web browser, it will give an error. I believe it is the same error as is described here: https://www.fxsitecompat.com/en-CA/docs/2016/input-pattern-now-sets-u-flag-for-regular-expressions/ which says that the error is because ECMAScript 6 does not allow any arbitrary character to be escaped: https://tc39.github.io/ecma262/#sec-regexp-regular-expression-objects
It's weird though; I can create a Javascript regex object with p = /.../;
without getting any errors, but when I put it in a <input pattern="..."/>
, I get the regex validation error in the console. Anyhoo...
Instead of the Web UI trying to clean up regexes, I suggest that regexes should not contain escaped characters that doesn't need to be escaped. So instead we should fix the regex in the braille common-utils.
@bertfrees @egli what do you think?
Cool. Yeah I guess we can remove the backslash.
Closing this as we're not doing anything about it in the Web UI.
I'm running the pipeline and the webui using the latest docker images with docker-compose. Basically I just run docker-compose up with https://github.com/daisy/pipeline-webui/blob/feature/dockercompose/docker-compose.yml
When I try to run the DTBook to PEF script I get a warning from the UI that the Transformer query field is not valid and consequently I cannot submit my job.
it contains
(translator:liblouis)(formatter:dotify)
(the default basically). That seems to be correct.@bertfrees says that it should match the following regexp:
^\s*(\(\s*[_a-zA-Z][_a-zA-Z0-9-]*(\s*\:\s*([_a-zA-Z][_a-zA-Z0-9-]*|'[^']*'|"[^"]*"|0|-?[1-9][0-9]*))?\s*\)\s*)*$
According to Bert the following info is also relevant:
This seems to indicate that the problem is not with the pipeline but rather as @bertfrees says
Any ideas?