From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/22444 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 11:36:01 -0700 (PDT) Message-ID: <44645f9a-1670-4f4e-93cc-e24394fa10f4@googlegroups.com> References: <61bdaf46-d88a-4ef1-b145-71ad5900fed8@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_657_1482382329.1554575761302" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="13050"; mail-complaints-to="usenet@blaine.gmane.org" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDR3TD5H7MBRBEXDUPSQKGQEMY22NHI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Apr 06 20:36:05 2019 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-oi1-f189.google.com ([209.85.167.189]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hCqAe-0003EQ-Jo for gtp-pandoc-discuss@m.gmane.org; Sat, 06 Apr 2019 20:36:04 +0200 Original-Received: by mail-oi1-f189.google.com with SMTP id v10sf4114203oie.4 for ; Sat, 06 Apr 2019 11:36:04 -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=2tK8fVNEx1TBPKCH9O47qSPWsUNnnnnf7fL2sfTcvEU=; b=qriAARo3j8T+JrvQhHQzadO3YYz3IKDt8KP1Tyr8n76Na/JNZ9NlggwoyFQDXkgJVX XEjJWhrH2VC/wvx1+yA9suVqbUQj5xWtQEBL6TKIXfpc06iSxNiRTgpIbjUKvKkpu2C6 lLRn6fo4Dv2RHhD4WFECT7nHVq1yXEzDXTZ/088ZkMePqR2pn0ccvfRNzKJUHK7gbGv3 eW8P51YYkO5bjqczEtm4wj81ZE1fdjVMKYzjxScnrNrH/OQK9NiFASrp2MF41KLaL66f 2ebRHzhCRVh5EkT+UDbtoxz01mfnJESk+rfQ87lHupoUHpj4WAneR4eAEtgHmTI2tDhC QeeA== 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=2tK8fVNEx1TBPKCH9O47qSPWsUNnnnnf7fL2sfTcvEU=; b=jwc2lMHVAvky+VXbsUpBLp++92+ycjRQCcEYwY+OxFn94nuf+aBB+cxtTYBR9Pn9gf D6rffMXF1jtnLw9dBktpE2fbu04A5FqjCa423OCLfWfXOtPgfKbrxCf4M4DIZVBCVR5E h0yAU5YB3+/DHUN/x3quYbl2kmqlp9PRNDtkmqJBgxZH1+2e2gUFxGUstvbI2WYSG8bi gPu1v1gHqJh2fRdXKtOeqA++Ztizn2OkdMvl7J53FVCDqXfFwIrxBQCyxIOwskS46dTw 7aZbjgsHPcojXUcKlXimrswz+WaYlVWc7W9zuf69e2mbRWhUcqM04gqm+KB99DZWdQjR SV1A== 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=2tK8fVNEx1TBPKCH9O47qSPWsUNnnnnf7fL2sfTcvEU=; b=gy6TZIGMAoNrlt4O/s+CZl63+RJXEnhxw4Hr8hxD/V/wIzZOIRiFnlr01cUL9vrCig mzpBeZwjfUJr3nCQ0RbH3KrBZSukWKOQyPJSycZuFXgPam7+gQzQ82Hn+JXziZU8dNQL yDO4pdGdV5+FdAgXE5v67mihxXMFut+G8x+g7gEtuO4MWicS9pjsC8paLHlfrLxJ2ADA L/r4idpX9/HhvkkL+Vo5Azp8eQx99cNvQ3Zzt2BUFF5priUJ3VaFCvR0sg7mTDrk7PBz CFEtkjO9mIOCjqavXi5x6/A7FnRMdE9xG6Gn5f6XB4dyQv+JXImVHd7qt0AXe1PaPyqj V7LA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: APjAAAVhVg1RHygYfxsZ0ScT/kaNFLyi1+CFoSAR4H/UPkX5QLJuvJit bu2cWX+mYwEyjzWLq9VoOH8= X-Google-Smtp-Source: APXvYqxBZuVtk2NpKb77c5CQIwKDnxhCSYoKEFWXbdTk4xb6y7oQtkdw/lMsEcnAIrNdwnepWY8KKw== X-Received: by 2002:aca:6288:: with SMTP id w130mr10484405oib.116.1554575762935; Sat, 06 Apr 2019 11:36:02 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a9d:4f1a:: with SMTP id d26ls2258082otl.10.gmail; Sat, 06 Apr 2019 11:36:02 -0700 (PDT) X-Received: by 2002:a9d:560b:: with SMTP id e11mr13525227oti.60.1554575761881; Sat, 06 Apr 2019 11:36:01 -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:22444 Archived-At: ------=_Part_657_1482382329.1554575761302 Content-Type: multipart/alternative; boundary="----=_Part_658_1069905393.1554575761302" ------=_Part_658_1069905393.1554575761302 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks. Using your script, what I can't do is to include a heading inside= =20 the fenced div, can't I? The reason is that I need solution to be presented= =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 need= ed 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 class= =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 > s= krev: > >> My purpose is to generate two versions from the same markdown file. Thin= k=20 >> in a worksheet or a set of reveal slides with and without solutions. >> >> 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 fenced_divs= =20 >> and them telling pandoc to remove that specific div? I've taken a look a= t=20 >> custom filters but I don't know haskell... >> >> Thanks >> >> --=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/61bdaf46-d88a-4ef1-b145= -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 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/44645f9a-1670-4f4e-93cc-e24394fa10f4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. ------=_Part_658_1069905393.1554575761302 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks. Using your script, what I can't do is to inclu= de 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 found a kind of s= olution, using heading identifiers (although when compiling to beamer it sp= its a warning (as several sections share the same identifier):

local= looking_at_section =3D false
local lvl = =3D 0
local remove =3D {}=C2=A0 -- delet= e line if 'remove' 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 'answ= er' then
=C2=A0 =C2=A0 =C2=A0 lookin= g_at_section =3D true
=C2=A0 =C2=A0 =C2= =A0 lvl =3D elem.
level
=C2=A0 =C2=A0 else
<= br>
=C2=A0 =C2=A0 =C2=A0 looking_at_sect= ion =3D looking_at_section and elem.level >
lvl
=C2=A0 =C2=A0 end
=C2=A0 end
=C2= =A0 if looking_at_section then
=C2=A0 = =C2=A0 remove[#remove + 1] =3D elem=C2=A0 -- delete line if 'remove'= ; 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 e= scribi=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 dir=3D"auto">
````lua
function Div (elem)
=C2=A0 if elem.classes:includes= ('answer') then
=C2=A0 =C2=A0 return {}= -- delete it
=C2=A0 else
=C2= =A0 =C2=A0 return elem
=C2=A0 end
end
````

HTH,

/bpj

Den l=C3=B6r 6 ap= r. 2019 18:44pbeltran <pab...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
My purpose is to generate two versions= from the same markdown file. Think in a worksheet or a set of reveal slide= s with and without solutions.

If I use gpp, like suggest= ed here,=C2=A0the math expressions = in my .md (mathjax) get messed, since \ are escaped.

Is there a way out of the box? For instance, by using custom fenced_divs= and them telling pandoc to remove that specific div? I've taken a look= at custom filters but I don't know 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-...@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/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 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/44645f9a-1670-4f4e-93cc-e24394fa10f4%40googlegroups.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_658_1069905393.1554575761302-- ------=_Part_657_1482382329.1554575761302--