Hello. I have a tag <quotation-mark-open>
and <quotation-mark-close>
dynamically added by my pollen.rkt file around dialog lines from my novel.
I want those tags to contain quotation marks depending on the value of their nearest parent having a special attribute like formatting-style="default"
and formatting-style="fr/FR"
.
With default
, it adds english style double quotes (“
/”
). With fr/FR
, it simply adds nothing (the tag may be removed entirely then).
The current structure is like this:
<book-body formatting-style="fr/FR">
<p-dial>
<body-voice>
<quotation-mark-open></quotation-mark-open>
Ligne de dialogue en style français,
<quotation-mark-close></quotation-mark-close>
</body-voice>
dit Michel.
</p-dial>
<p-dial>
<body-voice>
<quotation-mark-open></quotation-mark-open>
Deuxième ligne,
<quotation-mark-close></quotation-mark-close>
</body-voice>
répond Jean.
</p-dial>
</book>
<book-body formatting-style="default">
<p-dial>
<body-voice>
<quotation-mark-open></quotation-mark-open>
English-styled dialog line here.
<quotation-mark-close></quotation-mark-close>
</body-voice>
said Michael.
</p-dial>
</book>
and should give something like this:
« Ligne de dialogue en style français, dit Michel.
— Deuxième ligne, répond Jean. »
“English-styled dialog line here.” said Michael.
I have not found means to read the parents when processing the body-voice tag (I’m using define-tag-function
).
I have tried to implement a pollen decode function, but I’m not good enough in racket yet to make my own. Is it the right way to achieve the desired effect, though?
Note 1: I can solve my issue with CSS, but having the quotation marks stripped from the real text doesn’t seem the best for accessibility, and would work only with the help of a web page renderer.
Note 2: You may notice the full dash at the start of the second french line. This is also something I want to learn to make programmatically, as it appears only from the second line and replaces the quotation mark.