From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/11032 Path: news.gmane.org!not-for-mail From: Jesse Rosenthal Newsgroups: gmane.text.pandoc Subject: Re: How to get a page break (/f) from Markdown -> docx? Date: Fri, 03 Oct 2014 10:39:35 -0400 Message-ID: <87a95dcj4o.fsf@jhu.edu> References: <65081506-a54b-4aff-96a0-d8e1cb6accc2@googlegroups.com> <87fvf5ckhv.fsf@jhu.edu> 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 1412347090 29027 80.91.229.3 (3 Oct 2014 14:38:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 3 Oct 2014 14:38:10 +0000 (UTC) Cc: ken.kleinman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org To: Ken Kleinman , pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDF7DMU574PBBSXJXKQQKGQE7ZQCD5Y-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Fri Oct 03 16:38:04 2014 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-qg0-f58.google.com ([209.85.192.58]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xa3zf-0001wR-9V for gtp-pandoc-discuss@m.gmane.org; Fri, 03 Oct 2014 16:38:03 +0200 Original-Received: by mail-qg0-f58.google.com with SMTP id i50sf230793qgf.3 for ; Fri, 03 Oct 2014 07:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version: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; bh=npe0jVr+uVy5h5o6lEYNStgkltkLb8uiFhBHa5M/k6w=; b=zHS1RYfOleoD/81JlGHayy587Obl3MGHzfjulTUMtXAQ3MHRtAedB+Hd8uUeTgNjbj xOYtbuxC3JimPzu0IJnIK3+pqHNWfM4q4wiKHVcIufaVlpL/G7wwCF+ST7EBzFPDFZLG MoATTupLUUArCDm2i6dQwK4gXNaZKodRMzd4MtAupRHpA5z2ejtnRoNurRhDtpsk8bxL lvBGTT9qrenO521PmV0z2//7cpdUwESrjUkP+BH+z+U7LjBHu3p1PwX01B1lSBlY6tlx af+V082AzkNePrwnpWk3dNQP0zxykFdqGrOSBRpgf4tXAGKJbiOw0ZlZcmc+FaYr4GRs Ck1A== X-Received: by 10.50.43.228 with SMTP id z4mr152760igl.3.1412347082516; Fri, 03 Oct 2014 07:38:02 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.50.13.4 with SMTP id d4ls1042787igc.19.canary; Fri, 03 Oct 2014 07:38:02 -0700 (PDT) X-Received: by 10.66.182.17 with SMTP id ea17mr5083851pac.1.1412347082049; Fri, 03 Oct 2014 07:38:02 -0700 (PDT) Original-Received: from IPMTW1.johnshopkins.edu (ipmtw1.johnshopkins.edu. [128.220.229.140]) by gmr-mx.google.com with ESMTPS id dh5si1597535qcb.1.2014.10.03.07.38.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 Oct 2014 07:38:02 -0700 (PDT) Received-SPF: none (google.com: prvs=34620305a=jrosenthal-4GNroTWusrE@public.gmane.org does not designate permitted sender hosts) client-ip=128.220.229.140; X-IronPort-AV: E=Sophos;i="5.04,647,1406606400"; d="scan'208";a="3474165" Original-Received: from guppy.hwcampus.jhu.edu (HELO localhost) ([10.161.33.108]) by IPMTW1.johnshopkins.edu with ESMTP/TLS/AES128-SHA; 03 Oct 2014 10:37:43 -0400 In-Reply-To: User-Agent: Notmuch/0.18.1+65~g9f0f30f (http://notmuchmail.org) Emacs/24.3.1 (i686-pc-linux-gnu) X-Original-Sender: jrosenthal-4GNroTWusrE@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: prvs=34620305a=jrosenthal-4GNroTWusrE@public.gmane.org does not designate permitted sender hosts) smtp.mail=prvs=34620305a=jrosenthal-4GNroTWusrE@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:11032 Archived-At: Ken Kleinman writes: > I gather you've provided the necessary XML code, Jesse. Thanks. Would the > idea of filters be a way in to making this work? Well, I'll be. John was right. You need to use the "openxml" format for a raw block. Here's the block you need to work with: ~~~{.haskell} pgBrkXml :: String pgBrkXml = "" pgBrkBlock :: Block pgBrkBlock = RawBlock (Format "openxml") pgBrkXml ~~~ And then you need a filter that can place it at the right point. Let's say you want to put it before every top-level header: ~~~ insertPgBreaks :: [Block] -> [Block] insertPgBreaks [] = [] insertPgBreaks (b : h@(Header 1 _ _): blks) = b : pgBrkBlock : (insertPgBreaks blks) insertPgBreaks (b : blks) = b : (insertPgBreaks blks) go :: Pandoc -> Pandoc go (Pandoc m blks) = Pandoc m (insertPgBreaks blks) main = toJSONFilter go ~~~ I haven't tested it yet, but something like that. Cool. I didn't know you could do this. Best, Jesse