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_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,URIBL_SBL_A autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 13084 invoked from network); 12 Aug 2023 20:06:58 -0000 Received: from cgl.ntg.nl (5.39.185.202) by inbox.vuxu.org with ESMTPUTF8; 12 Aug 2023 20:06:58 -0000 Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 985C64828E5 for ; Sat, 12 Aug 2023 22:05:54 +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 B9Fmf_CU_H-2 for ; Sat, 12 Aug 2023 22:05:54 +0200 (CEST) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 37B05482A6A for ; Sat, 12 Aug 2023 22:05:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id D83CF48285C for ; Sat, 12 Aug 2023 22:04:49 +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 8KOjVtJW5B0l for ; Sat, 12 Aug 2023 22:04:49 +0200 (CEST) Received: from outbound.soverin.net (outbound.soverin.net [185.233.34.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 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 4EB3E482835 for ; Sat, 12 Aug 2023 22:04:49 +0200 (CEST) Received: from smtp.freedom.nl (c04smtp-lb01.int.sover.in [10.10.4.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 4RNWpn1Y81z5Y for ; Sat, 12 Aug 2023 20:04:49 +0000 (UTC) Received: from smtp.freedom.nl (smtp.freedom.nl [10.10.4.107]) by freedom.nl (Postfix) with ESMTPSA id 4RNWpm3P7Yz6t for ; Sat, 12 Aug 2023 20:04:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freedom.nl; s=default; t=1691870689; bh=USvtRGknl9UIbjvaSBjC0Y3lMtf+8UE1g+Au+y/J0ZI=; h=Date:Subject:To:References:From:In-Reply-To:From; b=ywit8w4bvZFOOtmltDJzKjlNvtW6qS0UvFgp0QhilMAgdDK3eWMM0ZWorMtNQK6FM 5CjYP20w2uQYEiQqdjF8SJx9nFTauZPST20a7/Jb3V9qNVkaTvPmLplEwonaurX5Yj hhQHvzCdNPlxd9pcIQ2QuxaPkdX73uDBcPc4prI4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freedom.nl; s=default; t=1691870688; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sD5msZYXGGBfEHQR2hv6zanUNu5IjMKrXIa0YsTsmmY=; b=ss3a0w+QIuus1dEoJm1PiP/kn4sk7iW/G5C+LCzXIV547CkUi14IyqZg49zWPoxiNP09XV Ac/FY7FVd1/1pVZS+OZoj0FkUrWhdcmlpS883gXFnnYVo3kXYSVQLCj9pQGuY/WCrN5mId gN+4uaW5KlDNeec4nf8oMRAD289QW0M= ARC-Authentication-Results: i=1; smtp.freedom.nl; auth=pass smtp.mailfrom=j.hagen@freedom.nl ARC-Seal: i=1; s=default; d=freedom.nl; t=1691870688; a=rsa-sha256; cv=none; b=bpxl5Ji2n0Bc4ZZuD4q2M+ZtXN/iRagEB4m1qVpmW4kX5hYmfv+p3mKCPtMJHY+VbOskma EIX33n7aiN/StcSCMgg7bN/DLn3yITMopCxMRsA3UsM5vnKEo4eTMoHjtdDZRN3iLSvd0V 2mC5EcUMl3mStedLHr3GdA19FIqZSPk= Message-ID: Date: Sat, 12 Aug 2023 22:04:47 +0200 MIME-Version: 1.0 Content-Language: en-US To: ntg-context@ntg.nl References: <550cf663-274f-106c-e930-03fb0b092643@xs4all.nl> X-Soverin-Authenticated: true In-Reply-To: X-CMAE-Score: 0 X-CMAE-Analysis: v=2.4 cv=SpVWqtC0 c=1 sm=1 tr=0 ts=64d7e5e1 a=yaeGIPywLLJyAsH1IMTGEA==:117 a=yaeGIPywLLJyAsH1IMTGEA==:17 a=IkcTkHD0fZMA:10 a=NEAV23lmAAAA:8 a=MiNTnEJAAAAA:8 a=YEMqx4UAAAAA:8 a=ACQCx6kCAAAA:8 a=xtERp6CFAAAA:8 a=a3nu-2BBAAAA:8 a=Uows8UApAAAA:8 a=ZiKI61z1cpZ5w0-mBd4A:9 a=QEXdDO2ut3YA:10 a=LmrbSfiT3hecnSZifb5M:22 a=V0662LiR8DSfwiDagK97:22 a=Sab0UneHBzlWrQDlOuxD:22 a=ekCXXmE-vB8RPiJ3MEZb:22 a=oX0v64vK4IwbpfTCMRm2:22 X-Cloudmark-Reporter: TzTHpTSReRd0bFwC4Z9fAWFDcU0= Message-ID-Hash: DCQ573FVCYJ3GOJWUDUDO52O2VQ5OYB3 X-Message-ID-Hash: DCQ573FVCYJ3GOJWUDUDO52O2VQ5OYB3 X-MailFrom: j.hagen@freedom.nl 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] Re: Pass string into text background graphic List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Hans Hagen via ntg-context Cc: Hans Hagen Content-Type: text/plain; charset="us-ascii"; format="flowed" Content-Transfer-Encoding: 7bit On 8/12/2023 7:19 PM, Thangalin wrote: > Thanks Hans. > > The \newinteger approach would always increment the value, regardless of > conditionals within the MetaPost code (i.e., it was like legend := > "\ConcurrentTextGet" would always invoke the macro just be referencing the > MPgraphic and nothing would prevent its execution). This meant that the Get > indexes would not correspond to the Set indexes. Switching to \definenumber > resolved the issue. There were a few other oddities, such as the "Get" > counter incrementing twice. Here's the code: you could remove the \localcontrolled around the advance > \definenumber[ConcurrentTextSetCounter][prefix=no] > \definenumber[ConcurrentTextGetCounter][prefix=no] > > \setnumber[ConcurrentTextSetCounter][0] > \setnumber[ConcurrentTextGetCounter][0] > > % Map each label as global key/value pairs. > \def\ConcurrentTextSet#1{% > \incrementnumber[ConcurrentTextSetCounter]% > \setxvariable > {concurrent} > {text:\rawcountervalue[ConcurrentTextSetCounter]} > {#1}} > > % Account for the counter incrementing twice and the index being 1-based. > \def\ConcurrentTextGet{% > \incrementnumber[ConcurrentTextGetCounter]% > \getvariable > {concurrent} why twice ? you only have to typeset the text once, right? > {text:\number\numexpr1+\rawcountervalue[ConcurrentTextGetCounter]/2\relax}} > > \startuseMPgraphic{GraphicConcurrent} > numeric index; > index := 1; > > % Differentiate between new text blocks and those crossing pages. > if (multikind[ index ] = "single") or (multikind[ index ] = "first"): > string legend; > legend := "\ConcurrentTextGet"; > > % For new text blocks, write the title. > picture p; > p := textext.rt( legend ) > shifted ulcorner multipars[ index ] > shifted (1cm, 0); > > % Draw the horizontal rule only for the initial text block. > draw > ulcorner multipars[ index ] shifted (1mm + xpart lrcorner p, 0) -- > urcorner multipars[ index ]; > > % Draw the vertical rule for the initial text block. > draw > llcorner multipars[ index ] -- > ulcorner multipars[ index ] -- > ulcorner multipars[ index ] shifted (9mm, 0); > > draw p; > else: > % Draw only the vertical rule only when crossing page boundaries. > draw > llcorner multipars[ index ] -- > ulcorner multipars[ index ]; > fi > \stopuseMPgraphic > > \definetextbackground[TextConcurrentFrame][ > mp=GraphicConcurrent, > frame=off, > topoffset=1em, > leftoffset=1em, > before=\blank[2*big], > after=\blank, > location=paragraph, > ] > > \startsetups concurrent:before > \ConcurrentTextSet{% > % Be sure to format "a.m." and other special phrases. > \expandafter\TextReplacement{% > \xmlatt{\getvariable{div}{concurrent}}{data-title}% > } > } > \startTextConcurrentFrame > \stopsetups > > \startsetups concurrent:after > \stopTextConcurrentFrame > \stopsetups > > \definestartstop[concurrent][ > before=\directsetup{concurrent:before}, > after=\directsetup{concurrent:after} > ] > > This allows for typesetting a wider range of pandoc-style Markdown > annotations, such as: > > ::: {.concurrent title="Terminal Berth 5, 3:17 a.m."} > text goes here > ::: > > With these changes, the titles now only appear at the start of the > demarcated text, in any combination of "concurrent" annotation instances > spanning any number of pages. > > Much appreciated. > > Cheers! > P.S. > The following line requires KeenWrite themes: > > \expandafter\TextReplacement{ ... } > > For details, see: > > - > https://github.com/DaveJarvis/keenwrite-themes/blob/main/xhtml/xml-blocks.tex > - > https://github.com/DaveJarvis/keenwrite-themes/blob/main/boschet/replace.tex > > > ___________________________________________________________________________________ > 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 > ___________________________________________________________________________________ -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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 ___________________________________________________________________________________