From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/11498 Path: news.gmane.org!not-for-mail From: Mark Szepieniec Newsgroups: gmane.text.pandoc Subject: Re: filter to remove inline HTML comments Date: Sat, 13 Dec 2014 15:09:08 +0100 Message-ID: References: <548B63DF.5050902@web.de> <548C1181.6010806@web.de> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c03e268913e8050a198df0 X-Trace: ger.gmane.org 1418479756 30029 80.91.229.3 (13 Dec 2014 14:09:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 13 Dec 2014 14:09:16 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBC5LDAET5YPBBBERWGSAKGQEOPEGLUY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Dec 13 15:09:12 2014 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-yk0-f185.google.com ([209.85.160.185]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XznNe-0002Yh-4G for gtp-pandoc-discuss@m.gmane.org; Sat, 13 Dec 2014 15:09:10 +0100 Original-Received: by mail-yk0-f185.google.com with SMTP id 142sf1195731ykq.12 for ; Sat, 13 Dec 2014 06:09:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:sender:list-subscribe:list-unsubscribe; bh=jjOS77zH0f8P9nWbg7vmkCU1Dd3DWPowlFtJBcb0csk=; b=YI1H60ZbDqQsGyTh0PqBD4BZYPM3tzGfQRBqEMgQe5oLxftKhAdLm/AnvACfUEgRG2 28oHHBuP55T+hERdjFpo/7sT1aB7iwQKuBSqoSSvAi6iH4Hd1SGqpof6ag2R4W9upQqk Grgh4c5PRn+jnGFbkD7yMfEE0kBS3zqozYtLJyKkIyudAH0Gv1sVTNAftndSvhol2G+X AhOJrjYDMcdDEzqX++ggIYBciMOtOjoohDOZfLv16EEnv6CT3K+EQh7J4HMwkP5PaSoO m68agbwxCtTcpkYH8Ds/Cqt2ruyDr61d9JbmT/u+xNRJ1SdB5K5Ba+dtQLk3XywKHDJg Npiw== X-Received: by 10.140.33.229 with SMTP id j92mr36744qgj.7.1418479749267; Sat, 13 Dec 2014 06:09:09 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.140.84.244 with SMTP id l107ls1946138qgd.47.gmail; Sat, 13 Dec 2014 06:09:08 -0800 (PST) X-Received: by 10.224.36.72 with SMTP id s8mr17972763qad.1.1418479748729; Sat, 13 Dec 2014 06:09:08 -0800 (PST) Original-Received: from mail-qg0-x22d.google.com (mail-qg0-x22d.google.com. [2607:f8b0:400d:c04::22d]) by gmr-mx.google.com with ESMTPS id c4si614389qco.0.2014.12.13.06.09.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 13 Dec 2014 06:09:08 -0800 (PST) Received-SPF: pass (google.com: domain of mszepien-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:400d:c04::22d as permitted sender) client-ip=2607:f8b0:400d:c04::22d; Original-Received: by mail-qg0-f45.google.com with SMTP id f51so6699584qge.18 for ; Sat, 13 Dec 2014 06:09:08 -0800 (PST) X-Received: by 10.140.18.103 with SMTP id 94mr1636867qge.44.1418479748582; Sat, 13 Dec 2014 06:09:08 -0800 (PST) Original-Received: by 10.229.28.193 with HTTP; Sat, 13 Dec 2014 06:09:08 -0800 (PST) In-Reply-To: <548C1181.6010806-S0/GAf8tV78@public.gmane.org> X-Original-Sender: mszepien-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of mszepien-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:400d:c04::22d as permitted sender) smtp.mail=mszepien-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dkim=pass header.i=@gmail.com; dmarc=pass (p=NONE 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:11498 Archived-At: --001a11c03e268913e8050a198df0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable module Main where import Text.Pandoc.JSON import Data.List main =3D toJSONFilter removeComments removeComments :: Inline -> [Inline] removeComments e@(RawInline (Format "html") s) =3D if isComment s then [] e= lse [e] removeComments e =3D [e] isComment :: String -> Bool isComment =3D isPrefixOf " > > This is a comment. > > > pandoc removes them when parsing to other format than HTML. When parsing > to HTML, it simply passes them to the output text. > > > If the issue is to have comments in your markdown which don't show up i= n > > generated HTML you can use YAML blocks which only contain YAML comments= : > > John told me about this, but YAML comments are harder to write for both > block and inline comments. > > > Pablo > -- > http://www.ousia.tk > > -- > 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/548C1181.6010806%40web.d= e > . > 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/CAE4-1rUH%2BguOdJvpmMNLS8_xKKbj%3DoBXcdqrF8eT7uEAZWPkrQ%40ma= il.gmail.com. For more options, visit https://groups.google.com/d/optout. --001a11c03e268913e8050a198df0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
= module Main where =20 import Text.Pandoc.JSON import Data.List =20 main =3D toJSONFilter removeComments =20 removeComments :: Inline -> [Inline] removeComments e@(RawInline (Format "html") s) =3D if isComment s= then [] else [e] removeComments e =3D [e] =20 isComment :: String -> Bool isComment =3D isPrefixOf "<!--"


This should work, although I've not tested it myself.<= /div>

Mark


On Sat, Dec 13, 2014 at 11:14 AM, Pablo Rodr= =C3=ADguez <oinos-S0/GAf8tV78@public.gmane.org> wrote:
On 12/13/2014 12:39 AM, BPJ wrote:
> I thought HTML had only one type of comments, namely delimited, or am = I
> missing something? Does pandoc parse HTML comments somtimes as RawInli= ne
> and sometimes as RawBlock?

HTML comments themselves may be blocks or inline elements.

=C2=A0 =C2=A0 <!--

=C2=A0 =C2=A0 This is a block comment.

=C2=A0 =C2=A0 Isn=E2=80=99t it?

=C2=A0 =C2=A0 -->

=C2=A0 =C2=A0 This is a<!--n inline--> comment.


pandoc removes them when parsing to other format than HTML. When parsing to HTML, it simply passes them to the output text.

> If the issue is to have comments in your markdown which don't show= up in
> generated HTML you can use YAML blocks which only contain YAML comment= s:

John told me about this, but YAML comments are harder to write for b= oth
block and inline comments.


Pablo
--
http://www.ousia.tk
--
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 pa= ndoc-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/548C1181.6010806%40web.= de.
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://gro= ups.google.com/d/msgid/pandoc-discuss/CAE4-1rUH%2BguOdJvpmMNLS8_xKKbj%3DoBX= cdqrF8eT7uEAZWPkrQ%40mail.gmail.com.
For more options, visit http= s://groups.google.com/d/optout.
--001a11c03e268913e8050a198df0--