From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29034 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ian Barnes Newsgroups: gmane.text.pandoc Subject: No indent after horizontal rule Date: Mon, 16 Aug 2021 07:03:55 -0700 (PDT) Message-ID: <9953168b-aa53-4c75-b18b-612ddd8a3ddfn@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_2224_423495215.1629122635694" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33968"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDS35M7NVUMRBTHA5GEAMGQEWSOKWPQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Aug 16 16:04:03 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oi1-f191.google.com ([209.85.167.191]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mFdDe-0008cR-Il for gtp-pandoc-discuss@m.gmane-mx.org; Mon, 16 Aug 2021 16:04:02 +0200 Original-Received: by mail-oi1-f191.google.com with SMTP id t42-20020a05680815aab0290267a116f6b3sf6518667oiw.0 for ; Mon, 16 Aug 2021 07:04:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=uA5RgHrOmCkhgR9AaGCfrrIh5xZJ6GFfFGWxgAe5JfY=; b=VB0gMit6V43udkvbaw7Cix8bbxtrDD3BTbxWCsqG2FW9TQuz53p9NQOUYfCDFJENbE f1n5nzyRB5CXARs7YK70kHLcx1w7vmCdXMCP7FE6goS6bdjcqSKyOjL9gwQJxpUl6Pz1 ljvCIErRoeFdxk5Nr+vdKIUkan92PwgnRPN25DspjAPFSOPYEbVEkDVWbW6TMdOmhH/w kpbMCpluJ2kzg37VqHGWXY/xCQOXSF4iGFv6WLSNp5BOGoo1C+cjEfmgR6UnZwXtNN40 iVq8l7f9TjBmlEhH+kNM9KDmknEEPq4S+OZm3GF2200iZQcw93Cg+WzPCnUc4MU3yITa K9Qg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:subject:mime-version:x-original-sender :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=uA5RgHrOmCkhgR9AaGCfrrIh5xZJ6GFfFGWxgAe5JfY=; b=QO5R/5yWUqxCRALgh/x/Bxg5my6Xm80wBf1LgCBCEFI+74mxsh/upHcdMbhfzWkjr+ LqeV/lrVGfcUqeiWu80+3XtY9Y+eCipr6Q+Xc8DzM/1GLN/gy0cefnQwCUkrK4GibRPu w7IvURMytGd9l06NYwchRt3/ziOD1CJzHHuQmC2RshOstKnw2QxByzJgnl2tGAHSg55o ILTlTXTiL32A/ZIA1vOx7yS0jEv8Nt6svBuTMi1S3zwRVI7EXUgLeMKA4/TS48P7feec n5hh10WU+qU413vSyILVRXPW6sjFTFB9yAHusU+Uz+7PiSstN7a2QaI/CH3hNClfEYyU 2NsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=uA5RgHrOmCkhgR9AaGCfrrIh5xZJ6GFfFGWxgAe5JfY=; b=O7bU1mA8F9eFZ0PvdbsIpftnGSEFc5VJ7UM/w/0wq5KeP5iB7mfeDH9/qoxhge5Kez GZYmBPoT3HlGtdx60ir51t0tKNS64TO8CC4HlJ67ypsqcxqzPnTu73rbpn4iOqlcsOxB 5vR8cnzLfIEac6MMs9wfOYg2JuvV9LV5uFfkUCfcgWA2zce8PTvUyavipBYxMzGpiJ+C WrhwJHsQ3hebBLE7DDGUuJ8qSZHmyfeEyC0HCTlVESN1MS87JNSavkB+nLef1Xadr7kc fr+MX8l5tWoA2uWt35CYLsO0UWLup0ACcDYqy9PHdZAsVJgxEHTx7lqjME2FIPLZ++op DMBA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM5318AxnSYh3rLx8g3uXvkws+O5un4I63iGabhO2hOuqtiHsqM7iu Z55ix9qe9sawcS7qAGtXQ4g= X-Google-Smtp-Source: ABdhPJwgaDTwmUAeLsPJVv0AqF1CxD+sT8AvLJ0v5fp4NplkiscbHwdFfeUUpi5KjwjQ5GN++zK1qw== X-Received: by 2002:a05:6830:411a:: with SMTP id w26mr8509891ott.127.1629122638207; Mon, 16 Aug 2021 07:03:58 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6808:20a7:: with SMTP id s39ls433847oiw.11.gmail; Mon, 16 Aug 2021 07:03:56 -0700 (PDT) X-Received: by 2002:a54:4083:: with SMTP id i3mr12169289oii.164.1629122636351; Mon, 16 Aug 2021 07:03:56 -0700 (PDT) X-Original-Sender: ianbarnes1963-Re5JQEeQqe8AvxtiuMwx3w@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:29034 Archived-At: ------=_Part_2224_423495215.1629122635694 Content-Type: multipart/alternative; boundary="----=_Part_2225_1892225826.1629122635694" ------=_Part_2225_1892225826.1629122635694 Content-Type: text/plain; charset="UTF-8" It's not quite the same situation as the various discussions about not wanting indents after blockquotes, but similar enough that perhaps my solution is interesting for others. I'm converting Markdown to PDF via LaTeX, with indent:true, and I'm using horizontal rules as scene or section breaks. I found the indent on the first paragraph after such a break ugly and wanted to do an automatic \noindent after every horizontal rule. This turned out to be pretty easy with a Haskell filter. As it's the first time I've written anything in Haskell, I thought I'd post it here for feedback. Seems to me like maybe there's a more concise way to do the same thing. Also this could obviously be adapted to actually remove the horizontal rules and replace them with the Pandoc internal representation of a vertical skip or blank line (whatever that is). import Data.Text import Text.Pandoc.JSON main :: IO () main = toJSONFilter noIndentAfterHorizontalRule noIndentAfterHorizontalRule :: Pandoc -> Pandoc noIndentAfterHorizontalRule doc = let Pandoc meta blocks = doc in Pandoc meta (mapAfterHorizontalRule noIndentifyPara blocks) mapAfterHorizontalRule :: (Block -> Block) -> [Block] -> [Block] mapAfterHorizontalRule f (HorizontalRule : block : blocks) = HorizontalRule : f block : mapAfterHorizontalRule f blocks mapAfterHorizontalRule f (block : blocks) = block : mapAfterHorizontalRule f blocks mapAfterHorizontalRule f [] = [] noIndentifyPara :: Block -> Block noIndentifyPara (Para xs) = Para (RawInline (Format (Data.Text.pack "tex")) (Data.Text.pack "\\noindent ") : xs) noIndentifyPara x = x -- 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/9953168b-aa53-4c75-b18b-612ddd8a3ddfn%40googlegroups.com. ------=_Part_2225_1892225826.1629122635694 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable It's not quite the same situation as the various discussions about not want= ing indents after blockquotes, but similar enough that perhaps my solution = is interesting for others.

I'm converting Markdown to PD= F via LaTeX, with indent:true, and I'm us= ing horizontal rules as scene or section breaks. I found the indent on the = first paragraph after such a break ugly and wanted to do an automatic \noindent after every horizontal rule. This tu= rned out to be pretty easy with a Haskell filter.

= As it's the first time I've written anything in Haskell, I thought I'd post= it here for feedback. Seems to me like maybe there's a more concise way to= do the same thing.

Also this could obviously be a= dapted to actually remove the horizontal rules and replace them with the Pa= ndoc internal representation of a vertical skip or blank line (whatever tha= t is).

import Data.Text=
import Text.Pandoc.JS= ON

main :: IO ()
main =3D toJSONFilter noIndentAfterHorizontalRule

noI= ndentAfterHorizontalRule :: Pandoc -> Pandoc
noIndentAfterHorizontalRule doc =3D
  let Pandoc meta blocks =3D doc
   in Pandoc meta (mapAfterHorizonta= lRule noIndentifyPara blocks)
<= br>
mapAfterHorizontalRule :: (= Block -> Block) -> [Block] -> [Block]
mapAfterHorizontalRule f (HorizontalRule : block : blocks)= =3D
  HorizontalRule : f = block : mapAfterHorizontalRule f blocks
mapAfterHorizontalRule f (block : blocks) =3D block : mapAfterHori= zontalRule f blocks
mapAfterHor= izontalRule f [] =3D []

noIndentifyPara :: Block -> Bl= ock
noIndentifyPara (Para xs) = =3D
  Para (RawInline (For= mat (Data.Text.pack "tex")) (Data.Text.pack "\\noindent ") : xs)
noIndentifyPara x =3D x

--
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://groups.google.com/d= /msgid/pandoc-discuss/9953168b-aa53-4c75-b18b-612ddd8a3ddfn%40googlegroups.= com.
------=_Part_2225_1892225826.1629122635694-- ------=_Part_2224_423495215.1629122635694--