From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/7265 Path: news.gmane.org!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: error using new python filters Date: Tue, 10 Sep 2013 09:13:52 -0700 Message-ID: <20130910161352.GD83434@Johns-MacBook-Pro.local> References: <20130905162657.GA53611@Johns-MacBook-Pro.local> <0d1c3c1e-8f75-49f7-a48e-bded083c23cf@googlegroups.com> <307d269c-a2d9-4511-8ff2-d7d62b09e047@googlegroups.com> <20130906004906.GA7557@dhcp-128-32-252-11.lips.berkeley.edu> <20130906012257.GA7691@dhcp-128-32-252-11.lips.berkeley.edu> <41f5f129-2de1-4534-a62e-c7be7d49a6c9@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1378829645 13235 80.91.229.3 (10 Sep 2013 16:14:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 Sep 2013 16:14:05 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDW7ZIEHTIIBBTUKXWIQKGQELB2QU5Y-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Sep 10 18:14:09 2013 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-vb0-f62.google.com ([209.85.212.62]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VJQZr-0003kP-TP for gtp-pandoc-discuss@m.gmane.org; Tue, 10 Sep 2013 18:14:08 +0200 Original-Received: by mail-vb0-f62.google.com with SMTP id x14sf1872458vbb.7 for ; Tue, 10 Sep 2013 09:14:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=date:from:to:subject:message-id:references:mime-version:in-reply-to :user-agent: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:content-type :content-disposition; bh=/WDdEiSjuSyNOtIpNFxa6VDvT+vM/5gCRQdSyU69GlM=; b=soPJHaq/h4zHVV4ohMl/M7lX3EtKUEPT6ol/AXNjyg3Elp2l6GeHeMptmj65It9r2Q 8JoUMqmmK7sjsK6dF8+yQU2RPYSykjPW4g7hhh/PU0hrvWylNmUJ4gbDHcyJGuNRAV82 hR+kaXI9HHWH2Cf7oMNo795fmpVuWQfwu2bCfCI99eFmpTggPTgKk+GX6ThBAmsnsGWN Q0nEFBnEW8aj6dAFX/LYqpBV6wynjtHAiOCC4u446Dc9jVqrcgQhkeGSY0mV5ITMVQIK 73vMRQY7Olv+OCLeqXt60XnZ3q/CZdQsGrBq1I8KNDuj5Gy0soY0dYUxTYDKRoJk2sJk cLEA== X-Received: by 10.50.27.37 with SMTP id q5mr658325igg.9.1378829646999; Tue, 10 Sep 2013 09:14:06 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.50.80.15 with SMTP id n15ls2640616igx.39.canary; Tue, 10 Sep 2013 09:14:06 -0700 (PDT) X-Received: by 10.68.218.163 with SMTP id ph3mr7187495pbc.5.1378829646255; Tue, 10 Sep 2013 09:14:06 -0700 (PDT) Original-Received: from cm05fe.IST.Berkeley.EDU (cm05fe.IST.Berkeley.EDU. [169.229.218.146]) by gmr-mx.google.com with ESMTPS id hx4si2921492pad.1.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 10 Sep 2013 09:14:06 -0700 (PDT) Received-SPF: neutral (google.com: 169.229.218.146 is neither permitted nor denied by best guess record for domain of jgm-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org) client-ip=169.229.218.146; Original-Received: from li55-134.members.linode.com ([74.82.3.134] helo=johnmacfarlane.net) by cm05fe.ist.berkeley.edu with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (auth plain:jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org) (envelope-from ) id 1VJQZn-0000IF-I6 for pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; Tue, 10 Sep 2013 09:14:04 -0700 Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id 7A57DBBBDC; Tue, 10 Sep 2013 12:16:01 -0400 (EDT) In-Reply-To: <41f5f129-2de1-4534-a62e-c7be7d49a6c9-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-PGP-Key: http://johnmacfarlane.net/jgm.asc User-Agent: Mutt/1.5.21 (2010-09-15) X-Original-Sender: fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 169.229.218.146 is neither permitted nor denied by best guess record for domain of jgm-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org) smtp.mail=jgm-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org; dmarc=fail (p=NONE dis=NONE) d=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: Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-Subscribe: , List-Unsubscribe: , Content-Disposition: inline Xref: news.gmane.org gmane.text.pandoc:7265 Archived-At: +++ ben [Sep 10 13 03:52 ]: > Why don't you play with this and see if it works. > > I've been using **meta within filters and achieving most of what I > want very easily. A few things have cropped up in the process: > 1. Is there a was to add a class to an arbitrary block of markdown > without using
tags? Fenced code blocks kind of allow this, but > the contents are then verbatim if converting to latex. No, `
` tags are currently the only way. Look back on this list and you'll find extensive discussion of other possibilities. I don't rule out another syntax in the future, but there wasn't much agreement. > 2. Would it be possible for filters to do their work and then mark a > block of the document as 'needs re-processing' i.e., effectively > re-call the markdown parser? This would avoid the slightly hacky need > to set up if/case structures to do different things with filtered text > depending on the output format. No, this seems overly complex to me, and some aspects of parsing cannot be ported well to parts of the document (e.g. resolution of reference links). What is unsatisfactory about the current setup? Some filters will be output-format agnostic -- e.g. changing an Emph to a Strong -- and they don't need to deal with 'format' at all. Others aren't, and they'll need to deal with 'format'. Maybe you could describe the case you have in mind. > 3. Is there a description of the internal representation anywhere? It's > obviously regular and one can work out what is happening from some test > documents, but it would be nice. No, there isn't. You can work it out from a few examples plus the Text.Pandoc.Definition documentation on Hackage. Perhaps one could write a Haskell program to automatically generate some documentation of the JSON format. Right now I'm too busy; I need to focus on getting 1.12 out the door. > 4. Somewhat related to 3, would it be possible to include helper > functions in the pandoc.py module to do some common transformations on > the native documents? For example, I think it's going to be a common > case to want to extract the value of json meta data fields as a plain > text string to work with in filters. Similarly, when the filter is > performing some transformation on a chunk of text it might be nice to > have simple access to the plain text. Yes, it could be good to have a 'tostring' function to extract the string content of metavalues. (Note that this wouldn't correspond to the rendered content, which might include formatting appropriate to the output format; it would just extract contents of Str, Space, and Code elements and concatenate them.) This shouldn't be too hard to add. (And it could be added after the 1.12 release, since it's not an official part of pandoc.) John