From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/33143 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 15:18:38 +0000 Message-ID: References: <5843b3a9-e780-4816-8a6d-70277d1295d6n@googlegroups.com> 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="13975"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDCINCES2QJRBVF65OUAMGQELZV2LPY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Oct 02 17:18:49 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wm1-f61.google.com ([209.85.128.61]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1qnKh6-0003Jl-J0 for gtp-pandoc-discuss@m.gmane-mx.org; Mon, 02 Oct 2023 17:18:48 +0200 Original-Received: by mail-wm1-f61.google.com with SMTP id 5b1f17b1804b1-3fe182913c5sf144593195e9.0 for ; Mon, 02 Oct 2023 08:18:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696259928; cv=pass; d=google.com; s=arc-20160816; b=Mdj86RBv3axaziF8eLn3LUh2/VR/GSFo10LUNgu0F3/KEe55pcgdmw5rg4ZuhQcr8f YE6YThvlgun+NTRy12RFCPsXh8+Qh/DhO8ExYKTJ1p5GGT+Fh4i7NFasSj1P0V4Ym4V6 DfmsbQ8i4pDdeGqprSZ5blr/ULQpfBq+olFGEmR9JHsQAprzgwkz07AZJ+ViVAh/ATR+ lA79ddaRL5dd2go4dQNphJP/wh/7kT1umUpI41nMct/hN4OQ13k4Gj+mbDlo8kRDb5sl rr2n7R+vdo6fcg4OnI0gjeEJGSnx7sJmM2jGKwW6VLLMqWXV78Ep5A+e2sIwy0XoHm5y 2+Rw== 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=/qFOiP9lM6DooxKtA4BPgx7OXfsxl5fGiOFVO5jbLg0=; fh=m01AhCNo7xUywHldCVYouaJypLlN7JgtNYbImzBf4N4=; b=VIGZ4c2njRJHFl1vdn1voF2BF5i7mQ4j/bn7p3hz/Af6DlY53kj7g3OW4NzMN9UHdL 6P0w0TO7ifXWod2RsPtY8odMG2Ybn4xa3dynH8LKRFonjDeDqBKzTRa0B0/KcUXPX4Mj vwbGFJDjvrZUvShKfyLB0lpCkqUwR3rzoV6vZ2V/wFMXBq2F1db6KO8ozsvvFzx5BYpF 8CAtLJsPZCYXe5l45e3F13V+yEYDlBIAMwGvz+8vOP/Gwab6elEk7GJcPe9p2x11JtIu Gjyp2g0gtGOvj7zTalPW3CN/1JCSXagJgkirPimw+Gb7mwzr9DW0xTR4iWAfGpysvTif ZSLw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=APpUv8bR; 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=1696259928; x=1696864728; 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=/qFOiP9lM6DooxKtA4BPgx7OXfsxl5fGiOFVO5jbLg0=; b=Z8D7o7GcsKeJwYCjOlbxTQbPbptNksPI2Iu7hoBjG9ajKnJg7yVoA9nUOJZMhO0qp1 DaTeBtAl6l1mafmaD8r1wPSGTpCI2AgLC2h0vVOJbnEjtSxDOYSvlkH142v7vl2Leu/O qcLeJunIKj4+/+YTwOSxywZlfWbYE+eBxh1bQJZAsB0UUdJpaLUWd8ZPqiH4v08B+au7 3BYQ9/T1Vn6gaVrZJtC20VP76grBhCIKeAGJ81zJl6NhOcL7k8vcWw1vZGWkDIpE1aAx X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696259928; x=1696864728; 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=/qFOiP9lM6DooxKtA4BPgx7OXfsxl5fGiOFVO5jbLg0=; b=xTa7alECVNI1oTwzrjGx+OMG//QNqk4BrzxYiBTtqA4SNVNYJiI7JCLLbRuBbSFt+k QB0jXpmR+xvJepB69n7Z6Oh4ecjeVwFxLBDOK8qXuwpMBf3wpDrf6imKqpae4WgOeEWb hrVTsSv5EdrSEfimnoZ4DOuomLzUeXkWZsCA+cIwV2Tzutkd+ll7TGd4zqqzYed954NB RpM114CI1/5r00vyltK0yps+nMyL Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOJu0YyYsXUAxie3rmv89OARrOjbbv9AYQe8R6HDLSR9AD0clCeZWoSb CZ66CksP6BmTVyWjBNiLP6M= X-Google-Smtp-Source: AGHT+IHh+DoWUGYQUPK+Uavly1Wzo4QUmsusHyKTtjO5xSbAFmc2ch456SOi8OkWaVXFoyhkD0rn/A== X-Received: by 2002:a7b:c419:0:b0:405:4002:825a with SMTP id k25-20020a7bc419000000b004054002825amr10090944wmi.13.1696259927632; Mon, 02 Oct 2023 08:18:47 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a1c:7204:0:b0:405:2359:570a with SMTP id n4-20020a1c7204000000b004052359570als325979wmc.1.-pod-prod-01-eu; Mon, 02 Oct 2023 08:18:42 -0700 (PDT) X-Received: by 2002:a1c:7405:0:b0:403:bb3:28c9 with SMTP id p5-20020a1c7405000000b004030bb328c9mr11362403wmc.38.1696259922533; Mon, 02 Oct 2023 08:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696259922; cv=none; d=google.com; s=arc-20160816; b=JPnMK5eE1fYKNxVbu0AjsRMzgyB7HHLgDMoJw1G3iIRAlEZV50612zsgJFNr6uuk3B mE8f6+L67VQES194dOCwuGvWWR2asXRlcKyWi31ZUPlZ3YEvT83vt2kRQZL10GlDryZb FPgjqr2t/Q3xRv8NmsIUbNNYxl0Nd4YFLYL2wuwMItcxohapdtzAGRz2EIJ7SJvgMUaN sWDQwbLPs5MszNBulglmnGglIH9Hn40U7I88um6dto5+IQ8NYRs5Tjv4TE4cK3xz5gW2 JkVU683olhTXn9y8Qzzj4crB0ExZhJdgYKoOZoQwiF78pOhaaRUqC5OzbhizrlSXPGHS G6eg== 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=jg2IMTixvu0+4rWFPN4jwe6exPr4N28qa1Ed7AnHsIY=; fh=m01AhCNo7xUywHldCVYouaJypLlN7JgtNYbImzBf4N4=; b=CdQHDwFlJmyRO8wKY58q2VDMXJNxk6Fs8Xd582gB5GnEyjP+CPUOdpTHbOhHIWBXBa M6yReZw+uq5XwCJ+DeYy4o+ZYMUiGbSVTT7Xaxfu0trrZQHBl2wyaoR6UiGZDiU6PAvl a6NReqeu7YI8lxbKyvWaRyw8B7wzK/S+rEfdrCV3nz5KBSJvLlhb5lEi397sD2mIsNVC gFhe7gS7XBIxLBZR1AuN1dk2tD3NqeUQfpDOPjlAWmhZGXqXjxHlJGeH9KVmuM6ekFP0 CK/yhTak8IeCw4wNiVwkFQ4BAYlc7MT1uBJ6HiK92KlGgp5slCSPtPrVw0g6XUD9lJgT BdKg== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=APpUv8bR; 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 ay15-20020a05600c1e0f00b004045b3248b8si665030wmb.0.2023.10.02.08.18.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 08:18:42 -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 693D6240027 for ; Mon, 2 Oct 2023 17:18:41 +0200 (CEST) Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Rzl3512ghz6twJ for ; Mon, 2 Oct 2023 17:18:41 +0200 (CEST) Content-Disposition: inline In-Reply-To: <5843b3a9-e780-4816-8a6d-70277d1295d6n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 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=APpUv8bR; 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:33143 Archived-At: That's why I wrote the last sentence! Le Monday 02 October 2023 =C3=A0 08:06:48AM, Martin Post a =C3=A9crit : > Thank you, Bastien. This is a good idea, but the Pandoc output format is = not > necessarily the proper generic file suffix. E.g., for to: markdown or > markdown_strict, one would want/expect =E2=80=9C.md=E2=80=9D, html5 =3D .= html etc. For > chunkedhtml, it would actually (have to) be empty, so Pandoc will create = a > folder with HTML files.=C2=A0 >=20 > Hmm. >=20 > Bastien DUMONT schrieb am Montag, 2. Oktober 2023 um 16:17:28 UTC+2: >=20 > I would search for the output suffix in the YAML file itself: >=20 > 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 >=20 > Instead of "to", you can use a dedicated variable in the YAML file if= you > export to output formats whose name differ from their file suffix (e.= g. > latex/tex or commonmark/md). >=20 > 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: > > > > for f in *.md; > > do pandoc \ > > --defaults=3Ddefaults.yml \ > > "$f" \ > > --output=3D"${f%.md}.htm"; > > done > > > > But I am now changing output formats in defaults.yml (or additional > default > > files), e.g. =E2=80=9Cto: docx=E2=80=9D, and the target files obvio= usly shouldn=E2=80=99t have > =E2=80=9C.htm=E2=80=9D > > then. > > > > How can I modify the for loop so the correct suffix is applied for = the > output > > format set in a defaults file? > > > > (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.) > > > > Thank you. > > > > -- > > 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, s= end an > email > > to [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [2][1]https://groups.googl= e.com/ > d/msgid/ > > pandoc-discuss/e8d686ec-e667-4dff-97c3-133af2a6f731n%[2] > 40googlegroups.com. > > > > References: > > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [2] [3]https://groups.google.com/d/msgid/pandoc-discuss/ > e8d686ec-e667-4dff-97c3-133af2a6f731n%40googlegroups.com?utm_medium= =3Demail& > utm_source=3Dfooter >=20 >=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 [4]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit [5]https://groups.google.com/d/m= sgid/ > pandoc-discuss/5843b3a9-e780-4816-8a6d-70277d1295d6n%40googlegroups.com. >=20 > References: >=20 > [1] https://groups.google.com/d/msgid/ > [2] http://40googlegroups.com/ > [3] https://groups.google.com/d/msgid/pandoc-discuss/e8d686ec-e667-4dff-9= 7c3-133af2a6f731n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter > [4] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [5] https://groups.google.com/d/msgid/pandoc-discuss/5843b3a9-e780-4816-8= a6d-70277d1295d6n%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/ZRrfTpqIopvrxPei%40localhost.