From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/12586 Path: news.gmane.org!not-for-mail From: hjallen44-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Newsgroups: gmane.text.pandoc Subject: Re: How to get a page break (/f) from Markdown -> docx? Date: Wed, 22 Apr 2015 06:28:47 -0700 (PDT) Message-ID: 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: multipart/mixed; boundary="----=_Part_5969_494120887.1429709327621" X-Trace: ger.gmane.org 1429709346 11896 80.91.229.3 (22 Apr 2015 13:29:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Apr 2015 13:29:06 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCCLTF6K4IOBBEGE32UQKGQEB6ZLGAI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Apr 22 15:29:01 2015 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-yk0-f188.google.com ([209.85.160.188]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ykuht-00081V-4o for gtp-pandoc-discuss@m.gmane.org; Wed, 22 Apr 2015 15:28:49 +0200 Original-Received: by ykp9 with SMTP id 9sf54243797ykp.1 for ; Wed, 22 Apr 2015 06:28:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :content-type:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe; bh=fzEyJVpeSU3Z7LWYwsd/1mwRZrYl3W28P6ZV4VG68Fw=; b=rVwHHBhul/AZkf5+IZa/Itv7D8CKq0Mm2RYZJ1spS/6p0RvXoInxxH6CrNzcrizF3G 6cP7a+jXUWyJ47AMNI1N5Gt9mKzX0UWQi8XKFdZrag5kzZtyji8GvkqjIIFC9F0SvkVe gtZpnuLY/PhmihgJBf3KS1Ef0gGYRQYbdUnTUyMCrFjQg2pxqQLyTsm6Ir385OnvQwI+ uCnEOLEoP0O3EuQaHX6Dh9fq0JiNwPLcnnZd+LKB8ji63WeNfv0IhYN3SHRVud7xnVsZ SWMpGSrDYpx9b53tssdzCguinfRStiKJ16dYLUTY8auCNobfPwP7qserU8p97/tHeGKc F34Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :content-type:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe; bh=fzEyJVpeSU3Z7LWYwsd/1mwRZrYl3W28P6ZV4VG68Fw=; b=V7PZiHnreSTshevoEMhec2mwwR97N1ZMePhHIn+DgDqWJoW2YAggH+5F/UW8pz/nAG 7NSxJViiiQyY2Vtilh4uBN4JczYJ2b4TjD86s6fALdivmipfWJ+Uen9OuVXrd5S9T3iq VJFYQr5QYTWOJ9GeKJnFtOtCZJlBJDOW7yAKSSJsjXwnsaAiEUiv8h95SNE2TqE4NnT0 xs5UcVRmolYIwStkgKsw3WJG0LcYEVVLEjQ2kK999djAzwKBB/BFzk4r0FmejJOnSyCQ N3ZvU7pXTZgv0U0lBhnxfKbEpDOmx/5oURT7hLXe7wu1fvZwH6I2bHzf9u9EA9fOWwwe 6HYg== X-Received: by 10.140.31.196 with SMTP id f62mr377625qgf.30.1429709328363; Wed, 22 Apr 2015 06:28:48 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.140.86.72 with SMTP id o66ls669025qgd.6.gmail; Wed, 22 Apr 2015 06:28:47 -0700 (PDT) X-Received: by 10.140.19.196 with SMTP id 62mr258000qgh.13.1429709327975; Wed, 22 Apr 2015 06:28:47 -0700 (PDT) In-Reply-To: <253add6a-b873-4a1c-ad97-3dadf4c7ed1f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: hjallen44-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:12586 Archived-At: ------=_Part_5969_494120887.1429709327621 Content-Type: multipart/alternative; boundary="----=_Part_5970_370484860.1429709327621" ------=_Part_5970_370484860.1429709327621 Content-Type: text/plain; charset=UTF-8 Here is an update on my efforts. 1. I updated the haskell platform and Pandoc on my RHEL 6 to the latest versions. 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? 3. I also tried the following filter code replacing "PAGEBREAK" with the pgBrkXml which was successful. The result was a word file with the pagebreaks in the correct places. 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 (Para [Str "PAGEBREAK"]) = pgBrkBlock insertPgBrks blk = blk main = toJSONFilter insertPgBrks 4. In both instances, pandoc-word-pagebreak.hs was compiled as $ ghc --make pandoc-word-pagebreak.hs and the .md file was processed as: $ pandoc --filter ./pandoc-word-pagebreak input.md -o output.docx 5. Ideally, the first version replacing '\newpage' would work streamlining the ability to output in different formats. Thanks for everyone's help! Joel -- 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/f65a84c9-7e2f-4ba1-a092-0c52f5f79186%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. ------=_Part_5970_370484860.1429709327621 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Here is an update on my efforts. 
1. I updated th= e haskell platform and Pandoc on my RHEL 6 to the latest versions.
2. I = used the following filter code to replace "\newpage" with the pgBrkXml whic= h draws on the contributions above.  This was not successful.  Th= e '\newpage' entries were removed but the pgBrkXml was not inserted.
import Text.Pandoc.JSON
import Text.<= /span>Pandoc
import
Text.Pandoc.Walk = (walk)

pgBrkXml
= :: String
pgBrkXml
=3D "<w:p><w:r><w:br w:type=3D\"page\"/&= gt;</w:r></w:p>"

pgBrkBlock
:: Block
pgBrkBlock
=3D RawBlo= ck = (Format "openxml") pgBrkXml

insertPgBrks
:: Block -> BlockinsertPgBrks (RawB= lock (Format "tex") "\newpage") =3D= pgBrkBloc= k
insertPgBrks blk
=3D blk

main
=3D toJSONFilter insertPgBrks
Question:  A= re the opening imports necessary?

3. I also tried the following filt= er code replacing "PAGEBREAK" with the pgBrkXml which was successful. = The result was a word file with the pagebreaks in the correct places.
<= div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); bo= rder-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; wor= d-wrap: break-word;">

import Text.Pandoc.JSON
import = Text.Pandoc
import Text.Pandoc.Walk (
walk)

pgBrkXml
:: String
pgBrkXml
=3D "<w:p><w:r><w:br w:type=3D\"page\"/>= </w:r></w:p>"

pgBrkBlock
:: Block
pgBrkBlock
=3D= RawBlock<= /span> (Format "openxml") pgBrkXml

insertPgBrks
:: Block -> Block
= insertPgBrks
(Para [Str "PAGEBREAK"])  =3D pgBrkBlock
insertPgBrks blk
=3D blk

main
=3D toJSONFilter insertPgBrks

4. In both instances, pandoc-word-pagebreak.hs was compiled as
$ ghc --make pandoc-word-pagebreak.hs
and the .md file was pr= ocessed as:
$ pandoc --filter= ./= pandoc-word-pagebreak input.md -o output.docx

5.  Ideally, the first version repl= acing '\newpage' would work streamlining the ability to output in different= formats.

Thanks for everyone's help!
Joel


--
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/f65a84c9-7e2f-4ba1-a092-0c52f5f79186%40googlegroups.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_5970_370484860.1429709327621-- ------=_Part_5969_494120887.1429709327621--