Michael

Thanks for this report.  This is a bug in the ODT exporter. I have
checked in a fix to both hotfix-7.8.06 and master branch few minutes
ago.

I am attaching a sample Org file and the ODT file generated after the
the above fix.  Let me know if you have questions or run into other
issues.  Will appreciate if you can confirm the fix.

#+TITLE:     Internal Links and org-odt.el
#+AUTHOR:    Jambunathan K
#+EMAIL:     kjambunat...@gmail.com
#+DATE:      2012-04-20 Fri
#+DESCRIPTION:
#+KEYWORDS:
#+LANGUAGE:  en
#+OPTIONS:   H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
#+OPTIONS:   TeX:t LaTeX:dvipng skip:nil d:nil todo:t pri:nil tags:t

#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
#+LINK_UP:
#+LINK_HOME:
#+XSLT:


* Preface

- Hint :: To view the various links that are in this Org file do =M-x
          visible-mode=.
- Note :: Internal links that resolve to headlines will be replaced
          with their section numbers.  The description component of the
          internal links will be ignored.
- Tip 1 :: Always re-save the Org-exported ODT file once it is opened
           in LibreOffice.  This will force LibreOffice to rewrite the
           document.
- Tip 2 :: To identify unstable or broken internal links, from within
           LibreOffice do, /Tools->Update->Update All/ or
           /Tools->Update->Fields/.  Re-scan the document subsequently
           to identify problematic links.

* One
#<<#tag>>

  Some text.

* One Dot Five
  :PROPERTIES:
  :CUSTOM_ID: one-dot-five
  :END:

  Some text.

#<<invisible-target-in-the-middle-of-nowhere>>

  Some more text.

* One Dot Seven Five

  Some <<Visible Target>> text.

* Two

1. Section [[#tag][link]]

  This is a link destined for an invisible target. Note that the
  invisible target gets resolved (or bound) to the headline.

2. Section [[*One][One]]

  This is a link created with =C-c l= /(M-x org-store-link)/ and then
  inserting with =C-c C-l= /(M-x org-insert-link)/.  See /“(info "(org)
  Handling links")”/.

3. Section [[#one-dot-five][One Dot Five]]

  Link to a headline which has a /CUSTOM\_ID/. Created in the same
  manner as /Item (2)/.

4. Section [[One Dot Five]]

  This is a link created by hand.  This is another way to link to a
  headline.

5. Click this to land in a section text -  [[Visible%20Target][Visible Target]]

   This is a link to a visible target.  Recommended way of creating
   them is to proceed as in /Item (2)/ but modify the /Description:/
   offered at the prompt, so that the leading /file:/ component is
   stripped (=file:~/tmp-odt/foobar.org::Visible Target=) and just the
   part after =::= is used.

6. Section [[invisible-target-in-the-middle-of-nowhere][Invisible target in the middle of nothingness]]

  This link will be unstable.  Avoid such links.

Attachment: foobar.odt
Description: foobar.odt


> Hi,
>
> I am coming into a curious bug. I don’t know if it an orgmode one or an
> libreoffice one.

> When a export-as-odt the simple org file attached to this mail, and
> open the odt file, I obtain an odt file very «unstable»: As soon as copy
> and paste any text into the file, the link called "link" just
> disappear. (sometime it disappears when I’m doing some else, as a pdf
> export for example)
>
> If I configure LibreOffice to display the «Field Name», the name of the
> link is still here, OrgXref.tag, but not the link itself.
>
> It’s the first time I was using internal link into a odt org-exported
> file.
>
> Thanks in advance for you help.

> Emacs version: "GNU Emacs 24.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version
> 3.2.3) of 2012-04-10 on zelenka, modified by Debian"
>
> Org-version: Org-mode version 7.8.06 (from debian packaging)
>
> LibreOffice Version: 3.5.2-4 (from debian packaging)

-- 

Attachment: foobar.odt
Description: application/vnd.oasis.opendocument.text

#+TITLE:     Internal Links and org-odt.el
#+AUTHOR:    Jambunathan K
#+EMAIL:     kjambunat...@gmail.com
#+DATE:      2012-04-20 Fri
#+DESCRIPTION:
#+KEYWORDS:
#+LANGUAGE:  en
#+OPTIONS:   H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
#+OPTIONS:   TeX:t LaTeX:dvipng skip:nil d:nil todo:t pri:nil tags:t

#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
#+LINK_UP:
#+LINK_HOME:
#+XSLT:


* Preface

- Hint :: To view the various links that are in this Org file do =M-x
          visible-mode=.
- Note :: Internal links that resolve to headlines will be replaced
          with their section numbers.  The description component of the
          internal links will be ignored.
- Tip 1 :: Always re-save the Org-exported ODT file once it is opened
           in LibreOffice.  This will force LibreOffice to rewrite the
           document.
- Tip 2 :: To identify unstable or broken internal links, from within
           LibreOffice do, /Tools->Update->Update All/ or
           /Tools->Update->Fields/.  Re-scan the document subsequently
           to identify problematic links.

* One
#<<#tag>>

  Some text.

* One Dot Five
  :PROPERTIES:
  :CUSTOM_ID: one-dot-five
  :END:

  Some text.

#<<invisible-target-in-the-middle-of-nowhere>>

  Some more text.

* One Dot Seven Five

  Some <<Visible Target>> text.

* Two

1. Section [[#tag][link]]

  This is a link destined for an invisible target. Note that the
  invisible target gets resolved (or bound) to the headline.

2. Section [[*One][One]]

  This is a link created with =C-c l= /(M-x org-store-link)/ and then
  inserting with =C-c C-l= /(M-x org-insert-link)/.  See /“(info "(org)
  Handling links")”/.

3. Section [[#one-dot-five][One Dot Five]]

  Link to a headline which has a /CUSTOM\_ID/. Created in the same
  manner as /Item (2)/.

4. Section [[One Dot Five]]

  This is a link created by hand.  This is another way to link to a
  headline.

5. Click this to land in a section text -  [[Visible%20Target][Visible Target]]

   This is a link to a visible target.  Recommended way of creating
   them is to proceed as in /Item (2)/ but modify the /Description:/
   offered at the prompt, so that the leading /file:/ component is
   stripped (=file:~/tmp-odt/foobar.org::Visible Target=) and just the
   part after =::= is used.

6. Section [[invisible-target-in-the-middle-of-nowhere][Invisible target in the middle of nothingness]]

  This link will be unstable.  Avoid such links.

Reply via email to