Hi Peter,
I can reproduce this, and I did a few additional tests (please see the
MWE attached).
With
|\enabletrackers[typesetters.spacing]
\setcharacterspacing[frenchpunctuation]|
the log shows things such as:
|inserting penalty and space after « inserting penalty and space before
» inserting penalty and space before ! inserting penalty and space
before ? inserting penalty and space before ;|
If ordinary spaces are already present in the source, ConTeXt first
removes them and then inserts the penalty and spacing.
I then compared five cases:
1.
|frenchpunctuation|, with no spaces in the input
2.
|frenchpunctuation|, with ordinary spaces in the input
3.
explicit U+00A0 NO-BREAK SPACE
4.
explicit U+202F NARROW NO-BREAK SPACE
5.
|~|
The raw XML export and the generated HTML give the same result:
|frenchpunctuation -> U+0020 explicit U+00A0 -> U+00A0 explicit U+202F
-> U+202F ~ -> U+00A0|
So the non-breaking behaviour introduced by |frenchpunctuation|appears
to exist only at the typesetting/node-list level: ConTeXt inserts a
penalty plus glue for the PDF, but the exporter serializes that spacing
as an ordinary U+0020 space.
The loss therefore already occurs in the raw XML export, before the
XML-to-HTML conversion.
As a workaround, explicit U+00A0, U+202F, or |~|survive the export, but
of course that rather defeats the purpose of using
|\setcharacterspacing[frenchpunctuation]|automatically.
Perhaps Hans can say whether the exporter is expected to map this
particular penalty+glue combination to U+00A0 or U+202F, or whether some
export-specific setup is required.
Best,
JP
Le 03/10/2026 à 10:29, Peter Münster a écrit :
Hi,
When compiling this test file:
\setupbackend[export=yes]
\setcharacterspacing[frenchpunctuation]
\starttext
«citation» exclamation! question? point virgule;
\stoptext
I get non-breaking spaces in the PDF output, but not in the HTML file.
How can I get non-breaking spaces also in the HTML export please?
TIA for any help,
\setupbackend[export=yes]
\enabletrackers[typesetters.spacing]
\setcharacterspacing[frenchpunctuation]
\starttext
AUTO:
«citation» exclamation! question? point virgule;
\blank
AUTO WITH ORDINARY SPACES:
« citation » exclamation ! question ? point virgule ;
\blank
{\resetcharacterspacing
NBSP U+00A0:
«\char"00A0\relax citation\char"00A0\relax»
exclamation\char"00A0\relax!
question\char"00A0\relax?
point virgule\char"00A0\relax;
}
\blank
{\resetcharacterspacing
NARROW NBSP U+202F:
«\char"202F\relax citation\char"202F\relax»
exclamation\char"202F\relax!
question\char"202F\relax?
point virgule\char"202F\relax;
}
\blank
{\resetcharacterspacing
TILDE:
«~citation~»
exclamation~!
question~?
point virgule~;
}
\stoptext
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________