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.7 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, URIBL_SBL_A autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 12345 invoked from network); 10 Aug 2023 07:13:20 -0000 Received: from cgl.ntg.nl (5.39.185.202) by inbox.vuxu.org with ESMTPUTF8; 10 Aug 2023 07:13:20 -0000 Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id D96EE482308 for ; Thu, 10 Aug 2023 09:12:13 +0200 (CEST) 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 mza73sBBDrVg for ; Thu, 10 Aug 2023 09:12:13 +0200 (CEST) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id DC31D48249F for ; Thu, 10 Aug 2023 09:11:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id B33DA480EF6 for ; Thu, 10 Aug 2023 09:11:11 +0200 (CEST) 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 12o41Sr0gpWO for ; Thu, 10 Aug 2023 09:11:11 +0200 (CEST) Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (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 537EF480B35 for ; Thu, 10 Aug 2023 09:11:11 +0200 (CEST) Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-40fd276621aso3663651cf.2 for ; Thu, 10 Aug 2023 00:11:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691651469; x=1692256269; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=GrIANu2ECyos3C4mKspCRehlujoZtTH/EDgybVJ2PkQ=; b=DbFbhTNIYwraBu2ozpKXiUeC9jUxUYD6Vhh5NgzlP7nyBsQuepiFciYa0Cg6V/D5Yq nsJwNBJkkzTrkvry80w1EA9mb4Q/2U3pBR1cBAgj5PnbjnxLwLkcTLGG1Tx66PToZ3cG +fztmifE9c8jD7UYJJ9Re4+jDcaqOAzRvnnRSy5Ha6vLO4kqkRyaXzAfFsrimpjSEJrK 5GfQgELUdXLDK9a/eZP9HjawAhw9G4MmPo1QkhMkkwAaCoRTD1ymZd+osfT9NauFjXP7 5x1UcjCFZBWOhVcdziXu9q/wubnfVHq5UeGvM1qjxprAW1ZI80E89yL6dlUlXbpZjfej uc5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691651469; x=1692256269; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=GrIANu2ECyos3C4mKspCRehlujoZtTH/EDgybVJ2PkQ=; b=GCD5NvgBj/ZJHZHAEEamRjSc/9eoVqbczkI6phRSn1GT3XmwpfVAkWrKc2SLsxfuKh i8mqynkKamrRFzLOMYxYHZgGRnf9J1OWYQQlS/CwI4yua/lSLkP58suwGdezg/YY9f5I rI5+09Ty5LxA2tpGKY8ind36YU9aNDajpdJi2lfyOLdj//9xa4yqSeMthyhfvGqXnfhz jnEwlgS1cbNGO02Dzzw9CWOaZxzIMSfa0ULmcQ4/AbogR1XdiAASUFjUmnCvCWCVt43k YGazSIttt9/zrgkF4Dkn9XIcwn2a+N0Q3XjLswDDkZXaBy0jffT1ynX5Um9MCIpX25Oi Jmgw== X-Gm-Message-State: AOJu0YyA7bS+P/d2OhmFwdjPCapElQEAm9RP8PHVS07BS0DT9e6MWZQn aCY57vPCr/nX+Z7stBB8miQ2N46ZgsNjqVW32zEYjb+J5Qg= X-Google-Smtp-Source: AGHT+IH+kUxUr3F50s60IEVnbh+7OHu9UrGLgEHYrTGxrQoFziFHjcbWhlt9VtgLGps//IfKl3OctR8vBs9kF9qFS78= X-Received: by 2002:ac8:5903:0:b0:40f:f789:6834 with SMTP id 3-20020ac85903000000b0040ff7896834mr2003206qty.25.1691651469360; Thu, 10 Aug 2023 00:11:09 -0700 (PDT) MIME-Version: 1.0 From: Thangalin Date: Thu, 10 Aug 2023 00:10:58 -0700 Message-ID: To: mailing list for ConTeXt users Message-ID-Hash: 7KJ622G3KHBONA7YJKJL4GTH5HBZM4CM X-Message-ID-Hash: 7KJ622G3KHBONA7YJKJL4GTH5HBZM4CM 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] Map XML attributes to variables, dynamically 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="===============8640683058914975323==" --===============8640683058914975323== Content-Type: multipart/alternative; boundary="000000000000ea416d06028c4cfc" --000000000000ea416d06028c4cfc Content-Type: text/plain; charset="UTF-8" Hello! A Markdown document resembles the following: ::: {.concurrent title="Berth 5" location="San Diego"} Text Goes Here ::: ::: {.concurrent title="Road" location="Beale AFB"} Different Text Goes Here ::: The XHTML generated from that document resembles:
Text Goes Here
Different Text Goes Here
Environments for the DIV element gets translated using: \startxmlsetups xml:div \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop \stopxmlsetups This creates "\startconcurrent" and "\stopconcurrent", which are later defined using "\definestartstop[concurrent]". I'd like to dynamically define all the data- attributes to make key/value pairs accessible from the document. For example, I have this: \definestartstop[concurrent][ before={% \blank[big]% \setMPtext{1}{Berth 5}% \startTextConcurrentFrame}, after={\stopTextConcurrentFrame\blank[big]}, ] I'd like to replace \setMPText calls with a reference to a dynamically created variable reference. For example: \setMPtext{1}{\usermap[concurrent.title]} \setMPtext{2}{\usermap[concurrent.location]} I can verify the attribute values exist by exporting them to the document: \startxmlsetups xml:div title:\xmlatt{#1}{data-title} location:\xmlatt{#1}{data-location} \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop \stopxmlsetups How would you change the xml:div setup to create a map of its attributes as key/value pairs? Thank you! --000000000000ea416d06028c4cfc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello!

A Markdown document r= esembles the following:

::: {.concurrent title=3D&= quot;Berth 5" location=3D"San Diego"}
Text Goes He= re
:::

::: {.concurrent title=3D"Ro= ad"=C2=A0location=3D"Beale AFB"}
Different Text Go= es Here
:::

The XHTML generated from tha= t document resembles:

<div class=3D"concur= rent" data-title=3D"Berth 5" data-location=3D"San Diego= ">
Text Goes Here
</div>
&= lt;div class=3D"concurrent" data-title=3D"Road" data-lo= cation=3D"Beale AFB">
Different Text Goes Here
=
</div>

Environments for the DIV element= gets translated using:

\startxmlsetups xml:div=C2=A0 \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop
\stopxmlsetups

This creates "\startconcurrent" and "\s= topconcurrent", which are later defined using "\definestartstop[c= oncurrent]".

I'd like to dynamically defi= ne all the data- attributes to make key/value pairs accessible from the doc= ument. For example, I have this:

\definestartstop[concurrent][
= =C2=A0 before=3D{%
=C2=A0 =C2=A0 \blank[big]%
=C2=A0 =C2=A0 \setMPtex= t{1}{Berth 5}%
=C2=A0 =C2=A0 \startTextConcurrentFrame},
=C2=A0 after= =3D{\stopTextConcurrentFrame\blank[big]},
]

I&#= 39;d like to replace \setMPText calls with a reference to a dynamically cre= ated variable reference. For example:

\setMPte= xt{1}{\usermap[concurrent.title]}
\setMPtext{2}{\usermap[conc= urrent.location]}

I can verify the attribute value= s exist by exporting them to the document:

\st= artxmlsetups xml:div
=C2=A0 title:\xmlatt{#1}{data-title} location:\xmla= tt{#1}{data-location}
=C2=A0 \start[\xmlatt{#1}{class}]\xmlflush{#1}\sto= p
\stopxmlsetups

How would you change the xml:d= iv setup to create a map of its attributes as key/value pairs?
<= div>
Thank you!
--000000000000ea416d06028c4cfc-- --===============8640683058914975323== 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://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ --===============8640683058914975323==--