From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/22447 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: BPJ Newsgroups: gmane.text.pandoc Subject: Re: Conditional compilation - How to? Date: Sun, 7 Apr 2019 07:49:27 +0200 Message-ID: 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/alternative; boundary="000000000000d34fdc0585ea48be" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="141923"; mail-complaints-to="usenet@blaine.gmane.org" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCWMVYEK54FRB346U3SQKGQEILHJAGQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Apr 07 07:49:37 2019 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-wm1-f61.google.com ([209.85.128.61]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hD0gS-000apN-GR for gtp-pandoc-discuss@m.gmane.org; Sun, 07 Apr 2019 07:49:36 +0200 Original-Received: by mail-wm1-f61.google.com with SMTP id o8sf6275717wma.4 for ; Sat, 06 Apr 2019 22:49:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1554616175; cv=pass; d=google.com; s=arc-20160816; b=Fsk/NT7HYl6KBfIrQcthLY5rp0tLvosNAGe/1NhuoM1njEonAVSI2xXUCGB6ecbBnY LCP6Uf31QEpaKuHc1ckdUzQYLx+jOdJLNwPmd+udRu1Vl5d1Uhuxy8+f5YvNSTL5JXth o7RlaCIc5BGksti/PbtpYowF4bx32f0+bxkBbwWHlC+uh8MvtRT+Bs86hmuFHHGKrOGB 2CbZDLAXQQVADfuMwrW+mNwwYR7KSfXcCt8R2TlGa8UVkuQuUOmzG4TsHaT5Pv0LXuNI cmJrGH+WAzbpuY+utOfhwdYDG/lbmbRUJZ87OxdlcZYnqcVD6q1QDOvMiOVLHt+fxjQy Ppaw== 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=e2Y2Yhbn0WfsysHR5q35Y2SXllnm7HvuXKbvPPFJA7w=; b=k272DXkvZRas7X0luu/nYx/Wlmf1Rqi/QafsFF8IPpH6o2/Q3iHtQnALFLVJjoqaIy dTdlW64vAS6EG5VXrrk17UJUBpq40dtHzzaR1ytH3N/eNyGaHHbBqpEGnUS3a+5L0XkK fh0tsoXFeiEaaaCWsy1zm2w2rHZBX2GjMCHVRaOV4dXMe5Ro9vAe8HafyO7rKMDbuKEs +BESkBK8gzoIzKm9VAsYXwfoUuCog5D2kRxyO6WDtw1zjR91eQPmHPMx8a4FNPMBNstE 3lHsq5x7EkyJozEvrKF7EbA50vzkVYCOxdMLKnP5GRM7MdvopCWZLrO6VeHhaXK0NQtJ 9ubg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YydQFJEn; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::432 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=20161025; 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=e2Y2Yhbn0WfsysHR5q35Y2SXllnm7HvuXKbvPPFJA7w=; b=R8Y6Kn4tnsIjPyB96u6sb8+AvEKqryLnc5M1QWWzL/hK4N+bpoCY/vJa+d4ew3OnRz ADjL1ihpRlsvCAjRpn5Vh6agHrzW98vJjA/pNRzmVijOBKWRCAh4LZxE1p9IlUGwWHLn /ZLaplZz+2mABp/WilTmldnID3glduD63m+EfF9Ce7643tyzP/rWTtZasPggW2uhd5iY XMaUqycOfcEQHkFbi0doIalGItT2x0NSA3XcuI//aU9hokIJHGnP6d8D1UUnCd6OvD9L EDiAtKn5U52j5uEU5buI3REIMyzi1Bn56g+OG1Hpcqfq57Du3w4UtAwOgU0mtR6Mqsl8 Z1dQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; 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=e2Y2Yhbn0WfsysHR5q35Y2SXllnm7HvuXKbvPPFJA7w=; b=OO9MlXpx/y0+63uoqUPKEs2BiJ8xEyoow1sr656488fRbCcWaZrNom/RQ2ZTG09cPf 9h3OXf+60uHILc0FJlitRe78YGo+F38WPMGvVxQ+jtjIz9rNvNm7kYRb2jeogtUyEdIC BYVRARGfR+YH8+uugesn9z2tFW1jqnI+JYo4BgojrF6ny3nuSc2sS0JM/Nu5HMEE9di4 MRduZrZaBzGqmxz1ruoA9hJZ4xYwYS7nTC+iZSPnqZw9W6QA/5is5iiAhupCBAVYuMED hQkeMmQEtBOFk3NeSHYZDSq9ktdU/w2kL+hSL3h0ohTJk9NDMoNbnNfaE93K8Tu3weu8 zEQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; 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=e2Y2Yhbn0WfsysHR5q35Y2SXllnm7HvuXKbvPPFJA7w=; b=Km6xuc7JvJErEhn6hhqCeCPCxDeBzwdhkaOmHAuh8rpUimXQGftAoemYZ7B8VKcMXT /HRwrGMbMCE7Cmu4p95UeBsAi7ItOFKvCRQJKtXKRX5L6AfnxRYuXo4HeUd77ZI7wTWb 9+JpcOaPRb1puahQItJ86LMTs0+eHVTVmlRLfCZLEWcbcjK8ymHBRnDa/qSrQyR18pwQ Z48cKjMpJ/7grbh7+uGJMuNDm8IYNx9CYjfw8284VLH22sao8gGJ3hMX6N28pWrJIwWa SlfH/1jFRtokW6aHc+ny7fJCTmenW8K59WXe7XCyl4E6mTxrFEC3YYM2ZjJvu2AXBI+t r6nA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: APjAAAXg1i9HwuPmNjynHBJfVGshbqAzhuxpX5TR1s7igACKEKZgEdDU tgrjyNRv4uqT24vmxuopjt4= X-Google-Smtp-Source: APXvYqy64v1nj/doI57P/0ccy2Xi/tVNaBtCPbbrzQKrjx4K9jV6Svc5t9juWf7Y0AMkO6xqwxM4nA== X-Received: by 2002:a1c:a8d3:: with SMTP id r202mr13748743wme.106.1554616175634; Sat, 06 Apr 2019 22:49:35 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a1c:b406:: with SMTP id d6ls812432wmf.2.canary-gmail; Sat, 06 Apr 2019 22:49:34 -0700 (PDT) X-Received: by 2002:a1c:2044:: with SMTP id g65mr1058437wmg.8.1554616174835; Sat, 06 Apr 2019 22:49:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554616174; cv=none; d=google.com; s=arc-20160816; b=ZJA6Fhtf7+NPUub4s6WfVf5GX/3ajMSNfNVepx34nJvDk0Yia17sNgdFJvFpWibx88 ZOrcvCnFryWtN6Sy/8tKkT/wIv9xRTNJgn623fqw8PBm4XgMCPSnc95SPdhSQD96j7j3 ld1UKjxuix05V9msJi/1JXAMR2cNwfT8CNm56sAZIZJgUkSIaNf9yXOipsw4G5Wlaf3N 9WskO2dwRhi9JgCSacrPIoiUHaGgRINu8MWBEs6ZuCezSWNDSN1yT8h9k50ykcu2cFuK rlMF1yYihGhNsHbMk+957ZoxDjHih3uPBDUaKWO/eBmZWyMpuWXZEjl/6GFvRqf0Czzm YWmg== 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=z0O/MCbPMko9VJ2Lzr43QO043q08bNcl6zw0lSsrdL8=; b=bjntJhJm89uXjQI435s/5XIv0ILts6StoS/ibRehbdOUUnL4B6Md/GzPEujgKsS+OF B1uQcqXYWnMJlpY89kPwCzNiMvihSb3Rwwg25aGtC4oChcZN7MlvNCM/86jrMYsY+Vqi 6H0urvsnXEkJY77w+RLlOSR3snlTappx2nLazWUnwZk1egGAi5brH11Rwxc7cYM+/GfV FT4yTXR+NBEvVMIXTyJF80c1AWUa4T0n8ogK7ejhm3g6izRiErGJPDz3efO6Pvsj6gSV ccKsplgXUBnzwQoLf5S4jS7/OrbZiJ9fDwIL7BKwmu0MY7exIl2Njou2QUUZLoub3TT/ Uhdw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YydQFJEn; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::432 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-wr1-x432.google.com (mail-wr1-x432.google.com. [2a00:1450:4864:20::432]) by gmr-mx.google.com with ESMTPS id k15si1436176wrq.1.2019.04.06.22.49.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Apr 2019 22:49:34 -0700 (PDT) Received-SPF: pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::432 as permitted sender) client-ip=2a00:1450:4864:20::432; Original-Received: by mail-wr1-x432.google.com with SMTP id s15so12432837wra.12 for ; Sat, 06 Apr 2019 22:49:34 -0700 (PDT) X-Received: by 2002:a5d:6b04:: with SMTP id v4mr12289616wrw.69.1554616174201; Sat, 06 Apr 2019 22:49:34 -0700 (PDT) In-Reply-To: <44645f9a-1670-4f4e-93cc-e24394fa10f4-/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=20161025 header.b=YydQFJEn; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::432 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.org gmane.text.pandoc:22447 Archived-At: --000000000000d34fdc0585ea48be Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable You can use any attributes on headings, including classes: ````markdown ## The heading {.class} ```` The problem with headings inside divs is that pandoc sometimes ignores them, i.e. in the auto-generated table of contents and apparently also when identifying slides, probably because slides themselves need to be top level divs. Den l=C3=B6r 6 apr. 2019 20:36pbeltran 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 present= ed > in a different slide. I had just found a kind of solution, using heading > identifiers (although when compiling to beamer it spits a warning (as > 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 ne= eded > 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 >> 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. >>> Think in a worksheet or a set of reveal slides with and without solutio= ns. >>> >>> If I use gpp, like suggested here, >>> the >>> 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_div= s >>> 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 "pandoc-discuss" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> 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 >>> https://groups.google.com/d/msgid/pandoc-discuss/61bdaf46-d88a-4ef1-b14= 5-71ad5900fed8%40googlegroups.com >>> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- > 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 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. > --=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/CADAJKhAL7JGQyMS7A8eYhN7vQLdk7ccVm8%3DVEwz1keeuY_LVBA%40mail= .gmail.com. For more options, visit https://groups.google.com/d/optout. --000000000000d34fdc0585ea48be Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
You can use any attributes on headings, including classes= :

````markdown
## The heading=C2=A0 {.class}
````

The problem with headings insid= e divs is that pandoc sometimes ignores them, i.e. in the auto-generated ta= ble of contents and apparently also when identifying slides, probably becau= se slides themselves need to be top level divs.

=

Den l=C3=B6r 6 apr. 2019 20:36pbeltran <pabelpe-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 tha= t I need solution to be presented in a different slide. I had just found a = kind of solution, using heading identifiers (although when compiling to bea= mer it spits a warning (as several sections share the same identifier):
local looking_at_section = =3D false
local lvl= =3D 0
local remove= =3D {}=C2=A0 -- delete line if 'remove' array not needed

function Block (elem)
=C2=A0 if elem.t =3D=3D "Header&qu= ot; then
=C2=A0 =C2= =A0 -- if elem.classes:includes('remove',1) then

=C2=A0 =C2=A0 if elem.identifier =3D=3D 'answer= ' then
=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 else

=C2=A0 =C2=A0 =C2=A0 looking_at_section =3D looking_at_sectio= n and elem.level >
lvl
=C2=A0 =C2= =A0 end
=C2=A0 end<= /div>
=C2=A0 if looking_a= t_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 escribi= =C3=B3:
I use a div with a class and a filter which removes divs with tha= t class like this:

````m= arkdown
:::answer
**Answer:**= 42.
:::
````

````lua
functi= on Div (elem)
=C2=A0 if elem.classes:includes('a= nswer') then
=C2=A0 =C2=A0 return {} -- delete i= t
=C2=A0 else
=C2=A0 =C2=A0 r= eturn elem
=C2=A0 end
end
````

HTH,

/bpj
Den l=C3=B6r 6 apr. 2019 18:4= 4pbeltran <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 slides with and without solutions.

If I= use gpp, like suggested here,=C2=A0the math expressi= ons 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-...-/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/pandoc-discuss/61bd= af46-d88a-4ef1-b145-71ad5900fed8%40googlegroups.com.
For more options, visit https://groups.google.com/d/opto= ut.

--
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 post to this group, send email to pandoc-discuss@googlegrou= ps.com.
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.

--
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://group= s.google.com/d/msgid/pandoc-discuss/CADAJKhAL7JGQyMS7A8eYhN7vQLdk7ccVm8%3DV= Ewz1keeuY_LVBA%40mail.gmail.com.
For more options, visit http= s://groups.google.com/d/optout.
--000000000000d34fdc0585ea48be--