From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/33141 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bastien DUMONT Newsgroups: gmane.text.pandoc Subject: Re: Shell (zsh) for loop: apply correct suffix based on Pandoc output format? Date: Mon, 2 Oct 2023 14:17:21 +0000 Message-ID: References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28618"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDCINCES2QJRB5FB5OUAMGQE7NN4H6Q-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Oct 02 16:17:30 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lj1-f184.google.com ([209.85.208.184]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1qnJjl-00073U-EI for gtp-pandoc-discuss@m.gmane-mx.org; Mon, 02 Oct 2023 16:17:29 +0200 Original-Received: by mail-lj1-f184.google.com with SMTP id 38308e7fff4ca-2c001029f99sf225412441fa.0 for ; Mon, 02 Oct 2023 07:17:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696256249; cv=pass; d=google.com; s=arc-20160816; b=dLY+UCJpcA8fg1KUR67rDW0vOcoqrTOyvJS5Kp9YERPT62ClF+iws8GTZBgumHxcYw qJKRw8VqAKsNd2S4AivIdLXAhV5FqU7qKRAICiysxNpv3zm0vWUZXnnw/kBO1cLz5Xgj TONzMz819iE+KfZQb6Te6dDCbCin/+lGFHhEopGaiD+YF+TStYW2XGKwgDlyKR5WYA6M E4sbRAkPsNjDO23O+tHNaY2opPPNpF54yBUJOd/XmfSfwhGEH/iygsBXhY2iVVdfBF3P LMy69we9vUZHk8Ilv5zufVtcwftQyQoFAXovaLkaMyAr8ACBU70lD7L9GfCzUDdlEB18 +2PA== 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:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:sender:dkim-signature; bh=iNQCfU6woPOBfh+naPW9SI5jLOU1aVufBSpcEIE1zsg=; fh=m01AhCNo7xUywHldCVYouaJypLlN7JgtNYbImzBf4N4=; b=JUVA+X7D3EYG7XbToqf3rUgfd84AsNNJFVvJvK5aemjrAaoLNcN6eiBGnfKCbKUl98 yLLF77MynR5RdPsCkChH68lwktYeD0eGelFk/UQhnYlHrajJXpdDllbfaUZpRqXnAVHM 154M0A7+n2rkIcDsh4wjQLRxMnwSPUn0leBP4aNzwaI5qZJEWhaBUf5Gqufu6Cg7d3LI Ms/K+xu6iBcjO5jCj4vt1QJMTGEKiC591l3ts/LWN7vxGpYVT34R+qNJUvGbFJMiWY8D 76DeAWR3Rou6NxA3hVPg2tyxuc92harbXE9G9ccBTj4u2T4wF3ZBoEow0lhNxRGHwKfQ h0bA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=bjTJ01Uk; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1696256249; x=1696861049; darn=m.gmane-mx.org; 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:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:sender:from:to:cc :subject:date:message-id:reply-to; bh=iNQCfU6woPOBfh+naPW9SI5jLOU1aVufBSpcEIE1zsg=; b=guEdU0/VLtn8PHmaMq84WVxrnc6xglc2ShB1c2oeI0ZuZSc8ItS+ZeJR/zEC13oexc zAp1LvDawXyagk8dUWMxq3pkynNbhzFJXHMO1hLq2A3I7oiX+/KY0EZ9s9vybAiu75sV dtN6DsFLDQmGhQgqxBGkVyMEhM4JnPLOoH8BiUEiSzMWS51kXmvkR2Yk9MoMW7t222jN CoxXhs8I896lZt9XD1tyBH0QFN1vtgKy9l2e7iUNkRJavtj8N9Wq8H1LI17XM/qBW7ZH X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696256249; x=1696861049; 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:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:x-beenthere :x-gm-message-state:sender:from:to:cc:subject:date:message-id :reply-to; bh=iNQCfU6woPOBfh+naPW9SI5jLOU1aVufBSpcEIE1zsg=; b=nLDbGBdlXn9drGzLViYnVZwJLnbdsucJbXZsB09ShXDjrvfWAi/s8ynCaN5RgIvYUn wrOf3smMz1pUI8bFsR6v5S9H1J/MPR5osnumnDMH0IuGvqC04JIvirk02jRaYUyerOWU kt9hByxlhjUyYbiJ2Wr7W5M/iPVlyMWgFrtvLTfWnW3oqiGwUwJPUR6/2h5ghL2hksKF ZmKHEy3lrvS2E/UaecCxB/aLGzAG Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOJu0YwLKJkkbhZgLeg+GGIrGCOaGRuDwwtJF5lVkPucEM9vRJ+yp3r1 Q+YB56uNsVLfwIadkz9Cxks= X-Google-Smtp-Source: AGHT+IGlA2oIgABBidYcsEdLwP+N8aibE4Ya/b0Hf74Ly2DtRv6kgiRyM/+dPvfI0Yt9ZftZNzQwZQ== X-Received: by 2002:a05:651c:1034:b0:2bc:b27f:4019 with SMTP id w20-20020a05651c103400b002bcb27f4019mr9053658ljm.6.1696256248462; Mon, 02 Oct 2023 07:17:28 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a2e:7c0b:0:b0:2b9:6157:a29a with SMTP id x11-20020a2e7c0b000000b002b96157a29als169170ljc.1.-pod-prod-02-eu; Mon, 02 Oct 2023 07:17:22 -0700 (PDT) X-Received: by 2002:a05:6512:ad1:b0:503:2deb:bbc1 with SMTP id n17-20020a0565120ad100b005032debbbc1mr12671378lfu.22.1696256242681; Mon, 02 Oct 2023 07:17:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696256242; cv=none; d=google.com; s=arc-20160816; b=nFZartSonsbI1EghRpDL1ffppX8CGWEZtVA/x2U1O28v20g/bTBMdvwtrr4r9ZiL2s oZraC2Roqta1rLnO1iNy/B9ez4HbbzLg/0QRZGf4ZVGK8SOdo1tUiX5y3ZMIk+37Dvpj 2rm/xtiCogxoBiY19jYJ/AujrikrBbgFvgnEBQcnzdPPjpxcrqjCsQTYk4amDlBzZdc4 UluNN+scHkdP+ERlHo2NiIZp+xsRkl3xMOERY//71KhG1JjLlS+E82UaZEbzz4w72YH3 N3CPpfRiyFX04MHyITXbSFxRxZXVeY1HBggCYIeXB4R5CLY76T7EC06kZWw2yH7QGJM0 u/3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:to:from:date :dkim-signature; bh=6HrfHgrerSzKD1HtYQTqvr7XweMDmPMzqP2GNwuZDls=; fh=m01AhCNo7xUywHldCVYouaJypLlN7JgtNYbImzBf4N4=; b=z52JsQA6tQF9lAOdAnNPJEUfkb4ZONExF8jNraSAXlY5/36z8RLhpCOA9byd+9hEs0 Nz2le3vTxU6GZ5+7/2mraw6dorsTRx4y6cHYmSj2j85T9AbjJ+ERLNeWIqz+1rB59UQi u060HgY8mWcVluJOdDkKSLKoU7s20mlCKZrlLoizCqIbqe53yZDSDB786f5SW26xKs8U +y6MQgSRagRhaxOnVAU9mQPqYgIbNW0xF91PoaIZTRtAoY7vMhCGvyrnYNJZ0HP51zle EnPynT0XmRKuY/PKfxWYlVyCR0FCaevXaNAhoKoGKbQ8hw75hWWSVYnmtQGrM7j95c9/ 2TQw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=bjTJ01Uk; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Original-Received: from mout01.posteo.de (mout01.posteo.de. [185.67.36.65]) by gmr-mx.google.com with ESMTPS id bi35-20020a0565120ea300b00503ce43f46asi1599500lfb.11.2023.10.02.07.17.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 07:17:22 -0700 (PDT) Received-SPF: pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) client-ip=185.67.36.65; Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 15BE3240028 for ; Mon, 2 Oct 2023 16:17:22 +0200 (CEST) Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RzjhK5GD6z9rxM for ; Mon, 2 Oct 2023 16:17:21 +0200 (CEST) Content-Disposition: inline In-Reply-To: X-Original-Sender: bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=bjTJ01Uk; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net 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:33141 Archived-At: I would search for the output suffix in the YAML file itself: export SUFFIX=3D"$(grep -x 'to: .*' defaults.yml | cut -d ' ' -f 2)"; for f in *.md; do pandoc \ --defaults=3Ddefaults.yml \ "$f" \ --output=3D"${f%.md}.$SUFFIX"; done Instead of "to", you can use a dedicated variable in the YAML file if you e= xport to output formats whose name differ from their file suffix (e.g. late= x/tex or commonmark/md). Le Monday 02 October 2023 =C3=A0 06:58:57AM, Martin Post a =C3=A9crit : > I used to do this (in macOS / zsh), as seen in the Pandoc FAQ: >=20 > for f in *.md; > do pandoc \ > --defaults=3Ddefaults.yml \ > "$f" \ > --output=3D"${f%.md}.htm"; > done >=20 > But I am now changing output formats in defaults.yml (or additional defau= lt > files), e.g. =E2=80=9Cto: docx=E2=80=9D, and the target files obviously s= houldn=E2=80=99t have =E2=80=9C.htm=E2=80=9D > then. >=20 > How can I modify the for loop so the correct suffix is applied for the ou= tput > format set in a defaults file? >=20 > (I realize I could manually add a =E2=80=9Coutput-format-suffix=E2=80=9D = shell variable and use > that in the loop, but I hope there=E2=80=99s something more elegant than = that.) >=20 > Thank you. >=20 > -- > 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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit [2]https://groups.google.com/d/m= sgid/ > pandoc-discuss/e8d686ec-e667-4dff-97c3-133af2a6f731n%40googlegroups.com. >=20 > References: >=20 > [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [2] https://groups.google.com/d/msgid/pandoc-discuss/e8d686ec-e667-4dff-9= 7c3-133af2a6f731n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter --=20 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 e= mail 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/ZRrQ8TfHplqAupSJ%40localhost.