From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32142 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Kelleher Newsgroups: gmane.text.pandoc Subject: Re: Use a pipe to generate only first word of a variable? Date: Fri, 3 Feb 2023 12:57:16 -0600 Message-ID: References: <074330dd-ae01-4471-9550-ea09b2fe7363n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000ae877205f3d04063" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15924"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDYKNHHAVIJBBGFS6WPAMGQEZM6XY3A-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Fri Feb 03 19:57:32 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ua1-f60.google.com ([209.85.222.60]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pO1Fc-0003v3-8h for gtp-pandoc-discuss@m.gmane-mx.org; Fri, 03 Feb 2023 19:57:32 +0100 Original-Received: by mail-ua1-f60.google.com with SMTP id 88-20020a9f2161000000b00576fb176177sf2539408uab.3 for ; Fri, 03 Feb 2023 10:57:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675450651; cv=pass; d=google.com; s=arc-20160816; b=iCEKdNPscV4XGW9KdVu7ZWXCYAcwVuz/mr1ezWn7/QRNm/qKU9OYr2FlRlnJ53HQs0 NmKXNEkl9vwv1LuolqYmb5VZCxq/QFGuuvSq325WyM8lcINhLPsyZJEE6oKshSXWBwdc bldZV73tRigEcVPsAk4fIOAzdqHlJ0jkhZ5CRjJuEFIy93AZNqkC4IWWezoyfnfTsxWI OVEy7gRTXsWApgiU0RezvRkYLyX13APnU68j0EArqRGUaiSbmbSV1VM9hPIdsfUk4J7j X5M/4hPQdQTzkYHrmyEPaGFVjnBHA7KmKCzgJqluQmSeO4T1iYkUY1KpEtW3OCHkZ1S6 Y/PQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date :from:in-reply-to:references:mime-version:sender:dkim-signature; bh=GQ37PWDjZmamj0+Zm3fPqZ2hAkNpFJFiOPTlnLQ03x8=; b=DZMjzuTDtuV1r3+bD1CI5ZdsLQgLqy3+b3meupB8yKSmlD9bHO1NMIBCz6Fdw+1zCX 5sVFuAdkqNzijZ/a7iKsaSrF2g5dsTexgfZE07BBXePgTw8sV2CrxWQDLPLT8pBVZRnF PqgZt7gxWpycgkVtRws4ZZzZrSLw+TpmnMn9PrhqatmIGJ+ZkAYiL+VJ2zlU3wY3bWzY Uo2HfqUy+g6gIfnUdldOf8X/E0g3Cs+kinZoDgw3vlOinImtWj9r5oAvfdIxl8PRfFAe w9T9qnnZDXj//Q4k9TvHb5SemUuUXFGvg6AaBm4yYMna6WIt3ut866ucP6XnWPLJOniT kpbw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@paulkelleher-net.20210112.gappssmtp.com header.s=20210112 header.b="Zmko9j/J"; spf=neutral (google.com: 2607:f8b0:4864:20::b31 is neither permitted nor denied by best guess record for domain of paul-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org) smtp.mailfrom=paul-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:to:subject :message-id:date:from:in-reply-to:references:mime-version:sender :from:to:cc:subject:date:message-id:reply-to; bh=GQ37PWDjZmamj0+Zm3fPqZ2hAkNpFJFiOPTlnLQ03x8=; b=U2E0KpEivkuXJSN+kuJFv+GsUgwpzdvs5GBQ35Jr5tsNeEjn/ON2k2VT29cxoK9hNu 3dJnuzyA/0CI8FEgg98IrrCP6VtZh5kaBnSH30enOMBfaReSl+jC3rSu7DJRgMhul+NZ o/q0RaYrX2krpbaGRSBxfrD6FHyvf//q0wcsHQMFUnqrDzIALht+IXhccXVUkPN5bE4W BTyvgjXnEMpugkBWwVfkeWDLVlCH2isEEDF0xHmRP23YNfQg4hZAzfh4HjRV7Tqu3a8k QuJNNJTKHiaQJyytmM7KNMiSYbzwcyx1c6Fu1FNDcRNgpDMNsrlu+ku/vYxR811oA7oD lT7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:to:subject :message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:sender:from:to:cc:subject:date:message-id :reply-to; bh=GQ37PWDjZmamj0+Zm3fPqZ2hAkNpFJFiOPTlnLQ03x8=; b=NMpuCCz117Av3iptuzWCXjO4CXkpSflgFMPeuCDHLlbZPtzFtEKsR24DtTRMUsu9OZ 9YulvKWkzRpXrt5Mp/kWF/JxZTQVINz4B9zaOH780pMpIExEDCFBfLG9igNzzz9M7a9L Z20/dnRGRDEPkvKdOtRxbsJMRF5xYurvUsfR5Z56KcLGgBhMF7JZ089qYnOcvHTWp/4p wFnSpiA7UqKlEZ7M/ww6l4T8XyXtEW2j7d5Fa78Ta0FEz4cUe++ZG9LmJtjkXJOBN5zR zAoNI3UfSA2n2kyHIw21BbaLn1SH7jicxXvauSz4VR8hmf Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AO0yUKVNg/TIzvfoTDAwVCNbLv6DwmyJ1HA2Icw2NrUkegFffjdaiNRq gAShJkWeHgpSLy66/13YQD0= X-Google-Smtp-Source: AK7set+08ypU1u0bLHqAkfYlVCcHCPBkwOOLaO36CWS2Fv5vAZfKjc4h5m7/9DRxUIdNHPHtytXdqA== X-Received: by 2002:a05:6102:1151:b0:3eb:8db5:c1ad with SMTP id j17-20020a056102115100b003eb8db5c1admr1832561vsg.69.1675450651038; Fri, 03 Feb 2023 10:57:31 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6102:320c:b0:3e9:216a:d6b3 with SMTP id r12-20020a056102320c00b003e9216ad6b3ls1913373vsf.9.-pod-prod-gmail; Fri, 03 Feb 2023 10:57:28 -0800 (PST) X-Received: by 2002:a67:443:0:b0:3cc:77d5:4bc0 with SMTP id 64-20020a670443000000b003cc77d54bc0mr5007992vse.33.1675450648218; Fri, 03 Feb 2023 10:57:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675450648; cv=none; d=google.com; s=arc-20160816; b=ZzztUQR61bS5alvd2vkejgKtksl/YY2xhVM0rcTevvZWsWou1SAG7DZVC1nZ18uc4D vC+r8mVLlyk7eDEGsWvwXQExePDAaOqd2iH2uXIzpvkGBIfu+AHxi7jwe4JCwCR7An/C mzp5+qSX9AUFGX5pwwSeq56oaFvnxAIQyOIV/NflhkPXqYlEcZWKb3Gnj0WjnrYuxZmL pWynKWnq3IVDH48vSl9VGaibXqxuI5tknXnf8CNiNEBRgPjLVDhOuk/ELnpchUopr2NB jJpsnxyQqF8JK/FaqMz+vBpeS4P8SGHaWeI/oaI5PG1xeWb0pKhAbTodEIc07CPxFTdP 5z2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+aa1+3eGRxuY2XkCtsMEW57akXL5ySysi2/kuuyvS0M=; b=TxF9ggnAup8VbPmAG+asVOEnv0/++mfPbgyaEDC061n4Elu/aRwn/SHTgc+sOm+6iX sDVfWp5+orKrKwJw77clV60oeo8Tixk1aG01o3mYFJDYDvxZ1+VxwABqXymamgY13VgJ +m+bSbMIkL3PXOBf1DNUtM09MH8aC5Y544WxkzXmTzA86NnOJxcZZykcQj2shRnPyEuH 0LT9HXWwemBj2SwgVxT/eY6dpbolIUvcmjWpaTSCZYzk4n6hCqoeXgbuZQy+BNSPPGHC 4W9HG9NJLVz/Wiqj1/7bJKxnpyPvWRsikZGTB16pwduMGPolGK2Y8jqTqfb1hTBwNzTv oNXQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@paulkelleher-net.20210112.gappssmtp.com header.s=20210112 header.b="Zmko9j/J"; spf=neutral (google.com: 2607:f8b0:4864:20::b31 is neither permitted nor denied by best guess record for domain of paul-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org) smtp.mailfrom=paul-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org Original-Received: from mail-yb1-xb31.google.com (mail-yb1-xb31.google.com. [2607:f8b0:4864:20::b31]) by gmr-mx.google.com with ESMTPS id j5-20020a056102240500b003d04209e4e2si468897vsi.0.2023.02.03.10.57.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Feb 2023 10:57:28 -0800 (PST) Received-SPF: neutral (google.com: 2607:f8b0:4864:20::b31 is neither permitted nor denied by best guess record for domain of paul-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org) client-ip=2607:f8b0:4864:20::b31; Original-Received: by mail-yb1-xb31.google.com with SMTP id d132so7405173ybb.5 for ; Fri, 03 Feb 2023 10:57:28 -0800 (PST) X-Received: by 2002:a05:6902:1006:b0:80b:6369:e336 with SMTP id w6-20020a056902100600b0080b6369e336mr1045909ybt.561.1675450647474; Fri, 03 Feb 2023 10:57:27 -0800 (PST) In-Reply-To: <074330dd-ae01-4471-9550-ea09b2fe7363n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: paul-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@paulkelleher-net.20210112.gappssmtp.com header.s=20210112 header.b="Zmko9j/J"; spf=neutral (google.com: 2607:f8b0:4864:20::b31 is neither permitted nor denied by best guess record for domain of paul-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org) smtp.mailfrom=paul-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:32142 Archived-At: --000000000000ae877205f3d04063 Content-Type: text/plain; charset="UTF-8" Just realized that one approach is to have Pandoc pass the full name string (e.g. 'First Last') to the template, but then to create a macro inside the template that will return just the first word in the string, as described here . That worked for me! On Fri, Feb 3, 2023 at 11:55 AM Paul Kelleher wrote: > Hello, > > Is it possible to use a pipe in a template to generate just the first word > of a variable? > > My specific use case is to produce just the first name of a first-and-last > name that I place in the "to" field of a YAML block that passes info to a > letter template. I'd like to generate "Dear ,". To do this now, > I've defined "to" as an array, with the first name as the first value of > the array and the last name as the second value; then I can use the > predefined 'first' pipe to return just the first name. But for reasons > specific to my particular use case, it'd be great to have a pipe that > returns the first word of a multi-word variable. > > Thanks! > > -- > You received this message because you are subscribed to a topic in the > Google Groups "pandoc-discuss" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/pandoc-discuss/cEe1t7Fw4-o/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/074330dd-ae01-4471-9550-ea09b2fe7363n%40googlegroups.com > > . > -- You received this message because you are subscribed to the Google Groups "pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAD0VMekeTBm__Qt6bAqFMCQ8TVXF%2Bs9Uf4_xsZHxmJ3b_CNVuw%40mail.gmail.com. --000000000000ae877205f3d04063 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Just realized that one approach is to have Pandoc pass the= full name string (e.g. 'First Last') to the template, but then to = create a macro inside the template that will return just the first word in = the string, as described here. That worked for me!
=
On Fri= , Feb 3, 2023 at 11:55 AM Paul Kelleher <paul-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org> wrote:
Hello,

Is it possible t= o use a pipe in a template to generate just the first word of a variable?= =C2=A0

My specific use case is to produce just the= first name of a first-and-last name that I place in the "to" fie= ld of a YAML block that passes info to a letter template. I'd like to g= enerate "Dear <first name>,". To do this now, I've defi= ned "to" as an array, with the first name as the first value of t= he array and the last name as the second value; then I can use the predefin= ed 'first' pipe to return just the first name. But for reasons spec= ific to my particular use case, it'd be great to have a pipe that retur= ns the first word of a multi-word variable.

Thanks!

--
You received this message because you are subscribed to a topic in the Goog= le Groups "pandoc-discuss" group.
To unsubscribe from this topic, visit https://g= roups.google.com/d/topic/pandoc-discuss/cEe1t7Fw4-o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to p= andoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https= ://groups.google.com/d/msgid/pandoc-discuss/074330dd-ae01-4471-9550-ea09b2f= e7363n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://group= s.google.com/d/msgid/pandoc-discuss/CAD0VMekeTBm__Qt6bAqFMCQ8TVXF%2Bs9Uf4_x= sZHxmJ3b_CNVuw%40mail.gmail.com.
--000000000000ae877205f3d04063--