ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Jano Kula <jano.kula@gmail.com>
To: Hans Hagen <j.hagen@xs4all.nl>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: nbsp in XML (S01E01)
Date: Fri, 23 Apr 2021 20:01:43 +0200	[thread overview]
Message-ID: <CAPefzZ2cHaEz1X8-uQhSWOfKLQ_Emw9J_XPESFVTH0gKzcvs+A@mail.gmail.com> (raw)
In-Reply-To: <4e3e53ba-c42b-f4c1-5a24-d569e662dc2d@xs4all.nl>


[-- Attachment #1.1: Type: text/plain, Size: 1570 bytes --]

Hello,

the first episode was more dramatic than expected, seem to be a good series.

On Thu, Apr 22, 2021 at 11:36 AM Hans Hagen <j.hagen@xs4all.nl> wrote:

> On 4/21/2021 8:17 PM, Jano Kula wrote:
>
> > Does unicode nbsp have fixed with in ctx?
>
> sometimes ... but you just uncovered an old bug
>      if attr >= 1 or attr <= 3 then -- flushright
> someplace should be
>      if attr >= 1 and attr <= 3 then -- flushright


After the patch, nbsp is working as expected.

On Thu, Apr 22, 2021 at 8:03 AM Taco Hoekwater <taco@bittext.nl> wrote:

the preprocessor converts XML into *other* XML.


Useful information, thanks, wikified.

And tilde in XML is just that: the ascii tilde glyph.


Yep, but \xmlfilter can process them nicely. See some next episode.


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


It didn't occur to me to change it by preprocessor to the new xml elements.
You are right, one can even have more control.

Thank you all for your help,
Jano

And thanks for watching!

[-- Attachment #1.2: Type: text/html, Size: 3090 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

      reply	other threads:[~2021-04-23 18:01 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
2021-04-21 21:28 ` mf
2021-04-22  9:36 ` Hans Hagen
2021-04-23 18:01   ` Jano Kula [this message]

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=CAPefzZ2cHaEz1X8-uQhSWOfKLQ_Emw9J_XPESFVTH0gKzcvs+A@mail.gmail.com \
    --to=jano.kula@gmail.com \
    --cc=j.hagen@xs4all.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).