From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/114177 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Wolfgang Schuster via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: XML, dealing with whitespace Date: Sat, 15 Jan 2022 20:28:00 +0100 Message-ID: References: <02468648b859479c9f5bbcce7001e88b@unibe.ch> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2312314249582802111==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20851"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 PostboxApp/7.0.54 Cc: Wolfgang Schuster To: mailing list for ConTeXt users , Denis Maier via ntg-context Original-X-From: ntg-context-bounces@ntg.nl Sat Jan 15 20:28:34 2022 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n8oj3-0005I6-VM for gctc-ntg-context-518@m.gmane-mx.org; Sat, 15 Jan 2022 20:28:33 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 1023B287C8C; Sat, 15 Jan 2022 20:28:07 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zEYFiWh9wL09; Sat, 15 Jan 2022 20:28:05 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 6E076282D18; Sat, 15 Jan 2022 20:28:05 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id C1ACB283A77 for ; Sat, 15 Jan 2022 20:28:03 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YwV-AqGpth9C for ; Sat, 15 Jan 2022 20:28:03 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.128.53; helo=mail-wm1-f53.google.com; envelope-from=wolfgang.schuster.lists@gmail.com; receiver= Original-Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id E1110280F62 for ; Sat, 15 Jan 2022 20:28:02 +0100 (CET) Original-Received: by mail-wm1-f53.google.com with SMTP id c66so12413906wma.5 for ; Sat, 15 Jan 2022 11:28:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=mADpyGmEOaLOKHut74ItypcmEjKXtyg9C9nNPn38Rhg=; b=Tw7SiX1lF/v96WsCPqq1gICbF1oKIjaoFWO8722VRu7vGfruLnGjub968ZluZGTQRr 1CnqF7HdZVgSwYtqdQKEIbn/KyWrwu9IR7P42X73wICMVyQgrn1oA551gZ1Zu/O0pKy/ eA25MivXZ7ghYqqB4N/n4Ue7CHAgCaq0RRGmkK3daeecIrbpac/7GTUoreaJOgBdwNYj f5Ln6xrxpZ8T4pOIOVx4qUvQYJApvGeM14weqpOpmbhiypQ/YlgEitmuBDY9v6ZTJupH MrrcDn1uT1xxML1vvvxAjXHWYVOZP3K+OB4iosmL0DWH/Hw/eKs1l32lcdkN1/curTm9 Df1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=mADpyGmEOaLOKHut74ItypcmEjKXtyg9C9nNPn38Rhg=; b=nEb7mh1cmqeAhh9+YSwYdG+6pSlTFBp7Z36jXcjbTOQHur5KcPlO++Jm1eb44V08y6 oDcZj1cWkeduZ+OZkDEoCqDmc5ubNbhjXlG59KJkU9zHsROmNWu9Ckj/MvQohv5OK32J l6pZ1hC9Kf1QoxDFmyOZXWd4jfT6/Vqu0AF1HBbBr++wTBJ7IjPbD8Qz8qz4A24pDskS 38uY60vVfXe08GKae5QlHg6OqBaMluuWKl0vtKx9M6Vz+EeET4h1+7QmB6Kvv0LM6s2+ yeTTkpvduQ71HGzi1BlYhzg3qXtT1r2FBDybH8mABHrxlDv+KpeWXbS5NKsqhocR5p52 QIQw== X-Gm-Message-State: AOAM530Z4iLy8cHichSFxRg4LaP114zqS5NWDpBVpU982z+dtYsKzcp8 WLXVgE5NtdLdVtqpx2k7okQ= X-Google-Smtp-Source: ABdhPJy1TH163k3fqCjteXle/QTSzRWZ0OTl+CZ3JMeS4PzbGF/VLOlMxAILZbvRrIvd6TUO/G0RmA== X-Received: by 2002:adf:ee48:: with SMTP id w8mr13112368wro.23.1642274882469; Sat, 15 Jan 2022 11:28:02 -0800 (PST) Original-Received: from ?IPv6:2a02:810d:a8bf:f874:d19:a25c:1001:900c? ([2a02:810d:a8bf:f874:d19:a25c:1001:900c]) by smtp.gmail.com with ESMTPSA id b6sm44509wri.108.2022.01.15.11.28.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Jan 2022 11:28:02 -0800 (PST) In-Reply-To: <02468648b859479c9f5bbcce7001e88b@unibe.ch> Content-Language: en-US X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:114177 Archived-At: This is a multi-part message in MIME format. --===============2312314249582802111== Content-Type: multipart/alternative; boundary="------------D9FCBCD5E5FC0A0DD716DCD6" Content-Language: en-US This is a multi-part message in MIME format. --------------D9FCBCD5E5FC0A0DD716DCD6 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Denis Maier via ntg-context schrieb am 15.01.2022 um 13:04: > > Hi all, > > I have sources that look like this: > > %%%%%%%%%%%%%%%%%%%%% > > > >
> >   

Bla Bla Bla

> >

> >       > >          Bla > >       , Bla Bla.

> >
> > %%%%%%%%%%%%%%%%%%%%% > > Typesetting this with context gives me a spurious space after the > underlined Bla in italics. > There is no spurious space, the line break is just converted to a space and I see no reason why this shouldn't happen. To remove space before or after certain parts of text within a paragraph you can use the \removeunwantedspace and \ignorespaces commands. %%%% begin example \starttexdefinition RemovePreceding #1     \removeunwantedspaces     #1 \stoptexdefinition \starttexdefinition RemoveFollowing #1     #1     \ignorespaces \stoptexdefinition \starttext Bla \RemovePreceding{Bla} Bla Bla \RemoveFollowing{Bla} Bla \stoptext %%%% end example When only  following spaces are a problem a better alternative to \ignorespace is \autoinsertnextspace which checks the following token which ensures there is space when the next character is punctuation. %%%% begin example \starttexdefinition Italic #1     \emphasized{#1}     \autoinsertnextspace \stoptexdefinition \starttexdefinition Underbar #1     \underbar{#1} \stoptexdefinition \starttext Bla Bla Bla \Underbar{\Italic{Bla} , Bla Bla.} \stoptext %%%% end example Wolfgang --------------D9FCBCD5E5FC0A0DD716DCD6 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit Denis Maier via ntg-context schrieb am 15.01.2022 um 13:04:

Hi all,

 

I have sources that look like this:

 

%%%%%%%%%%%%%%%%%%%%%

<?xml version="1.0" encoding="UTF-8"?>

<article>

   <p>Bla Bla Bla</p>

   <p>

      <underline>

         <italic>Bla</italic>

      </underline>, Bla Bla.</p>

</article>

%%%%%%%%%%%%%%%%%%%%%

 

Typesetting this with context gives me a spurious space after the underlined Bla in italics.


There is no spurious space, the line break is just converted to a space and I see no reason why this shouldn't happen. To remove space before or after certain parts of text within a paragraph you can use the \removeunwantedspace and \ignorespaces commands.

%%%% begin example
\starttexdefinition RemovePreceding #1
    \removeunwantedspaces
    #1
\stoptexdefinition

\starttexdefinition RemoveFollowing #1
    #1
    \ignorespaces
\stoptexdefinition

\starttext

Bla \RemovePreceding{Bla} Bla

Bla \RemoveFollowing{Bla} Bla

\stoptext
%%%% end example

When only  following spaces are a problem a better alternative to \ignorespace is \autoinsertnextspace which checks the following token which ensures there is space when the next character is punctuation.

%%%% begin example
\starttexdefinition Italic #1
    \emphasized{#1}
    \autoinsertnextspace
\stoptexdefinition

\starttexdefinition Underbar #1
    \underbar{#1}
\stoptexdefinition

\starttext

Bla Bla Bla

\Underbar{\Italic{Bla} , Bla Bla.}

\stoptext
%%%% end example

Wolfgang

--------------D9FCBCD5E5FC0A0DD716DCD6-- --===============2312314249582802111== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============2312314249582802111==--