From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/11669 Path: news.gmane.org!not-for-mail From: Elliott Slaughter Newsgroups: gmane.text.pandoc Subject: Re: Towards (better) Python filters for Pandoc with fluent queries Date: Sun, 4 Jan 2015 00:23:37 -0800 Message-ID: References: <20150102165038.GA25833@localhost.hsd1.ca.comcast.net> <4b9fb48b-091c-44c6-9201-f5c5b559253f@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e01293ff85f3785050bcf4aed X-Trace: ger.gmane.org 1420359824 4212 80.91.229.3 (4 Jan 2015 08:23:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 4 Jan 2015 08:23:44 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDRLZB6H3ABBBCPRUOSQKGQE2NUZNDY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Jan 04 09:23:40 2015 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-ob0-f190.google.com ([209.85.214.190]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Y7gTL-0004GW-5j for gtp-pandoc-discuss@m.gmane.org; Sun, 04 Jan 2015 09:23:39 +0100 Original-Received: by mail-ob0-f190.google.com with SMTP id va2sf12997689obc.7 for ; Sun, 04 Jan 2015 00:23:38 -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=MX8DkjKbt8aMg/Dh7YOtadLmu2KsmxsULhUFt/naYHc=; b=iu0GhNfCwxYZRjRO4raWXZ30FoCXxWbueZXhgWpM5sitEx6J1BFYq+B0Z8BrjKM9a0 7tOQ4YoSVSd8LIXHGjOrJypV1hST0qCQfmsNpwKf9Ap3oB95n+b67BhZt/h4CYKp4Z/g NUsWTbXngZdfkvq2c857BcBUc9rJ7XyTNRHHZiynyQcydPAzqmFI1jQdXp2Ye7QoO3jc rHDCHRtB0RvLkpC/CmEaS7k4/wsIzwF2qXfJsFofDVZC6+1BJblxATnJbO578h1yLkhh U+9o0FcwofU3qYy2uZBWiujZnNFylIebyYPDh1D2YhU1+zoNYYaI4FVOQaIf3QmEGQ9t bq9g== X-Received: by 10.182.46.234 with SMTP id y10mr64602obm.9.1420359818159; Sun, 04 Jan 2015 00:23:38 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.182.233.162 with SMTP id tx2ls3424940obc.54.gmail; Sun, 04 Jan 2015 00:23:37 -0800 (PST) X-Received: by 10.182.200.198 with SMTP id ju6mr63910860obc.26.1420359817590; Sun, 04 Jan 2015 00:23:37 -0800 (PST) Original-Received: from mail-yk0-x233.google.com (mail-yk0-x233.google.com. [2607:f8b0:4002:c07::233]) by gmr-mx.google.com with ESMTPS id q25si1159895yhb.6.2015.01.04.00.23.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 04 Jan 2015 00:23:37 -0800 (PST) Received-SPF: pass (google.com: domain of elliottslaughter-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4002:c07::233 as permitted sender) client-ip=2607:f8b0:4002:c07::233; Original-Received: by mail-yk0-f179.google.com with SMTP id 19so9598161ykq.24 for ; Sun, 04 Jan 2015 00:23:37 -0800 (PST) X-Received: by 10.236.2.41 with SMTP id 29mr15236929yhe.179.1420359817441; Sun, 04 Jan 2015 00:23:37 -0800 (PST) Original-Received: by 10.170.124.145 with HTTP; Sun, 4 Jan 2015 00:23:37 -0800 (PST) In-Reply-To: <4b9fb48b-091c-44c6-9201-f5c5b559253f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: elliottslaughter-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of elliottslaughter-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4002:c07::233 as permitted sender) smtp.mail=elliottslaughter-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:11669 Archived-At: --089e01293ff85f3785050bcf4aed Content-Type: text/plain; charset=UTF-8 On Sat, Jan 3, 2015 at 2:17 AM, Caleb McDaniel wrote: > Thanks, this looks great! And seems like it would be helpful for a filter > I use to turn endnotes into inline notes in Markdown. "Brittle" is a good > word for my current implementation of the query. > > https://gist.github.com/wcaleb/17ca606788f9b4b9a36b > > If I understand you correctly, the current Matcher only works for Blocks, > not Inlines? (Currently writing on low sleep, so that may not even be a > sensible question.) Well, the API was a bit sparse on Inlines. I've gone ahead and added queries the rest of the Inline elements, so API support is now up to 90% or so. All the Inlines are there, but there are a couple instances of attributes I can't query yet. And could it match, say, any block that has any block other than a > paragraph nested inside it? (Ditto to previous parenthetical.) > So right now, there's no negation, and no quantification other than "there exists". I added support for a search operator, so you can say: Query().Para().search(node) and it will go find all paragraphs at node or below. But it can't prove e.g. that there aren't any non-Paragraph nodes. I could imagine adding a "forall" operator that would allow something like that. Maybe something like: Query().Note().forall(Query().Para()) But I have to spend some more time thinking about the semantics of that. Caleb McDaniel > > -- > You received this message because you are subscribed to a topic in the > Google Groups "pandoc-discuss" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/pandoc-discuss/NsEGkTN4fnk/unsubscribe. > To unsubscribe from this group and all its topics, 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/4b9fb48b-091c-44c6-9201-f5c5b559253f%40googlegroups.com > . > For more options, visit https://groups.google.com/d/optout. > -- Elliott Slaughter "Don't worry about what anybody else is going to do. The best way to predict the future is to invent it." - Alan Kay -- 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/CAJ9X%3DkZu94RTat%2BSKLknvUJJQWnENd9xkF9DJCJCHhiBY-qyDA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout. --089e01293ff85f3785050bcf4aed Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Sat, Jan 3, 2015 at 2:17 AM, Caleb McDaniel <calebm= cd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Thanks, this looks great! A= nd seems like it would be helpful for a filter I use to turn endnotes into = inline notes in Markdown. "Brittle" is a good word for my current= implementation of the query.

https://gist.github.com/wcaleb/17ca606788f9b4b9a36b

If I understand you correctly, the current Matcher only works for Blocks, n= ot Inlines? (Currently writing on low sleep, so that may not even be a sens= ible question.)

Well, the API was a bit spa= rse on Inlines. I've gone ahead and added queries the rest of the Inlin= e elements, so API support is now up to 90% or so. All the Inlines are ther= e, but there are a couple instances of attributes I can't query yet.

And could it match, sa= y, any block that has any block other than a paragraph nested inside it? (D= itto to previous parenthetical.)

So rig= ht now, there's no negation, and no quantification other than "the= re exists". I added support for a search operator, so you can say:
=
Query().Para().search(node)

and it will go= find all paragraphs at node or below. But it can't prove e.g. that the= re aren't any non-Paragraph nodes. I could imagine adding a "foral= l" operator that would allow something like that. Maybe something like= :

Query().Note().forall(Query().Para())
But I have to spend some more time thinking about the semantics= of that.

Caleb McDaniel

--
You received this message because you are subscribed to a topic in the Goog= le Groups "pandoc-discuss" group.
To unsubscribe from this topic, visit https://g= roups.google.com/d/topic/pandoc-discuss/NsEGkTN4fnk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pandoc-discuss+un= subscribe-/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-d= iscuss/4b9fb48b-091c-44c6-9201-f5c5b559253f%40googlegroups.com.
For more options, visit https://groups.google= .com/d/optout.



--
Elliott Slaughter

"Don't worry about w= hat anybody else is going to do. The best way to predict the future is to i= nvent it." - Alan Kay

--
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/CAJ9X%3DkZu94RTat%2BSKLknvUJJQWnENd9x= kF9DJCJCHhiBY-qyDA%40mail.gmail.com.
For more options, visit http= s://groups.google.com/d/optout.
--089e01293ff85f3785050bcf4aed--