From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/22078 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: EBkysko Newsgroups: gmane.text.pandoc Subject: Re: ignore section & content in output Date: Mon, 11 Feb 2019 15:27:25 -0800 (PST) Message-ID: References: <717bc9dc-b99a-4472-9965-1c84a737fc01@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1278_388901257.1549927645703" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="58335"; mail-complaints-to="usenet@blaine.gmane.org" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDW4B3GJ2UFBBXUJRDRQKGQEZBRU37Q-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Feb 12 00:27:29 2019 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-ot1-f64.google.com ([209.85.210.64]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1gtKz2-000F3k-NG for gtp-pandoc-discuss@m.gmane.org; Tue, 12 Feb 2019 00:27:29 +0100 Original-Received: by mail-ot1-f64.google.com with SMTP id a19sf778545otq.1 for ; Mon, 11 Feb 2019 15:27:28 -0800 (PST) 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=0n1gyH9E9335FsE708mU9wD/sHnt/Ldow3NjGib8wd0=; b=XzseIW/dGsclCnR0xfQmxwK8gNL127qLBZLJ38+z4qGlaTrP0wuQsH/HyScBx8wNhW ypdDMYJ0qv4JsL1H2/BzDBavaFwDKUqfP+u6vVahAZcLc9VIm+RGXUplcCVJvhOwi5fO LlJjRqYsUxc6sV9rHVJA4vJQcMyxbV/5L4UV5+jsTIjuwP61guK1+nkJO9Pdz1UVC/dI MEg4ZnxG9h8lIH4UdkksPa5DdmTABgrBLE0WlizplZN8IbFxoETya9RcT22LOEPCpL2t D4oYd7D/PfZwDT6Lfws/1weWugDY6FpCILpLK+jBHtSEk0WUiLIIeH0wXf1cahFKyDe1 kvYw== 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=0n1gyH9E9335FsE708mU9wD/sHnt/Ldow3NjGib8wd0=; b=tULk33R8DTyfQCprknbTbVN8R9jwQ7MwN1m4HEugh+3LOLHmtP7Jupmv9wU78+2eat mFBcxKoPRrveJXf1GMMMW15S1TQP8EushGepLfr/Vnril97QjfPpmZeifpSF18hJTZ0L Kt/Abpdxj27WnBWhsjTzZweB4jyA2m4J2Hz3R1qQLcVZY4foLG8qEjU3Vh4l9fOPCpoN 0Roa563YzcaHmPeFfXb9uMYrzekQP1uWSoQZm54w3gHYtgCWbRJZQxm9pbl1n+zzj2VM G5Swy+qa7S/DTTdR6v1CgCKnup/AKuWcXSZ4eCIfVtvXEIm9VzXsbj+9M2QFcQ9ZIDlg nv5w== 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=0n1gyH9E9335FsE708mU9wD/sHnt/Ldow3NjGib8wd0=; b=ns8+2WFQIkRrMOLFyjf0XISy37lDDPZoEF7bb4s2EbdeKjwineh05v8NXAI+5pZvHj 1drJRgbvfKw42badDXy83wuhoMChU53UKAdoWWlszRK7JdJmVxaaa565ifMlBuWdsdwf C5Bdhzff0nOxWhUu0MtlpCI0aWqSr6rsGhxGWL+SmmrqO5dSxxGRiyxnN9VmWm23B1F/ S+00ZLMcCync2z5iDL6VrKB3/xbIufoyjdGqxziS2ap6oUC4QDupIq84nwBLhcsmtKX4 M68ZOp8ijQrI9Q2XODbz15MLTpjatQSoCIa6GGD47WVr2UDiv3+UfHSGatNubfS6gwUe 5kGw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AHQUAuYBOfetlSm7PFunSNIt2MaGdR94Rosq8J0/9yyYU53HYnE34Zp/ GF5IONHu8dQIX8MMUdPk2PQ= X-Google-Smtp-Source: AHgI3IbQtw46rwFVIeY0hD+c+Yh5DE+hrI+vBoE5/NnOxTmjsAfALQloimzAmrZqqQNX4C0bzey+Eg== X-Received: by 2002:a9d:5e01:: with SMTP id d1mr12713oti.1.1549927647509; Mon, 11 Feb 2019 15:27:27 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a9d:ecc:: with SMTP id 70ls8443853otj.1.gmail; Mon, 11 Feb 2019 15:27:26 -0800 (PST) X-Received: by 2002:a05:6830:1212:: with SMTP id r18mr12733otp.0.1549927646372; Mon, 11 Feb 2019 15:27:26 -0800 (PST) In-Reply-To: <717bc9dc-b99a-4472-9965-1c84a737fc01-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: ebkysko-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:22078 Archived-At: ------=_Part_1278_388901257.1549927645703 Content-Type: multipart/alternative; boundary="----=_Part_1279_838370198.1549927645703" ------=_Part_1279_838370198.1549927645703 Content-Type: text/plain; charset="UTF-8" Your filter looks good, except that any subsection of the "marked" section will remain present... but perhaps that's what you want. If not, or if anyone else would like to remove all subsections of that section, the following seems to work: local looking_at_section = false local remove = {} local lvl = 0 function Block (elem) if looking_at_section then remove[#remove + 1] = elem return {} end end function Header (elem) if elem.identifier == 'remove' then looking_at_section = true lvl = elem.level return {} else looking_at_section = looking_at_section and elem.level > lvl if looking_at_section then remove[#remove + 1] = elem return {} end end end The original filter has the same problem... but an abstract usually doesn't have subsections/sublevels (I think). Note also that usually an identifier should identify only one element, and pandoc will (rightly) be annoyed when there's more than one header with the same ID. A class would be ideal for this situation, and one might then use `if elem.classes:includes('remove',1)` rather than `if elem.identifier == 'remove'` -- 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/b4c57563-7c47-4b1d-accd-2bdaf2e39e75%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. ------=_Part_1279_838370198.1549927645703 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Your filter looks good, except that any subsection of= the "marked" section will remain present... but perhaps that'= ;s what you want.

If not, or if anyone else would = like to remove all subsections of that section, the following seems to work= :

local looking_at_section =3D false
loc= al remove = =3D= {}
local lvl =3D 0

function
Block <= /span>(elem)
=C2=A0
if looking_at_section then
=C2=A0 =C2=A0 remove
[#remove + 1] =3D elem
=C2=A0 =C2=A0 return<= span style=3D"color: #000;" class=3D"styled-by-prettify"> {}
=C2=A0
end
end

function Header (elem)
=C2=A0
if elem.identifier =3D=3D 'remove' then
=C2=A0 =C2=A0 looking_at_section
=3D true
=C2=A0 =C2=A0 lvl
=3D elem.level
=C2=A0 =C2=A0
return {}
= =C2=A0
els= e
=C2= =A0 =C2=A0 looking_at_section
=3D looking_at_section and elem.level &= gt; lvl=C2=A0 =C2=A0 if lo= oking_at_section then
=C2=A0 =C2=A0 =C2=A0 remove
[#remove + 1] =3D elem
=C2=A0 =C2=A0 =C2=A0
return {}
=C2=A0 =C2=A0
end
=C2=A0
end
end

The original filter has the sam= e problem... but an abstract usually doesn't have subsections/sublevels= (I think).

Note also that usually an identifier s= hould identify only one element, and pandoc will (rightly) be annoyed when = there's more than one header with the same ID.
A class would = be ideal for this situation, and one might then use `if elem.classes:inclu= des('remove',1)` rather than `if elem.identifier =3D=3D 'remove'`

--
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/b4c57563-7c47-4b1d-accd-2bdaf2e39e75%40googlegroups.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_1279_838370198.1549927645703-- ------=_Part_1278_388901257.1549927645703--