From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/11898 Path: news.gmane.org!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: Idea: Support for centred block-level elements, without necessarily needing to revise pandoc Date: Sun, 1 Feb 2015 10:41:24 -0800 Message-ID: <20150201184124.GE13226@localhost.hsd1.ca.comcast.net> References: <2a08b6a8-d381-45bc-9361-3bf402544fb0@googlegroups.com> <20150201064534.GB12964@localhost.hsd1.ca.comcast.net> <15411876-5ead-405f-b72f-4db72406b9d4@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=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1422816100 31641 80.91.229.3 (1 Feb 2015 18:41:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 1 Feb 2015 18:41:40 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCJZJHG45QDBBYXGXGTAKGQEXE2INII-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Feb 01 19:41:40 2015 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-oi0-f58.google.com ([209.85.218.58]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YHzSl-0006bk-QD for gtp-pandoc-discuss@m.gmane.org; Sun, 01 Feb 2015 19:41:39 +0100 Original-Received: by mail-oi0-f58.google.com with SMTP id a3sf11418015oib.3 for ; Sun, 01 Feb 2015 10:41:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=from:date:to:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :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; bh=TyYJIf64sxRDAVZJBLsFbTbtnmwkEL0USVDIVp3/F1E=; b=dPvrmf6XtS13JtMLvwhJVYMCd8+393OIfCLjoLo2SqUi8J/lkOkUYJOAXrp4ADPFOj K7W3DmdsCRYQ2DQ/KqIq7sQ5UCVL0qhT2N3u6SfJgidhvSsmNxFACup8n14532RWub6A uwc6cixxOCCH6eid84v8Hb/xkdJwO+C0hhms979Pr0iMU/xLrEqfiBLmOLEmI96kDFsE /CM1+orV5Y3KHGxLz1mjHmwhBy2FokCZKEoeRwNPcafZiKYaVQNs98AnAy9MKpIneSjb Y2xDQqxkOl4pyLE/Bf6AwseNb+4D6qEjJowsbo54FhEgj/3nAt2YbzQzl+MoBdxMp X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:subject:message-id:references :mime-version:content-type:content-disposition :content-transfer-encoding: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; bh=TyYJIf64sxRDAVZJBLsFbTbtnmwkEL0USVDIVp3/F1E=; b=BubiTDV/djvb/H4o/5u2q6s0xfHiZm/cWRSpsinIukxcrBKEs+iO/RUwzACqgAa7b/ NoBdxCm63MB5KYV4OTYq0pkk+QBAQBjJRqABaOvs1E3sBGnS/0bcri9t6uIBDvlCgv3n oVjLhWW2W0czLJoUNNZ+3EY9L1UhoQh/Z40rUpEuXWolXXzgduDlCScI1GipIW5ytdgQ xpz9B0pZuYjgL30jfR93eLfU0G8PkGJIeKuNd2vlyeTHVbOJx+PbS1YzrYIxC0YlRPTM z88DUnOCurxzCsw/BylsRdrd+FLbbYJZLw2CBc8yspX6 X-Received: by 10.182.243.163 with SMTP id wz3mr98537obc.14.1422816098958; Sun, 01 Feb 2015 10:41:38 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.182.56.227 with SMTP id d3ls869980obq.35.gmail; Sun, 01 Feb 2015 10:41:38 -0800 (PST) X-Received: by 10.182.68.50 with SMTP id s18mr14810947obt.47.1422816098290; Sun, 01 Feb 2015 10:41:38 -0800 (PST) Original-Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com. [209.85.220.45]) by gmr-mx.google.com with ESMTPS id q14si1826422pdj.0.2015.02.01.10.41.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 01 Feb 2015 10:41:38 -0800 (PST) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 209.85.220.45 as permitted sender) client-ip=209.85.220.45; Original-Received: by mail-pa0-f45.google.com with SMTP id et14so73105986pad.4 for ; Sun, 01 Feb 2015 10:41:38 -0800 (PST) X-Gm-Message-State: ALoCoQllTl8fjgyScM1d5kK1TXgi4smCS+pogTsNgfnKN7APJyWR0gtcM6Mi2NzEhadCudvzDQOo X-Received: by 10.66.62.137 with SMTP id y9mr23945666par.87.1422816098064; Sun, 01 Feb 2015 10:41:38 -0800 (PST) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by mx.google.com with ESMTPSA id a6sm16538444pbu.95.2015.02.01.10.41.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Feb 2015 10:41:36 -0800 (PST) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id 1978FA27B; Sun, 1 Feb 2015 13:41:25 -0500 (EST) Content-Disposition: inline In-Reply-To: <15411876-5ead-405f-b72f-4db72406b9d4-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-PGP-Key: http://johnmacfarlane.net/jgm.asc User-Agent: Mutt/1.5.23 (2014-03-12) X-Original-Sender: jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 209.85.220.45 as permitted sender) smtp.mail=jgm-TVLZxgkOlNX2fBVCVOL8/A@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:11898 Archived-At: I think for your purposes (if you don't need blockquotes for another purpose, which sounds like the case), you could just write a filter that converts blockquotes to HTML center elements. You can write the filter in Haskell or in python, perl, or a number of other languages with pandoc filter libraries. In Haskell it would look something like ``` haskell #!/usr/bin/env runhaskell import Text.Pandoc.JSON main =3D toJSONFilter bqToCenter where bqToCenter (Just (Format "html")) (BlockQuote bs) =3D RawBlock (Format "html") "
" : bs ++ [RawBlock (Format "html") "
" bqToCenter x =3D [x] ``` (untested). See the pandocfilters library in PyPI for many examples using the python library, if that's what you prefer. To invoke your filter (assuming it's executable and called bqToCenter.hs): pandoc --filter ./bqToCenter.hs etc. +++ Gordon Steemson [Feb 01 15 00:14 ]: >Well, it still seems straightforward enough. These days Unicode is >available. If someone wants a literal arrow in those positions they can us= e >a dash other than an ASCII hyphen-minus, or use an angle bracket other tha= n >an ASCII less-than / greater-than, or just break down and use a Unicode >arrow character directly (several exist to choose from). > >I agree with you that centred or right alignment are presentational things >(unless you=E2=80=99re trying to write Arabic or Hebrew, in which case lef= t >alignment is), but I strongly believe that being able to centre something >on the page is nevertheless important to conveying meaning in certain >narrow use cases, in the same way as a hard line break is within a postal >address. I am attempting to use Pandoc to publish my mediocre attempts at >fiction to various online repositories, and in examining the results of my >past (pre-Pandoc) efforts, I have come to the conclusion that there is a >marked difference in effect when some important bit of information is >placed in the middle of the page, versus as just an unusually short >paragraph clustered at the left edge with all the others. > >I approve in principle of your proposed solution (=E2=80=9Cjust use a =E2= =80=B9div=E2=80=BA element >and style it with CSS=E2=80=9D); unfortunately, several of the submission = formats I >am forced to conform to are extremely crippled, and do not support either >of those features of HTML. Rephrasing them as some other feature is far >from simple from within the Lua custom writer. > >Short of outputting to a native Haskell representation file, piping that t= o >a filter program, and piping that result back through a second invocation >of Pandoc, is there any way of invoking a transformational filter on the >native AST as it is being processed? I keep seeing various language >bindings (Perl, Python, PHP, etc.) that appear to be for doing just that, >but I can=E2=80=99t find any mention of how you actually invoke a filter w= ritten to >use one of them when you start the Pandoc tool. > >On Saturday, 31 January 2015 22:45:48 UTC-8, John MacFarlane wrote: >> >> +++ Gordon Steemson [Jan 31 15 18:25 ]: >> >1) If someone, just to be difficult, needs to have literal ASCII arrows >> at >> >the start and/or end of their actual output text block, can it be >> >accommodated in a simple way by backslash-escaping? At what stage does >> that >> >get stripped out =E2=80=94 before the custom writer functions get calle= d or >> after? >> >> Before. The escaping is resolved in the parser. >> > > >>2) What would be involved in modifying the Pandoc markdown parser to >> >recognize the obvious extension to this syntax, demonstrated below? >> >> Well, it would be quite involved. We'd need to modify the Pandoc >> document model to add these alignment containers (though I suppose >> we could use Div elements with special classes), then modify the >> Markdown parser and all the writers. >> >> Centering has come up before on this list (you can search for earlier >> discussions). My general feeling is that pandoc should focus on >> structural elements of documents, and things like centering and >> right-aligning are too presentational. >> >> Note you can always put things in divs with classes, and format them >> with CSS in HTML or with a simple filter in other formats. >> > >--=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 = 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/15411876-5ead-405f-b72f-4db72406b9d4%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/20150201184124.GE13226%40localhost.hsd1.ca.comcast.net. For more options, visit https://groups.google.com/d/optout.