ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Taco Hoekwater <taco@bittext.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: nbsp in XML (S01E01)
Date: Thu, 22 Apr 2021 08:02:59 +0200	[thread overview]
Message-ID: <999726CD-F5FE-4A27-A2ED-872F86D98831@bittext.nl> (raw)
In-Reply-To: <CAPefzZ2hRPaPdHq_CH4PXM1fnqmT-2+kAb7Jwt7F6oAj_GjOAw@mail.gmail.com>

Hi,


> On 21 Apr 2021, at 23:09, Jano Kula <jano.kula@gmail.com> wrote:
> 
> On Wed, Apr 21, 2021 at 8:37 PM Hans van der Meer <havdmeer@ziggo.nl> wrote:
>> Why tilde is displayed?
> 
> Wouldn't the simple answer not be: because XML is not TeX?

You are never going back to “TeX mode”: the preprocessor converts XML into *other* XML. 
And tilde in XML is just that: the ascii tilde glyph.

> 
> I still would expect unicode nbsp to be expandable, 

I agree with that, but for fine-tuning XML output I would use a trick like this:

\startluacode
function lxml.preprocessor(data)
    return string.gsub(data, "&amp;nbsp;", "<nbsp/>")
end
\stopluacode

\startxmlsetups xml:name
    ...
    \xmlsetsetup{\xmldocument}{document|nbsp}{xml:name:*}
\stopxmlsetups

\startxmlsetups xml:name:nbsp
    \penalty10000\hskip .3em plus 2em % or something, just a wild example.
\stopxmlsetups

Using an xml element would also allow your code to ‘look around’ to make sure all is 
well with its (typesetting) environment.

Best wishes,
Taco

— 
Taco Hoekwater              E: taco@bittext.nl
genderfluid (all pronouns)



___________________________________________________________________________________
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
___________________________________________________________________________________

  parent reply	other threads:[~2021-04-22  6:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21 18:17 Jano Kula
2021-04-21 18:37 ` Hans van der Meer
2021-04-21 21:09   ` Jano Kula
2021-04-21 21:17     ` denis.maier
2021-04-22  6:02     ` Taco Hoekwater [this message]
2021-04-21 21:28 ` mf
2021-04-22  9:36 ` Hans Hagen
2021-04-23 18:01   ` Jano Kula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=999726CD-F5FE-4A27-A2ED-872F86D98831@bittext.nl \
    --to=taco@bittext.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).