From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/12588 Path: news.gmane.org!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: How to get a page break (/f) from Markdown -> docx? Date: Wed, 22 Apr 2015 08:44:25 -0700 Message-ID: <20150422154425.GC52517@localhost.hsd1.ca.comcast.net> References: <65081506-a54b-4aff-96a0-d8e1cb6accc2@googlegroups.com> <2085f4cb-d713-4975-a739-9ad775cd37c4@googlegroups.com> <20150420171718.GB49983@localhost.hsd1.ca.comcast.net> <86515234-38b7-4fa5-8d21-0c94fe3cf9f6@googlegroups.com> <253add6a-b873-4a1c-ad97-3dadf4c7ed1f@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 X-Trace: ger.gmane.org 1429717491 27506 80.91.229.3 (22 Apr 2015 15:44:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Apr 2015 15:44:51 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCJZJHG45QDBB2MD36UQKGQES3T7KHI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Apr 22 17:44:43 2015 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-yk0-f187.google.com ([209.85.160.187]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YkwpO-0002ij-OG for gtp-pandoc-discuss@m.gmane.org; Wed, 22 Apr 2015 17:44:42 +0200 Original-Received: by ykq19 with SMTP id 19sf55755513ykq.0 for ; Wed, 22 Apr 2015 08:44:41 -0700 (PDT) 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: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=mDgPh641MOcxLDCAWJZ3b6G1+lSqIwFkl3IUw/AP3fE=; b=M7xqxsR4FhyoTnmylbAaJB5gqBfzgSGZ/97iTbrIHZKFYyvW3zvold6tYoSPlrdOHO i3wIjAiN3QOwySxMLXHJTOTsBKcbW8qWdn46hAqMSXj6BMOimxkrbqHBhOLMiMkqXYh+ pFePItH9TaYdDk+SSiaNk1LQ4i8UnAQehlsbOE7Qzpwdt1X+g4P4QjRKwPlsqYVpaWUO Od98JkoIvze50rstiFJjMHKJbCe7uMNSSPuYzyP8tKC1/nxBPgEz+yvsWZSftOz/RB7A 4UQrtOIs21df8AiHyX589RxfSV+A83ue5J8j7lFdjBaLwKMMBhg38oLsdKa/Ux/XnBva CyLw== 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: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=mDgPh641MOcxLDCAWJZ3b6G1+lSqIwFkl3IUw/AP3fE=; b=QrndsM+aTPSVQwSN+8eUxcOCLtsU8rVlWDKZdXXrWHk25/oMxxHus/xsi9SpF8rMSM isJPuey3sJfneVretQuqQNfmFaTKsYX+6NACRVs8qd5pvypnfXZ8hPqXf97Dm9VP+7eX MA3PzGH0B1kGgmFyzy/CyQpm6ng2HXpT/i6ykm3Bvq2NS7BbbACxSFXNN5bJZWbARNUY viGdeiWcX676Olez8mFSaowSacdCNcCvz2O5BAhgEnSBfQzMvs3vHUxhbOUYhkDFKC2h 0jQjJ9Zblu6TQKOT4MPJ76wn+newyshK1GN+lk+9vlbfmQ6CTBNLQ8YrF/CGpxCcb9gK p9 X-Received: by 10.182.63.40 with SMTP id d8mr211034obs.39.1429717481841; Wed, 22 Apr 2015 08:44:41 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.182.116.228 with SMTP id jz4ls350013obb.45.gmail; Wed, 22 Apr 2015 08:44:41 -0700 (PDT) X-Received: by 10.182.219.225 with SMTP id pr1mr37660650obc.23.1429717481087; Wed, 22 Apr 2015 08:44:41 -0700 (PDT) Original-Received: from mail-pd0-f171.google.com (mail-pd0-f171.google.com. [209.85.192.171]) by gmr-mx.google.com with ESMTPS id pr3si754843pbb.2.2015.04.22.08.44.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Apr 2015 08:44:41 -0700 (PDT) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 209.85.192.171 as permitted sender) client-ip=209.85.192.171; Original-Received: by pdbqa5 with SMTP id qa5so277239471pdb.1 for ; Wed, 22 Apr 2015 08:44:41 -0700 (PDT) X-Gm-Message-State: ALoCoQllFVCcTNAHBMyDgCHrPG74ILe3ttlsPEUuw5unN1bsjtCx1k9Ep07IOEtrPx2R79iOvLpa X-Received: by 10.68.201.138 with SMTP id ka10mr48695891pbc.6.1429717480830; Wed, 22 Apr 2015 08:44:40 -0700 (PDT) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by mx.google.com with ESMTPSA id tz4sm5524993pac.46.2015.04.22.08.44.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Apr 2015 08:44:38 -0700 (PDT) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id 699DAA621; Wed, 22 Apr 2015 11:44:26 -0400 (EDT) Content-Disposition: inline In-Reply-To: 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.192.171 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:12588 Archived-At: +++ hjallen44-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [Apr 22 15 06:28 ]: >Here is an update on my efforts. >2. I used the following filter code to replace "\newpage" with the pgBrkXml >which draws on the contributions above. This was not successful. The >'\newpage' entries were removed but the pgBrkXml was not inserted. >import Text.Pandoc.JSON >import Text.Pandoc >import Text.Pandoc.Walk (walk) > >pgBrkXml :: String >pgBrkXml = "" > >pgBrkBlock :: Block >pgBrkBlock = RawBlock (Format "openxml") pgBrkXml > >insertPgBrks :: Block -> Block >insertPgBrks (RawBlock (Format "tex") "\newpage") = pgBrkBlock >insertPgBrks blk = blk > >main = toJSONFilter insertPgBrks >Question: Are the opening imports necessary? You should only need Text.Pandoc.JSON. To see why this didn't work, I did `pandoc -t native` and saw that hi \newpage there comes out as [Para [Str "hi"] ,Para [RawInline (Format "tex") "\\newpage"] ,Para [Str "there"]] This strikes me as a bug -- \newpage should be a block element. I'll fix that later. For now, you could add a clause insertPgBrks (Para [RawInline (Format "tex") "\newpage"]) = pgBrkBlock