From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/22448 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: pbeltran Newsgroups: gmane.text.pandoc Subject: Re: Conditional compilation - How to? Date: Sat, 6 Apr 2019 23:46:51 -0700 (PDT) Message-ID: <5fc2de0f-82db-4d02-9dc9-ff5db8a8b9b4@googlegroups.com> References: <61bdaf46-d88a-4ef1-b145-71ad5900fed8@googlegroups.com> <44645f9a-1670-4f4e-93cc-e24394fa10f4@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_584_2144163543.1554619611602" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="113151"; mail-complaints-to="usenet@blaine.gmane.org" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDR3TD5H7MBRBXFZU3SQKGQER5D4NOY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Apr 07 08:46:55 2019 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-ot1-f61.google.com ([209.85.210.61]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hD1Zu-000TKb-WB for gtp-pandoc-discuss@m.gmane.org; Sun, 07 Apr 2019 08:46:55 +0200 Original-Received: by mail-ot1-f61.google.com with SMTP id 70sf5950731otn.15 for ; Sat, 06 Apr 2019 23:46:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=syA/QigHfjOg3lhK0aO8/ckKaVcTcch2Wg2kIB7UalE=; b=XzqXmToHNQoEIID+XDZNVQFsVXd8ZbGt4bjbXU8PedYKeoImXQXQeEiESNoNR/lGpZ +QWEz2zQwor1CWE0t4uYozQbF12/tGf2qHKSuyqrCgkSWcOJ/edIc1KtUvrd7FbBkUvF qzt5nB5W+MZkusKOx424ySYsJlV3hLnnpunaPC+ntRq/LF5K83Jc9AkVR2iEWi5Zql8g RBE1cx5nT/5XeSTEKv0HcQtc41dbhXyPiVro5S/pZrF4Thit5uW8Oiuf5kzED32lnaSU AFMKsrcFOyBXf1BWH/m83ChAM/MDyu9VRezV2NRJZGJWN3yWGfZZSm+I4VnWHcixzPd1 Te4Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=syA/QigHfjOg3lhK0aO8/ckKaVcTcch2Wg2kIB7UalE=; b=mQPA/3NgG81hIcr9sivfgZy2hZr/JXC64+10RiqOSLLCCnyYUFU8f+4UHICON6ybgx svXC0TaKb3jpk5QxRIzr8PlFXWlG0fKsULuYVHm/annhmZQCB371iv1Zp3g2Sw5/yIIC M+mrBjFMR7IfJFu6FN9WEk3SWkYQkLy4xyrqtXH7bPZBAZ9Cj4J0zkmO6NZOiGUl3Tb1 glRDiTXZeSOUNAc4lNNYhZlngEmyu/iiPc0LVUd14wvDg4dDC4gd1SRj13rLe0Rpul4p +3aqn1VFm62by/slEquHDDkSN4/dG6NiOKtFESZuM1ENqmSTf4hA5+nbIYE6mx36a8MY qeEw== 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:in-reply-to :references: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=syA/QigHfjOg3lhK0aO8/ckKaVcTcch2Wg2kIB7UalE=; b=SL44DsMCPLRL/L1xPsxW7ma1HG1W5zumhe3erCSs8AX1Zgejf/h8rRCPNX7aIarHsw ckEuvuKK1Ltc8PoXt+02Lv+TaF+db+6DeN0LbBIxG8llhW6bjbcYp3GVS1CGlgFsvCTR xNUOyovDB2FckWpE2a9N7Qpp1VFaL2z3A2xk6LpWPp/XSJy5LH02Yh7mRfx4+jnhTu8H GtRep5axRvmBspXxSum9VYOcYeNUXkCCEYYzfxrRRBTJlBUhin8IDS1HagtxmzuVKgzL TPy6e5a/YlDTDwR1j/JAeEAQ4WPkSZaEuHwnJIPbS82ppICo6sXsecivvvmWBKUjfvq0 uOOw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: APjAAAUmwsjVWRnirm0wksUMwqWDjhWvXBAPOpY9u4R4CLAdS3+0hTpw eQTDuCN2PXh7O/YEeFBqKks= X-Google-Smtp-Source: APXvYqwrl2uboy8zfFUQJQ2OTrhWW+hFEMUPo2/n4Uys3n4NHT0Jb823vHGSgdx9b8xZxE3a+SFJYw== X-Received: by 2002:aca:ef83:: with SMTP id n125mr12421053oih.80.1554619613277; Sat, 06 Apr 2019 23:46:53 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:aca:387:: with SMTP id 129ls2130495oid.3.gmail; Sat, 06 Apr 2019 23:46:52 -0700 (PDT) X-Received: by 2002:aca:ab06:: with SMTP id u6mr11557839oie.68.1554619612212; Sat, 06 Apr 2019 23:46:52 -0700 (PDT) In-Reply-To: X-Original-Sender: pabelpe-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.org gmane.text.pandoc:22448 Archived-At: ------=_Part_584_2144163543.1554619611602 Content-Type: multipart/alternative; boundary="----=_Part_585_1637202589.1554619611603" ------=_Part_585_1637202589.1554619611603 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ok, thanks. El domingo, 7 de abril de 2019, 7:49:36 (UTC+2), BP escribi=C3=B3: > > You can use any attributes on headings, including classes: > > ````markdown > ## The heading {.class} > ```` > > The problem with headings inside divs is that pandoc sometimes ignores=20 > them, i.e. in the auto-generated table of contents and apparently also wh= en=20 > identifying slides, probably because slides themselves need to be top lev= el=20 > divs. > > > Den l=C3=B6r 6 apr. 2019 20:36pbeltran > s= krev: > >> Thanks. Using your script, what I can't do is to include a heading insid= e=20 >> the fenced div, can't I? The reason is that I need solution to be presen= ted=20 >> in a different slide. I had just found a kind of solution, using heading= =20 >> identifiers (although when compiling to beamer it spits a warning (as=20 >> several sections share the same identifier): >> >> local looking_at_section =3D false >> local lvl =3D 0 >> local remove =3D {} -- delete line if 'remove' array not needed >> >> function Block (elem) >> if elem.t =3D=3D "Header" then >> -- if elem.classes:includes('remove',1) then >> >> if elem.identifier =3D=3D 'answer' then >> looking_at_section =3D true >> lvl =3D elem. >> level >> else >> >> looking_at_section =3D looking_at_section and elem.level > >> lvl >> end >> end >> if looking_at_section then >> remove[#remove + 1] =3D elem -- delete line if 'remove' array not= =20 >> needed >> return {} >> end >> end >> >> >> >> >> >> El s=C3=A1bado, 6 de abril de 2019, 20:17:02 (UTC+2), BP escribi=C3=B3: >>> >>> I use a div with a class and a filter which removes divs with that clas= s=20 >>> like this: >>> >>> ````markdown >>> :::answer >>> **Answer:** 42. >>> ::: >>> ```` >>> >>> ````lua >>> function Div (elem) >>> if elem.classes:includes('answer') then >>> return {} -- delete it >>> else >>> return elem >>> end >>> end >>> ```` >>> >>> HTH, >>> >>> /bpj >>> >>> Den l=C3=B6r 6 apr. 2019 18:44pbeltran skrev: >>> >>>> My purpose is to generate two versions from the same markdown file.=20 >>>> Think in a worksheet or a set of reveal slides with and without soluti= ons. >>>> >>>> If I use gpp, like suggested here, =20 >>>> the=20 >>>> math expressions in my .md (mathjax) get messed, since \ are escaped. >>>> >>>> Is there a way out of the box? For instance, by using custom=20 >>>> fenced_divs and them telling pandoc to remove that specific div? I've = taken=20 >>>> a look at custom filters but I don't know haskell... >>>> >>>> Thanks >>>> >>>> --=20 >>>> You received this message because you are subscribed to the Google=20 >>>> Groups "pandoc-discuss" group. >>>> To unsubscribe from this group and stop receiving emails from it, send= =20 >>>> an email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> To view this discussion on the web visit=20 >>>> https://groups.google.com/d/msgid/pandoc-discuss/61bdaf46-d88a-4ef1-b1= 45-71ad5900fed8%40googlegroups.com=20 >>>> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> --=20 >> You received this message because you are subscribed to the Google Group= s=20 >> "pandoc-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send a= n=20 >> email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org . >> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org=20 >> . >> To view this discussion on the web visit=20 >> https://groups.google.com/d/msgid/pandoc-discuss/44645f9a-1670-4f4e-93cc= -e24394fa10f4%40googlegroups.com=20 >> >> . >> For more options, visit https://groups.google.com/d/optout. >> > --=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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/5fc2de0f-82db-4d02-9dc9-ff5db8a8b9b4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. ------=_Part_585_1637202589.1554619611603 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Ok, thanks.

El domingo, 7 de abril de 2019, 7:49:36= (UTC+2), BP escribi=C3=B3:
You can use any attributes on headings, including classes:<= div dir=3D"auto">
````markdown
## The heading=C2=A0 {.class}
````

The problem with headings inside di= vs is that pandoc sometimes ignores them, i.e. in the auto-generated table = of contents and apparently also when identifying slides, probably because s= lides themselves need to be top level divs.


Den l=C3=B6r 6 apr.= 2019 20:36pbeltran <pab...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
Thanks. Using your script, what I can'= t do is to include a heading inside the fenced div, can't I? The reason= is that I need solution to be presented in a different slide. I had just f= ound a kind of solution, using heading identifiers (although when compiling= to beamer it spits a warning (as several sections share the same identifie= r):

<= font color=3D"#660066">
local looking_at_section =3D false
lo= cal lvl =3D 0
local remove =3D {}=C2=A0 -- delete line if 're= move' array not needed

function Block (elem)
=C2=A0 if elem.t =3D=3D "Header" then
=C2=A0 = =C2=A0 -- if elem.classes:includes('remove',1) then
=
=C2=A0 =C2=A0 if elem.identifier =3D=3D 'answer' the= n
=C2=A0 =C2=A0 =C2=A0 looking_at_section =3D true
=C2= =A0 =C2=A0 =C2=A0 lvl =3D elem.
level
=C2=A0 =C2=A0 els= e

=C2=A0 =C2=A0 =C2=A0 looking_at_section =3D look= ing_at_section and elem.level >
lvl
=C2=A0 =C2=A0 en= d
=C2=A0 end
=C2=A0 if looking_at_section then
=C2=A0 =C2=A0 remove[#remove + 1] =3D elem=C2=A0 -- delete line if 'r= emove' array not needed
=C2=A0 =C2=A0 return {}
=C2= =A0 end
end





El s=C3=A1bado, 6 de abril de 2019, 20:17:02 (UTC+= 2), BP escribi=C3=B3:
I use a div with a class and a filter which removes = divs with that class like this:

````markdown
:::answer
**Answer:** 42.
:::
````<= /div>

````lua
function Div (elem)
=C2=A0 if elem.classes:in= cludes('answer') then
=C2=A0 =C2=A0 ret= urn {} -- delete it
=C2=A0 else
=C2=A0 =C2=A0 return elem
=C2=A0 end
end
````

HTH,

= /bpj

Den l=C3=B6= r 6 apr. 2019 18:44pbeltran <pab...@gmail= .com> skrev:
My purpose is to generate two versions from the same markdown file. Think= in a worksheet or a set of reveal slides with and without solutions.
<= br>
If I use gpp, like suggested here,=C2=A0the math expressions in my .md (mathjax) get messed, sinc= e \ are escaped.

Is there a way out of the box? Fo= r instance, by using custom fenced_divs and them telling pandoc to remove t= hat specific div? I've taken a look at custom filters but I don't k= now haskell...

Thanks

--
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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-= ...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pan= doc-discuss/61bdaf46-d88a-4ef1-b145-71ad5900fed8%40googlegroups.c= om.
For more options, visit https://groups.google.com= /d/optout.

--
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-...@googlegroups.com.
To post to this group, send email to pandoc-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pan= doc-discuss/44645f9a-1670-4f4e-93cc-e24394fa10f4%40googlegroups.c= om.
For more options, visit https://groups.google.com= /d/optout.

--
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/= msgid/pandoc-discuss/5fc2de0f-82db-4d02-9dc9-ff5db8a8b9b4%40googlegroups.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_585_1637202589.1554619611603-- ------=_Part_584_2144163543.1554619611602--