From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 32516 invoked from network); 26 Nov 2023 11:31:47 -0000 Received: from cgl.ntg.nl (5.39.185.202) by inbox.vuxu.org with ESMTPUTF8; 26 Nov 2023 11:31:47 -0000 Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id C0BD1483A65 for ; Sun, 26 Nov 2023 12:29:23 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eY-xUKMZfpI3 for ; Sun, 26 Nov 2023 12:29:23 +0100 (CET) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 216D2483A35 for ; Sun, 26 Nov 2023 12:28:02 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 63BBF483835 for ; Sun, 26 Nov 2023 12:27:15 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6PG6zbsaAy8j for ; Sun, 26 Nov 2023 12:27:15 +0100 (CET) Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cgl.ntg.nl (Postfix) with ESMTPS id 1911B483834 for ; Sun, 26 Nov 2023 12:27:15 +0100 (CET) Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-41cd4cc515fso19047651cf.1 for ; Sun, 26 Nov 2023 03:27:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700998033; x=1701602833; darn=ntg.nl; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=Eb+uqLj37GyPK7RlhcKGRgBtKDgfxQNIOTlP5BQg9vo=; b=ClAjF9NmYkIglY2r1tewIBmcwy1cps4UCXgIqIxJHpFw5m65QmxBdkqj9u+tsiROKp NbvMd9SQrqiI0CSdkRKwRINBJAuCUU0nKbDkkYdavScxl3NpK8xwIQlYNI47YCu/wDA1 zVWklRUWquEd+xZAeGMCnMFfm6iKr+XJJRJqkHa3h7tDEAdCdectIS4GRssTC4tdwjE4 q9Fl9k9kgEwAtK8ViLqROYQ9b3m5MMxjEXFaWPLOG3FcHwAxXrPB25C4ZUUocLrAqLdv YZ4imDN3gTolE8JJZb7nrasfeCKomJKecupvKuZf/6038s3i1NBZqmtbjnUFiRfOjNN2 itiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700998033; x=1701602833; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Eb+uqLj37GyPK7RlhcKGRgBtKDgfxQNIOTlP5BQg9vo=; b=A4fKvXZyccpRPEYlvITQAY8pJZUg4UDmlXDAZDt/x1PVP/H2Hdb2VcwcQcHrlJnPch rD9z5PjDkll7CpOI+LTa1eBSN2zcW/JmB9KOB6OYjCUzxjDuWyYir0lfAH//OrZl/mqG 1o8Cn9C2d38YJpFAfvF9+1lfzcjcVaMyLYJBZ4jkFT1JqCpLLCxAgAtELY1rCWh68/Ua N97CUIOrFyAOhbyTpf6wbBM8EafrmylzDv7M4bMU+DVIfi9ozPFKBg9ypzjhDsTXa6w+ D0owtZq1iFkOfPOaw1cJTqfkWhga6r4tthdzKtLYY2J2gERqCmvJSvZA09xFuk6tI7Oi h4lw== X-Gm-Message-State: AOJu0YyfJLAuZCgJfr9Dnx28PlwcTf8Eh96YC+OaMrvTov2xhc5AtNj8 mqhA/7lhys2QGk5rzk8bIxnzTv9n6tYPjaAZ4lfMhUJhHJw= X-Google-Smtp-Source: AGHT+IFLVnDYMzEM/YHeOK65vAcBxyYIrimU00CdRssowuyu6OBo+x5Klr1iukNqnYfivGn9lfbCTvls5fmP253QRIc= X-Received: by 2002:ac8:6b53:0:b0:423:a4f6:9a90 with SMTP id x19-20020ac86b53000000b00423a4f69a90mr4501730qts.2.1700998033248; Sun, 26 Nov 2023 03:27:13 -0800 (PST) MIME-Version: 1.0 From: Thangalin Date: Sun, 26 Nov 2023 03:27:02 -0800 Message-ID: To: mailing list for ConTeXt users Message-ID-Hash: L42KQLFKWBWVWUJIEFSPNEO72AWRICLR X-Message-ID-Hash: L42KQLFKWBWVWUJIEFSPNEO72AWRICLR X-MailFrom: thangalin@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Converting XHTML captions to ConTeXt captions List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: multipart/mixed; boundary="===============9047051360898297503==" --===============9047051360898297503== Content-Type: multipart/alternative; boundary="000000000000891590060b0c7777" --000000000000891590060b0c7777 Content-Type: text/plain; charset="UTF-8" I'd like to capture a caption and apply it to the block-level element that immediately follows. In the MWE, is there a more "ConTeXt way" to accomplish the task of adding captions to tables, figures, blockquotes, etc? % SOT \startbuffer[demo]

Caption 1

table 1 with caption
table 2 without caption

Caption 3

table 3 with caption
\stopbuffer \startxmlsetups xml:demo \xmlsetsetup{\xmldocument}{*}{-} \xmlsetsetup{\xmldocument}{a|p|body|table}{xml:*} \xmlsetsetup{\xmldocument}{span[@class='caption']}{xml:span} \define\CaptionText{} \define\AnchorXref{} \stopxmlsetups \startxmlsetups xml:span \define\CaptionText{\xmlflush{#1}} \stopxmlsetups \startxmlsetups xml:a \define\AnchorXref{\xmlatt{#1}{data-type}-\xmlatt{#1}{name}} \stopxmlsetups \startxmlsetups xml:body \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:p \xmlflush{#1}\par \stopxmlsetups \startxmlsetups xml:table \blank \doifelsetext{\CaptionText}{% \startplacetable[ title={\ignorespaces\CaptionText{}\removeunwantedspaces.}, reference={\AnchorXref} ] \define\CaptionText{} \define\AnchorXref{} }{ \startplacetable } \startembeddedxtable \startxtablebody[body] \startxrow \startxcell \xmlflush{#1} \stopxcell \stopxrow \stopxtablebody \stopembeddedxtable \stopplacetable \blank \stopxmlsetups \xmlregistersetup{xml:demo} \starttext \xmlprocessbuffer{demo}{demo}{} \stoptext % EOT --000000000000891590060b0c7777 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I'd like to capture a caption and apply it to the= block-level element that immediately follows. In the MWE, is there a more = "ConTeXt way" to accomplish the task of adding captions to tables= , figures, blockquotes, etc?

% SOT
\startbuffer[demo= ]
<body>
<p><span class=3D"caption">Capti= on 1 <a data-type=3D"tbl" name=3D"lbl-1"/></sp= an></p>
<table>table 1 with caption</table>
<= table>table 2 without caption</table>
<p><span class= =3D"caption">Caption 3 <a data-type=3D"tbl" name= =3D"lbl-2"/></span></p>
<table>table 3 wi= th caption</table>
</body>
\stopbuffer

\startxmlse= tups xml:demo
=C2=A0 \xmlsetsetup{\xmldocument}{*}{-}
=C2=A0 \xmlsets= etup{\xmldocument}{a|p|body|table}{xml:*}
=C2=A0 \xmlsetsetup{\xmldocume= nt}{span[@class=3D'caption']}{xml:span}

=C2=A0 \define\Capti= onText{}
=C2=A0 \define\AnchorXref{}
\stopxmlsetups

\startxmls= etups xml:span
=C2=A0 \define\CaptionText{\xmlflush{#1}}
\stopxmlsetu= ps

\startxmlsetups xml:a
=C2=A0 \define\AnchorXref{\xmlatt{#1}{da= ta-type}-\xmlatt{#1}{name}}
\stopxmlsetups

\startxmlsetups xml:bo= dy \xmlflush{#1} \stopxmlsetups
\startxmlsetups xml:p \xmlflush{#1}\par = \stopxmlsetups
\startxmlsetups xml:table
=C2=A0 \blank
=C2=A0 \doi= felsetext{\CaptionText}{%
=C2=A0 =C2=A0 \startplacetable[
=C2=A0 =C2= =A0 =C2=A0 title=3D{\ignorespaces\CaptionText{}\removeunwantedspaces.},
= =C2=A0 =C2=A0 =C2=A0 reference=3D{\AnchorXref}
=C2=A0 =C2=A0 ]

= =C2=A0 =C2=A0 \define\CaptionText{}
=C2=A0 =C2=A0 \define\AnchorXref{}=C2=A0 }{
=C2=A0 =C2=A0 \startplacetable
=C2=A0 }

=C2=A0 =C2= =A0 \startembeddedxtable
=C2=A0 =C2=A0 =C2=A0 \startxtablebody[body]
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 \startxrow
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 \startxcell
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \xmlflush{#1}<= br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \stopxcell
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 \stopxrow
=C2=A0 =C2=A0 =C2=A0 \stopxtablebody
=C2=A0 =C2=A0 \= stopembeddedxtable
=C2=A0 \stopplacetable
=C2=A0 \blank
\stopxmlse= tups

\xmlregistersetup{xml:demo}

\starttext
=C2=A0 \xmlpro= cessbuffer{demo}{demo}{}
\stoptext
% EOT
--000000000000891590060b0c7777-- --===============9047051360898297503== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / 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 ___________________________________________________________________________________ --===============9047051360898297503==--