From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Griswold Subject: Re: tricky odt export needs Date: Thu, 21 Nov 2013 15:52:41 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c29d3c2dc39504ebb61417 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjbF1-0006H9-F7 for emacs-orgmode@gnu.org; Thu, 21 Nov 2013 15:52:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VjbEz-0004hC-Vv for emacs-orgmode@gnu.org; Thu, 21 Nov 2013 15:52:47 -0500 Received: from mail-qe0-x22b.google.com ([2607:f8b0:400d:c02::22b]:35744) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjbEw-0004gr-Ra for emacs-orgmode@gnu.org; Thu, 21 Nov 2013 15:52:45 -0500 Received: by mail-qe0-f43.google.com with SMTP id 2so256552qeb.2 for ; Thu, 21 Nov 2013 12:52:42 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Christian Moe Cc: emacs-orgmode@gnu.org --001a11c29d3c2dc39504ebb61417 Content-Type: text/plain; charset=ISO-8859-1 Well, as you can see with my exchange with Suvayu I got past the error. Yet I still have a strange problem. Your solution works on a small test file, but not on my large (~ 13k words) document. The conversion of "text" to "page" just doesn't happen. I do have a special style file, so I thought that might be the issue. But even when I remove the line #+ODT_STYLES_FILE: "book.ott" from the head of the file, there still seems to be no conversion. Puzzled, Dan On Wed, Nov 20, 2013 at 4:33 PM, Christian Moe wrote: > > I said: > > > You can do cross-references with ordinary links. Have a look at the > > manual section 4.2, "Internal links". However, what you get out of the > > box is textual references to e.g. section headings, not page > > references. You can change that for each reference individually by > > right-clicking on them in LibreOffice. There should be a way to get page > > references by default, but off the cuff, I'm not sure how. > > Well, here's one way to get those page references, using filters: > > (defun my-odt-filter-pagerefs (text backend info) > "Make page references, not textual references in ODT export." > (when (org-export-derived-backend-p backend 'odt) > (replace-regexp-in-string "text:reference-format=\"text\"" > "text:reference-format=\"page\"" text))) > > (add-to-list 'org-export-filter-link-functions > 'my-odt-filter-pagerefs) > > (Whee! I just wrote my first export filter.) > > Org doesn't know what the page number will be, so when you open the > document in e.g. LibreOffice, you still have to update fields (Tools > > Update) before you see page numbers. > > Yours, > Christian > > > > --001a11c29d3c2dc39504ebb61417 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Well, as you can see with my exchange with Suvay= u I got past the error. Yet I still have a strange problem. Your solution w= orks on a small test file, but not on my large (~ 13k words) document. The = conversion of "text" to "page" just doesn't happen.=

I do have a special style file, so I thought that might be the is= sue. But even when I remove the line #+ODT_STYLES_FILE: "book.ott"= ;
=A0from the head of the file, there still seems to be no conversion.
Puzzled,

Dan



On Wed, Nov 20, 2013 at 4:33 PM, C= hristian Moe <mail@christianmoe.com> wrote:

I said:

> You can do cross-references with ordinary links. Have a look at the > manual section 4.2, "Internal links". However, what you get = out of the
> box is textual references to e.g. section headings, not page
> references. You can change that for each reference individually by
> right-clicking on them in LibreOffice. There should be a way to get pa= ge
> references by default, but off the cuff, I'm not sure how.

Well, here's one way to get those page references, using filters:=

(defun my-odt-filter-pagerefs (text backend info)
=A0 =A0 =A0 =A0"Make page references, not textual references in ODT ex= port."
=A0 =A0 =A0 =A0(when (org-export-derived-backend-p backend 'odt)
=A0 =A0 =A0 =A0 =A0 =A0 =A0(replace-regexp-in-string "text:reference-f= ormat=3D\"text\"" "text:reference-format=3D\"page\= "" text)))

(add-to-list 'org-export-filter-link-functions
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'my-odt-filter-pagerefs)

(Whee! I just wrote my first export filter.)

Org doesn't know what the page number will be, so when you open the
document in e.g. LibreOffice, you still have to update fields (Tools > Update) before you see page numbers.

Yours,
Christian




--001a11c29d3c2dc39504ebb61417--