> Why tilde is displayed? Wouldn't the simple answer not be: because XML is not TeX? dr. Hans van der Meer > On 21 Apr 2021, at 20:17, Jano Kula wrote: > > Dear list, > > first episode of series on nbsp of XML in lmtx. > Unfortunately, not that catchy as Netflix. > > Used XML input has two types of non-breakable space: > unicode character > html entitity (in fact an ugly output of HTML editor) > HTML is preprocessed with ctx preprocessor (great feature!) and substituted for unicode char nbsp or tilde. > > MWE shows unichar spaces are non-breakable (see end of the first lines), however they are not stretchable (see second line of the paragraphs). > > Does unicode nbsp have fixed with in ctx? > > When tilde is the replacement in preprocessor (uncomment first replacement in preprocessor), xmlfush will display tilde (which is, as character, non-breakable and unstretchable, no surprise). > > Why tilde is displayed? > > Replacing or adding nbsp (tilde) with finalizers have different results, see next episode after this one is understood. > > Thank you, > Jano > > MWE (rather use attached file not to loose invisible characters): > > \startbuffer[doc] > > >

Temperature 20 °C 20 °C 20 °C 20 °C average.

>

Altitude 6000 m 6000 m 6000 m 6000 m average.

>
> \stopbuffer > > \startluacode > function lxml.preprocessor(data) > -- data = string.gsub(data, " ", "~") > -- replacement nbsp invisible in luacode > data = string.gsub(data, " ", " ") > return data > end > \stopluacode > > > \startxmlsetups xml:name > \xmlsetsetup{\xmldocument}{*}{-} > \xmlsetsetup{\xmldocument}{document|p}{xml:name:*} > \stopxmlsetups > \xmlregistersetup{xml:name} > > \startxmlsetups xml:name:document > \xmlflush{#1}\par > \stopxmlsetups > > \startxmlsetups xml:name:p > \parfillskip0pt\xmlflush{#1}\par > \stopxmlsetups > > \startTEXpage[offset=5mm,width=60mm] > \xmlprocessbuffer{xml:name}{doc}{} > \stopTEXpage > ___________________________________________________________________________________ > If your question is of interest to others as well, please add an entry to the Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___________________________________________________________________________________