hitontology / gui

Erneuerung der Benutzungsoberflächen von HITO
https://hitontology.github.io/gui/
MIT License
0 stars 0 forks source link

refactor preprocessing from regex to XSLT #55

Closed KonradHoeffner closed 4 months ago

KonradHoeffner commented 5 months ago

Easier to maintain, more powerful and better suited for the task.

Yagnap commented 5 months ago

The version pushed is currently untested. Also, I don't know how to do preprocessing step 3, copying the first coordinate of the arrow head and make it the last coordinate of the arrow body.

KonradHoeffner commented 5 months ago

I will look into it today! (update: probably tomorrow)

KonradHoeffner commented 4 months ago

@Yagnap: Sorry for the delay, I will look at it now.

KonradHoeffner commented 4 months ago

Why use XSLT version 1 from 1999? I suggest using the newest XSLT version 3 from 2017.

Yagnap commented 4 months ago

Sounds good, if I read that correctly this would also solve our regex issue, as I believe XSLTv2+ supports regexes

KonradHoeffner commented 4 months ago

How do you validate and execute the XSLT file? I tried gui$ xsltproc scripts/preprocessing.xsl img/tmp.svg -o img/test.svg but I get:

gui$ xsltproc scripts/preprocessing.xsl img/tmp.svg -o img/test.svg                                          redesign
scripts/preprocessing.xsl:8: parser error : XML declaration allowed only at the start of the document
        <?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" 
             ^
scripts/preprocessing.xsl:35: parser error : Opening and ending tag mismatch: svg line 8 and xsl:template
    </xsl:template>
                   ^
scripts/preprocessing.xsl:36: parser error : Opening and ending tag mismatch: template line 6 and transform
</xsl:transform>
                ^
cannot parse scripts/preprocessing.xsl
KonradHoeffner commented 4 months ago

Ugh, I got a merge conflict but my changes weren't much so I am reverting it to get on the same state as you. I've just added auto formating to the XSLT file with the "npm run fmt" script so we get less conflicts in the future, however I advise pulling this in as soon as possible because the reformating can cause merge conflicts right now.

KonradHoeffner commented 4 months ago

I will continue this today.

KonradHoeffner commented 4 months ago

You can now start the preprocessing with node node/preprocess.js after npm update to get the new developer dependencies. The XSLT itself still needs to be expanded.

KonradHoeffner commented 4 months ago

Steps

@Yagnap: Do we actually need the y="5" for the generic defs?