From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/30336 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: BPJ Newsgroups: gmane.text.pandoc Subject: Re: problem setting style after blocktext in docx output Date: Fri, 11 Mar 2022 18:14:42 +0100 Message-ID: References: <86c4d6cd-4ea3-41ad-aae9-c301f049a2can@googlegroups.com> <58f80fd9-5017-4ae2-8a86-225d3fa79463n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000d3c31705d9f477ab" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="681"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCWMVYEK54FRBDEHV2IQMGQEB4C76JY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Fri Mar 11 18:14:56 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ed1-f58.google.com ([209.85.208.58]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nSiqu-000AWV-Fe for gtp-pandoc-discuss@m.gmane-mx.org; Fri, 11 Mar 2022 18:14:56 +0100 Original-Received: by mail-ed1-f58.google.com with SMTP id b9-20020aa7d489000000b0041669cd2cbfsf5203373edr.16 for ; Fri, 11 Mar 2022 09:14:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1647018896; cv=pass; d=google.com; s=arc-20160816; b=DYawjsDROZ48HBQuWvoP4l5oh5PGNMm2h3hWD/avl6luAlPi59QWi2Rf8zHnyX/dKC ls5J9iTaZDOX1Mye+JmqryX6UstOGWcHvv/00eoaUnC4jwe6ZZevHb9uyD9auMSNX3D+ LgTy5Mhk9cgm7YnAy++oX4ep9dDLW0ESVCKeesnd2zWp7hb5R3kn1t8BON9W0Knx0uhq Q7tbkfvvroTE4Iz9VUPVC1PP0jkTMrTIijOeNqswNVqw/q5YJ+Vs52fvNLQm5vbb6K/w r/Zo5hpp8F4IKOKlwUv9zESljM127o/bx6xoLJrz45PFPTZQK9N5IfjXymy+H9JbJ44Y C0DA== 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 :dkim-signature; bh=PDhfuQTG/EfOfoLbatQrilPUY8pGsCcdiK3AVKvyigw=; b=Sk2H0Oqapk7CH0q1yYQwIbsUlUt7PVGHHRba8tczGxQRqVC34yg3BmOiqiG+vxM/q7 A0S33QayRSPXRRf4s+KOMt+uTMtKVCX/TVvRYU7KqJcx4oM5lYVN6fIX5Sh5AbIBrdNr aF0a0+rD0/0cZegmyTfYZCPPwhxsnmysWunKvVF4M0Nsinp20Qvq3MQj/nloeuBc8avz Lt7U4s4PDTVprgRgM8a0K+vSTisI7E9QGLj2vtZ2j381lUyz3AIQrOZvYPZE+QBZrTZv nZg/JMdQAE/PdFDFrXGpZvVydg2/nG7SCgpaeIixDrIqYSA8v3md4VCLf2YqkgXLhl5y lmXA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NaSjUan1; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::12b as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:mime-version:references:in-reply-to:from:date:message-id :subject:to:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=PDhfuQTG/EfOfoLbatQrilPUY8pGsCcdiK3AVKvyigw=; b=fGQnuFoy7Ds9YYOa//jaCN7/IH1nkfAQapW5KyE+RzZPa/AEftP7s+qHr5UFdsNs46 kSDBnmOiHWe+nzlDeeid4LoFcW/JwNNDEpoXEuaSVqqOMGuyGy5kA1XEjQ65wGyKclCc aDOg8xd4SIvl05tlXVZnRR+hmHf/wXFGcb0kmJq2ldk+sGqOr7jgmrhlHoaZ5BbV4VOt 8qjNoa8iqy9KENXnaOHv4GulzqhK11KImdplkstCaArZbYvb76aAZzhDwsaOtJwhZ6ul xxJO8JC4EunI58kASxPnR3M1oriM+tbaMYctyLnNJCq7SB4P0UxZxJF9wdv4jjvl126B RzeA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=PDhfuQTG/EfOfoLbatQrilPUY8pGsCcdiK3AVKvyigw=; b=enk+4RwBy7VzuJAcz39cEnpKeMLAhuEgJ1tX2YapddzJ5+vfzfjaz+gOLFXSyqNKRy XY6RUoEwmzwOQWhgVAILoNtyXw5YLHQ52RlnKVOuUKHtFwLBvBinl5VEMtaKpPzdC7M0 TZ3qAXoHG9CULHXAW76LDbVdIpgtGH0jG1pWso7lBKSeMc5lt4PeQpydZkxJWowGge0Z +RPEnACN9mkat1UV9XbfrzJm2O0A1OBsFP1hMQZ6/1/ogvj2FKzqaJmWcIEpoJUo3jXy yHXNNqQ/euHc2hp2rjis7CqDLPmHaQevGwTVF0hJKMkSbDROeERbj86WAqcwvIfm9IPO UwYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:mime-version:references:in-reply-to:from :date:message-id:subject:to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=PDhfuQTG/EfOfoLbatQrilPUY8pGsCcdiK3AVKvyigw=; b=67SrZPwlH4aZ57syGUSgXhojF0WpU3Z58MMyLVInUl5VNCnWsPMv0XrF00l1oKk5yp 6Gx1795twvu7YMPywelGBiLkyFt/FQtoKLdnZ9nmmqsHTir1aHtkDiczwwvko0ln/GbE iJsFcqhFb7rXMuK6vEY0879cRQvVE0D/C8NXtyq6c8/zrtta2v5MPyDejECznUYxXWco lSj1QwhNx87Nop4+024CzBULEJP608H/D3S+4HBKTMu0mwu7ai4SKDv+Kt9i3R5MeHym VqBT9+Jot+T6lNB9OZqzfJL2ARrLaX0gO/aymLmrk4YRr8gyDS7Ugi3awgbvOMeMmawc 2tVQ== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM5307ofbfE0Zc7qNGuRcaEZZoxtU+q9I0942UWtJUdVe6DITD59Vq Y85WD9XUIYEK5ueinhJ9/CU= X-Google-Smtp-Source: ABdhPJz8GlYYPZfHSZAnQMZ0JfS+ciXZGTkJrHSZLQcN3AXInukfQxITGg6o8+hZhrJP78ZJR0G8sQ== X-Received: by 2002:a17:907:3e82:b0:6da:6f15:ff38 with SMTP id hs2-20020a1709073e8200b006da6f15ff38mr9499765ejc.324.1647018895911; Fri, 11 Mar 2022 09:14:55 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a17:906:7105:b0:6db:1d5:3993 with SMTP id x5-20020a170906710500b006db01d53993ls1137458ejj.7.gmail; Fri, 11 Mar 2022 09:14:51 -0800 (PST) X-Received: by 2002:a17:907:3da8:b0:6da:9e3a:b69 with SMTP id he40-20020a1709073da800b006da9e3a0b69mr9428013ejc.76.1647018891306; Fri, 11 Mar 2022 09:14:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647018891; cv=none; d=google.com; s=arc-20160816; b=j1Acb1EJiJTYZuoAxk7ZsN0Zfy/pegqsMiClTA581FHMiJlnYxMOmOVCivwTEoZPNn 60jPoE2+3UG1INMl1jVM+Z9x5/LEtFnp+nGCgXanHmpBolYylFOQvbId8pEugrE0F9OU N2WhcnXc2vaKNnfwadDPjz8+Z/XZJu6SknHoWlcsjsQ1orJNiTHTqysRSV+2JzDe8Ffg enOlkaG+cwgtUQ3QLsJ89GxBcCwYAHTf1pEDK2lYOkdDG6+CQ+c/3cJMY1PBvsWK9gJU MbcxpXVV4pITnzmINcOul4lS6d4a/btG8tLCzkUaGAEwCwH5ypF8T3GgU91ca4TdoGCM 0ohg== 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=G05T8V4pcPxIe4uO1kpJblBmCLiK/vX7XjqiGBQ3y7I=; b=ZOfvwcLywYqwgJcKKdsF4VzBdH23zItw8Y9LvfA9Z3VwiFWCxWpTRZBV83+Isb9XFs dTm1LTCT54kalSTnxyzohvqzU/2uWuDS3BNgx7wTNQzZSfodcyIgf4j4FNDMUN5D+bSN ehLzEAVN/XSt8fSsmEi/+XpVOb0CMPbpiwG4oqf970J46HqbuCdOhNDOrZ4P8ox2SBJy YYXG+61UkYxTrFf2QL7WuKIhYpHmcw3nzy/I+vfGHd3uwPYInuKvOjti/Fsv4nTTE62J H3g/2YzCDPRcn6neWA2D/JUKb6DD0Pwt3keMZ+qI8J/LgHpTfN5MGIenAnHOFOKsT2nP wXMg== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NaSjUan1; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::12b as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Original-Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com. [2a00:1450:4864:20::12b]) by gmr-mx.google.com with ESMTPS id r16-20020aa7cb90000000b00410871504d8si479108edt.0.2022.03.11.09.14.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Mar 2022 09:14:51 -0800 (PST) Received-SPF: pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::12b as permitted sender) client-ip=2a00:1450:4864:20::12b; Original-Received: by mail-lf1-x12b.google.com with SMTP id e6so9547782lfc.1 for ; Fri, 11 Mar 2022 09:14:51 -0800 (PST) X-Received: by 2002:ac2:4f84:0:b0:448:3e65:7369 with SMTP id z4-20020ac24f84000000b004483e657369mr6474355lfs.583.1647018889166; Fri, 11 Mar 2022 09:14:49 -0800 (PST) In-Reply-To: <58f80fd9-5017-4ae2-8a86-225d3fa79463n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NaSjUan1; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::12b as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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:30336 Archived-At: --000000000000d3c31705d9f477ab Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable You can do it, but there are quite a few things you need to think about: ``````lua function Para (para) if 'RawInline' =3D=3D para.content[1].tag then -- Format may be 'tex' or 'latex' if para.content[1].format:match('tex$') then para.content:remove(1) -- It may be followed by a space if 'Space' =3D=3D para.content[1].tag then para.content:remove(1) end return pandoc.Div( {para}, {['custom-style'] =3D 'Body Text 2'} ) end end return nil end `````` I would do it the other way around and insert the `\noindent` when producing LaTeX (although I think it is not needed, since Pandoc sets `parindent` to zero). The code is much simpler! ``````lua function Div (div) if 'Body Text 2' =3D=3D div.attributes['custom-style'] then if 'Para' =3D=3D div.content[1].tag then div.content[1].content:insert( 1, pandoc.RawInline('latex', "\\noindent ") -- Note the trailing space= ! ) return div end end return nil end `````` HTH, /bpj Den fre 11 mars 2022 17:21Paul Kelleher skrev: > Thank you! I was able to get this to work great for compiling from md to > docx. But if want to compile from md to pdf, I need "\noindent". If I wro= te > using \noindent, could a filter be used to strip out that latex command a= nd > then wrap the paragraph in that custom-style div? > > On Friday, March 11, 2022 at 1:23:03 AM UTC-6 BP wrote: > >> You can use a custom-style div: >> >> ``````markdown >> ::: {custom-style=3D"Body Text 2"} >> Paragraph text. >> ::: >> `````` >> >> >> >> Den tors 10 mars 2022 21:45Paul Kelleher skrev: >> >>> Thank you so much for posting this filter that converts the paragraph >>> after block quote to Body Text 2! It worked great for me. But: I also h= ave >>> other element environments (e.g. equations) that I'd like to suppress >>> indents after when I use pandoc to compile md to docx. I couldn't get y= our >>> complex paragraphs filter to work for me. However, I'm already used to >>> writing "\noindent" from my LaTeX days (and it helps to have that if I = want >>> to compile md to tex anyway). Would it be possible to write a filter th= at >>> assigns the Block Text 2 style to every paragraph that starts with >>> "\noindent"? >>> >>> On Wednesday, October 27, 2021 at 11:57:34 AM UTC-5 Bastien Dumont wrot= e: >>> >>>> If all you want is to prevent indentation, you can use a filter that I >>>> wrote for a similar need: >>>> https://github.com/badumont/lua-filters/tree/complex-paragraphs/comple= x-paragraphs >>>> (which supports other output formats and enables you to control more >>>> precisely what is indented or not). If you really need to set a style,= the >>>> following filter should work: >>>> >>>> ``` >>>> is_preceding_BlockQuote =3D false >>>> >>>> function Block(block) >>>> if block.t =3D=3D 'BlockQuote' then >>>> is_preceding_BlockQuote =3D true >>>> elseif is_preceding_BlockQuote =3D=3D true then >>>> is_preceding_BlockQuote =3D false >>>> return pandoc.Div(block, {['custom-style'] =3D 'Body Text 2'}) >>>> end >>>> end >>>> ``` >>>> >>>> Le Wednesday 27 October 2021 =C3=A0 09:32:34AM, Landon Yarrington a = =C3=A9crit : >>>> > To clarify, in the MRE above, my goal is to get the paragraph >>>> immediately after >>>> > the blockquote to render as "Body Text 2" according to the style in >>>> the >>>> > ref_template.docx. Using this and every other stylesheet I've made, >>>> the >>>> > following paragraphs always come out as style "First Paragraph." >>>> > >>>> > On Wednesday, October 27, 2021 at 12:28:02 PM UTC-4 Landon Yarringto= n >>>> wrote: >>>> > >>>> > I'm trying to process block quotes in a way such that the following >>>> > paragraph directly after a block quote is styled as a continuation o= f >>>> the >>>> > paragraph in which the blockquote is nested. I tried several >>>> different >>>> > styles, but cannot seem to achieve this. I almost filed an issue on >>>> GH, but >>>> > thought twice :-) >>>> > >>>> > I'm using pandoc 2.15 with the following command. >>>> > >>>> > `pandoc -N -t docx -f >>>> > >>>> markdown+markdown_attribute+mmd_link_attributes+simple_tables+multilin= e_tables+auto_identifiers+table_captions+yaml_metadata_block+raw_attribute+= implicit_figures+latex_macros+header_attributes >>>> >>>> > --reference-doc=3Dref_template.docx example.md -o TEST_example.docx` >>>> > Is this a user-error, a problem with my ref_template.docx, or what? >>>> > >>>> > And here's `example.md` >>>> > ```` >>>> > # Heading1 >>>> > >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. >>>> > >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > >>>> > ## Heading 2 >>>> > >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. >>>> > >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. >>>> > >>>> > > Block quote time. Block quote time. Block quote time. Block quote >>>> time. >>>> > Block quote time. Block quote time. Block quote time. Block quote >>>> time. >>>> > Block quote time. Block quote time. Block quote time. Block quote >>>> time. >>>> > Block quote time. Block quote time. Block quote time. Block quote >>>> time. >>>> > Block quote time. Block quote time. Block quote time. >>>> > >>>> > Back to the text. Back to the text. Back to the text. Back to the >>>> text. >>>> > Back to the text. >>>> > >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. >>>> > ```` >>>> > >>>> > -- >>>> > 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> > To view this discussion on the web visit [2] >>>> https://groups.google.com/d/msgid/ >>>> > pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can% >>>> 40googlegroups.com. >>>> > >>>> > References: >>>> > >>>> > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >>>> > [2] >>>> https://groups.google.com/d/msgid/pandoc-discuss/86c4d6cd-4ea3-41ad-aa= e9-c301f049a2can%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter >>>> >>>> -- >>> 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 a= n >>> email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/pandoc-discuss/bc83b25d-d676-4582-ba0= 4-830e3f378c2an%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/58f80fd9-5017-4ae2-8a86-= 225d3fa79463n%40googlegroups.com > > . > --=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/CADAJKhBBTXWbvkdARhZTA%3DeNvmS%2B48%3D0wS5_EGb9CCduJVJ4EA%40= mail.gmail.com. --000000000000d3c31705d9f477ab Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
You can do it, but there are quite a fe= w things you need to think about:

``````lua
function Para (para)
=C2=A0 if 'RawInline' =3D=3D para.content[1].tag then
=C2=A0 =C2=A0 -- Format may be 'tex' or '= latex'
=C2=A0 =C2=A0 if para.content[1].format:m= atch('tex$') then
=C2=A0 =C2=A0 =C2=A0 para.= content:remove(1)
=C2=A0 =C2=A0 =C2=A0 -- It may be = followed by a space
=C2=A0 =C2=A0 =C2=A0 if 'Spa= ce' =3D=3D para.content[1].tag then
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 para.content:remove(1)
=C2=A0 =C2= =A0 =C2=A0 end
=C2=A0 =C2=A0 =C2=A0 return pandoc.Di= v(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {para},
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {['custom-style'] =3D 'Bo= dy Text 2'}
=C2=A0 =C2=A0 =C2=A0 )
=C2=A0 =C2=A0 end
=C2=A0 end
=C2=A0 return nil
end
``````

I would do it = the other way around and insert the `\noindent` when producing LaTeX (altho= ugh I think it is not needed, since Pandoc sets `parindent` to zero). The c= ode is much simpler!

```= ```lua
function Div (div)
=C2= =A0 if 'Body Text 2' =3D=3D div.attributes['custom-style'] = then
=C2=A0 =C2=A0 if 'Para' =3D=3D div.cont= ent[1].tag then
=C2=A0 =C2=A0 =C2=A0 div.content[1].= content:insert(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 1,
=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 pandoc.RawInline('latex&#= 39;, "\\noindent ") -- Note the trailing space!
=C2=A0 =C2=A0 =C2=A0 =C2=A0)
=C2=A0 =C2=A0 =C2= =A0 =C2=A0return div
=C2=A0 =C2=A0 =C2=A0end
=C2=A0 =C2=A0end
=C2=A0 =C2=A0return= nil
=C2=A0end
=C2=A0``````
=C2=A0
HTH,

/bpj

Den fre 11 mars 2022 17:21Paul K= elleher <paul-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org<= /a>> skrev:
Thank you! I was abl= e to get this to work great for compiling from md to docx. But if want to c= ompile from md to pdf, I need "\noindent". If I wrote using \noin= dent, could a filter be used to strip out that latex command and then wrap = the paragraph in that custom-style div?=C2=A0

On Friday, March 11, 2022 at 1:= 23:03 AM UTC-6 BP wrote:
You can use a custom-style div:
``````markdown
::: {custom-= style=3D"Body Text 2"}
Paragraph text.
:::
``````



Thank you so much for posting this filte= r that converts the paragraph after block quote to Body Text 2! It worked g= reat for me. But: I also have other element environments (e.g. equations) t= hat I'd like to suppress indents after when I use pandoc to compile md = to docx. I couldn't get your complex paragraphs filter to work for me. = However, I'm already used to writing "\noindent" from my LaTe= X days (and it helps to have that if I want to compile md to tex anyway). W= ould it be possible to write a filter that assigns the Block Text 2 style t= o every paragraph that starts with "\noindent"?=C2=A0=C2=A0
On Wedn= esday, October 27, 2021 at 11:57:34 AM UTC-5 Bastien Dumont wrote:
If all you want is to prevent = indentation, you can use a filter that I wrote for a similar need: https= ://github.com/badumont/lua-filters/tree/complex-paragraphs/complex-paragrap= hs (which supports other output formats and enables you to control more= precisely what is indented or not). If you really need to set a style, the= following filter should work:

```
is_preceding_BlockQuote =3D false

function Block(block)
if block.t =3D=3D 'BlockQuote' then
is_preceding_BlockQuote =3D true
elseif is_preceding_BlockQuote =3D=3D true then
is_preceding_BlockQuote =3D false
return pandoc.Div(block, {['custom-style'] =3D 'Body Te= xt 2'})
end
end
```

Le Wednesday 27 October 2021 =C3=A0 09:32:34AM, Landon Yarrington a =C3= =A9crit :
> To clarify, in the MRE above, my goal is to get the paragraph imme= diately after
> the blockquote to render as "Body Text 2" according to t= he style in the
> ref_template.docx. Using this and every other stylesheet I've = made, the
> following paragraphs always come out as style "First Paragrap= h."
>=20
> On Wednesday, October 27, 2021 at 12:28:02 PM UTC-4 Landon Yarring= ton wrote:
>=20
> I'm trying to process block quotes in a way such that the = following
> paragraph directly after a block quote is styled as a continua= tion of the
> paragraph in which the blockquote is nested. I tried several d= ifferent
> styles, but cannot seem to achieve this. I almost filed an iss= ue on GH, but
> thought twice :-)
>=20
> I'm using pandoc 2.15 with the following command.
>=20
> `pandoc -N -t docx -f
> markdown+markdown_attribute+mmd_link_attributes+simple_tables+= multiline_tables+auto_identifiers+table_captions+yaml_metadata_block+raw_at= tribute+implicit_figures+latex_macros+header_attributes
> --reference-doc=3Dref_template.docx example.md -o TEST_example= .docx`
> Is this a user-error, a problem with my ref_template.docx, or = what?
>=20
> And here's `example.md`
> ````
> # Heading1
>=20
> Here's some text. Here's some text. Here's some te= xt. Here's some text.
> Here's some text. Here's some text. Here's some te= xt. Here's some text.
> Here's some text. Here's some text. Here's some te= xt. Here's some text.
> Here's some text. Here's some text. Here's some te= xt. Here's some text.
> Here's some text. Here's some text. Here's some te= xt. Here's some text.
> Here's some text. Here's some text. Here's some te= xt.
>=20
> Here's some text. Here's some text. Here's some te= xt. Here's some text.
> Here's some text. Here's some text. Here's some te= xt. Here's some text.
> Here's some text. Here's some text. Here's some te= xt. Here's some text.
>=20
> ## Heading 2
>=20
> Here's some text. Here's some text. Here's some te= xt. Here's some text.
> Here's some text. Here's some text. Here's some te= xt. Here's some text.
> Here's some text.
>=20
> Here's some text. Here's some text. Here's some te= xt. Here's some text.
> Here's some text. Here's some text.
>=20
> > Block quote time. Block quote time. Block quote time. Blo= ck quote time.
> Block quote time. Block quote time. Block quote time. Block qu= ote time.
> Block quote time. Block quote time. Block quote time. Block qu= ote time.
> Block quote time. Block quote time. Block quote time. Block qu= ote time.
> Block quote time. Block quote time. Block quote time.
>=20
> Back to the text. Back to the text. Back to the text. Back to = the text.
> Back to the text.
>=20
> Here's some text. Here's some text. Here's some te= xt. Here's some text.
> Here's some text. Here's some text. Here's some te= xt. Here's some text.
> Here's some text. Here's some text.
> ````
>=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-discus...@g= ooglegroups.com.
> To view this discussion on the web visit [2]https://groups.google.com/d/msgid/
> pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com.
>=20
> References:
>=20
> [1] mailto:pandoc-discus= ...@googlegroups.com
> [2] https://groups.google.com/d/msgid/pandoc-discuss/86c4d6cd-4ea3-41ad-a= ae9-c301f049a2can%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfo= oter

--
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 pandoc-discus...@googlegr= oups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-= discuss/bc83b25d-d676-4582-ba04-830e3f378c2an%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 pandoc-discuss+unsubscribe-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.org= m.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/58f80fd9-5= 017-4ae2-8a86-225d3fa79463n%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://g= roups.google.com/d/msgid/pandoc-discuss/CADAJKhBBTXWbvkdARhZTA%3DeNvmS%2B48= %3D0wS5_EGb9CCduJVJ4EA%40mail.gmail.com.
--000000000000d3c31705d9f477ab--