Re: [O] Open Document Exporter

2013-06-29 Thread Georg Lehner

Hello Jambunathan!

This works great for me, Thank You!

Best Regards,

Georg Lehner

On 06/29/2013 02:43 PM, Jambunathan K wrote:

I need time to review other issues you are raising.

Georg Lehner  writes:

4. LaTeX like definition lists

Here is a patch and sample documents.  You can pull from my private repo
which is at

 http://repo.or.cz/w/org-mode/org-kjn.git





Re: [O] Open Document Exporter

2013-06-29 Thread Jambunathan K
Georg Lehner  writes:

> 2. Blank lines after headlines
> =
>
> After each headline I get a blank line. Can these be suppressed? I'd
> like to control the separation between
> headline and text by styles and not by extra lines.

When you say headline do you mean headline or title/subtitle? Show me a
sample Org and ODT file.



Re: [O] Open Document Exporter

2013-06-29 Thread Jambunathan K
Georg Lehner  writes:

> 1. content.xml changed on disk
> ==
>
> At the end of the export process I get the message:
>
> content.xml changed on disk; really edit the buffer? (y, n, r or C-h)
> Please type y, n or r; or ? for help
>
> After typing 'y', I have to reconfirm with 'yes' and then with 'y'
> again to get a valid export.
>
> Any tips how to fix or avoid this?

If you have set up everything correctly, C-c C-e O (capital O) should
launch LibreOffice for you. If not, you may have to do some extra
configuration.  Here is what I do on my Debian.

Install xdg-utils.

   sudo apt-get install xdg-utils

Make sure that xdg-open launches LibreOffice.

   xdg-open file.odt

Add this to your .emacs

   (setcdr (assq 'system org-file-apps-defaults-gnu ) "xdg-open %s")



If you are on Windows machines, make sure that
`temporary-file-directory' is configured correctly.  Check *Messages*
buffer and you will know what the ODT exporter is doing.





Re: [O] Open Document Exporter

2013-06-29 Thread Jambunathan K

I need time to review other issues you are raising.  

Georg Lehner  writes:
> 4. LaTeX like definition lists

Here is a patch and sample documents.  You can pull from my private repo
which is at 

http://repo.or.cz/w/org-mode/org-kjn.git

>From 7dfa274163fb3a06ff947e1af884af49dca34b0e Mon Sep 17 00:00:00 2001
From: Jambunathan K 
Date: Sat, 29 Jun 2013 17:59:48 +0530
Subject: [PATCH] ox-odt: Support for typesetting Description lists as in LaTeX

* etc/styles.OrgOdtStyles.xml (OrgDescriptionTerm)
(OrgDescriptionDefinition): New styles for typesetting
description lists.

* lisp/ox-odt.el (org-odt-description-list-style): New user option.
(org-odt--translate-description-lists/html): Renmed from
`org-odt--translate-description-lists.  Use new style
"OrgDescriptionTerm".  Update comments.
(org-odt--translate-description-lists/latex): New.
(org-odt-bold): Add an internal `:style' property.
---
 etc/styles/OrgOdtStyles.xml |   10 +++
 lisp/ox-odt.el  |  141 +-
 2 files changed, 134 insertions(+), 17 deletions(-)

diff --git a/etc/styles/OrgOdtStyles.xml b/etc/styles/OrgOdtStyles.xml
index f41d984..c2c32fa 100644
--- a/etc/styles/OrgOdtStyles.xml
+++ b/etc/styles/OrgOdtStyles.xml
@@ -729,6 +729,16 @@

   
 
+  
+   
+  
+
+  
+   
+
+   
+  
+
   

 
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index a76f7dd..0eaffcb 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -86,7 +86,7 @@ (org-export-define-backend 'odt
   :export-block "ODT"
   :filters-alist '((:filter-parse-tree
 		. (org-odt--translate-latex-fragments
-		   org-odt--translate-description-lists
+		   org-odt--translate-description-lists ; Dummy symbol
 		   org-odt--translate-list-tables)))
   :menu-entry
   '(?o "Export to ODT"
@@ -777,6 +777,22 @@ (defcustom org-odt-pixels-per-inch display-pixels-per-inch
   :version "24.1")
 
 
+ Lists
+
+(defcustom org-odt-description-list-style #'org-odt--translate-description-lists/html
+  "Specify how description lists are rendered.
+Choose one of HTML or LaTeX style."
+  :type '(choice
+  (const :tag "Use HTML style" org-odt--translate-description-lists/html )
+  (const :tag "Use LaTeX style" org-odt--translate-description-lists/latex ))
+  :group 'org-export-odt
+  :set (lambda (symbol value)
+	 "Alias `org-odt--translate-description-lists'."
+	 (set-default symbol value)
+  	 (fset 'org-odt--translate-description-lists value))
+  :version "24.1")
+
+
  Src Block
 
 (defcustom org-odt-create-custom-styles-for-srcblocks t
@@ -1583,7 +1599,11 @@ (defun org-odt-bold (bold contents info)
 CONTENTS is the text with bold markup.  INFO is a plist holding
 contextual information."
   (format "%s"
-	  "Bold" contents))
+	  ;; Internally, `org-odt--translate-description-lists/html'
+	  ;; or `org-odt--translate-description-lists/latex' requests
+	  ;; a custom style for bold.
+	  (or (org-element-property :style bold) "Bold")
+	  contents))
 
 
  Center Block
@@ -3650,7 +3670,7 @@ (defun org-odt-table (table contents info)
 ;;   item, but also within description lists and low-level
 ;;   headlines.
 
-;; See `org-odt-translate-description-lists' and
+;; See `org-odt--translate-description-lists' and
 ;; `org-odt-translate-low-level-headlines' for how this is
 ;; tackled.
 
@@ -3869,27 +3889,44 @@ (defun org-odt--translate-latex-fragments (tree backend info)
 ;; This translator is necessary to handle indented tables in a uniform
 ;; manner.  See comment in `org-odt--table'.
 
-(defun org-odt--translate-description-lists (tree backend info)
+;; Depending on user option `org-odt-description-list-style',
+;; description lists can be typeset either as in HTML documents or as
+;; in LaTeX documents.
+
+(defun org-odt--translate-description-lists/html (tree backend info)
   ;; OpenDocument has no notion of a description list.  So simulate it
   ;; using plain lists.  Description lists in the exported document
   ;; are typeset in the same manner as they are in a typical HTML
-  ;; document.
+  ;; document.  See `org-odt--translate-description-lists/latex' for
+  ;; yet another way of translation.
   ;;
   ;; Specifically, a description list like this:
   ;;
-  ;; ,
-  ;; | - term-1 :: definition-1
-  ;; | - term-2 :: definition-2
-  ;; `
+  ;; 	 ,
+  ;; 	 | - term-1 :: definition-1
+  ;; 	 |
+  ;; 	 | 	paragraph-1
+  ;; 	 |
+  ;; 	 | - term-2 :: definition-2
+  ;; 	 |
+  ;; 	 | 	paragraph-2
+  ;; 	 `
   ;;
   ;; gets translated in to the following form:
   ;;
-  ;; ,
-  ;; | - term-1
-  ;; |   - definition-1
-  ;; | - term-2
-  ;; |   - definition-2
-  ;; `
+  ;; 	 ,
+  ;; 	 | - term-1
+  ;; |
+  ;; 	 |   - definition-1
+  ;; 	 |
+  ;; 	 | paragraph-1
+  ;; 	 |
+  ;; 	 | - term-2
+  ;; |
+  ;; 	 |   - definition-2
+  ;; 	 |
+  ;; 	 | paragraph-2
+  ;; 	 `
   ;;
   ;; Further effect is ac

Re: [O] Open Document Exporter

2013-06-28 Thread Georg Lehner

Hello!

Here comes another (tiny) patch which fixes generation of external links 
to relative file paths.


Apparently =./Media/logo.png= has to be inserted as 
=href=../Media/logo.png=.


At least on LibreOffice 3 and 4 anything else fails.  LibreOffice always 
shows and uses the
absolute path and prefixes the stored relative path with the path to the 
=.odt= file

*including the filename itself*!

So the =../= removes the filename and the link gets calculated correctly.

Best Regards,

Georg Lehner

- - -

--- /home/jorge/progs/org-mode/lisp/ox-odt.el
+++ /home/jorge/emacs/lib/org-mode/lisp/ox-odt.el
@@ -2763,7 +2780,7 @@
 ((string= type "file")
  (if (file-name-absolute-p raw-path)
  (concat "file://" (expand-file-name raw-path))
-   (concat "file://" raw-path)))
+   (concat "file:" "../" raw-path)))
 (t raw-path)))
  ;; Convert & to & for correct XML representation
  (path (replace-regexp-in-string "&" "&" path))




Re: [O] Open Document Exporter

2013-06-27 Thread Bastien
Hi Georg,

Georg Lehner  writes:

> diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
> index a76f7dd..c8b704c 100644

This is quite a significant patch.  If you want to let us apply
it for Org, you will need to sign the FSF copyright assignment:

  http://orgmode.org/cgit.cgi/org-mode.git/plain/request-assign-future.txt

Thanks in advance for your help!

-- 
 Bastien



Re: [O] Open Document Exporter

2013-06-26 Thread Georg Lehner

On 06/25/2013 03:35 AM, Vikas Rawal wrote:

At the end of the export process I get the message:

content.xml changed on disk; really edit the buffer? (y, n, r or C-h)
Please type y, n or r; or ? for help

After typing 'y', I have to reconfirm with 'yes' and then with 'y' again to
get a valid export.

Any tips how to fix or avoid this?

You perhaps have content.xml open as a buffer in emacs. Close that
buffer, and you should be fine.

Vikas


The content.xml buffer gets created and modified by the exporter.

I have found at least one (and the more annoying) place in ox-odt.el, 
where this happens.
Using the 'write-file function Instead of (save-buffer 0) resolved the 
issue.


In the patch below there are the following "fixes" for ox-odt.el:


1. content.xml changed on disk message avoided
=

see: @@ -4092,7 +4111,9 @@


2. Internal cross references


By replacing 'OrgXref.' with '__RefHeading__' has prefix of internal 
link labels, the cross

references show the target Heading Line when the mouse hovers over them.

The patch is rather brute force, but e.g. table captions and references 
still show the
"original" behavior:  The reference shows "Table" and the caption shows 
the Table

number when hovering over them.

By replacing: text:reference-format=\"chapter\" with 
text:reference-format=\"number\"
cross references show the real chapter number, not the internal 
numbering.  This
is e.g. different, when you decide to change the outline numbering 
properties "Before"

and "After" from their defaults.

While looking at that I found out that some 'bookmarks' get generated 
twice by the
exporter: once as "OrgXref.sec-n-m" and once as "sec-n-m", with n and m 
beeing

the chapter and section numbers.


3. Search path for contributed style files
===

@@ -157,7 +157,7 @@

the search path for "git" based org-mode installations had one parent 
directory level

too much (../).

4. LaTeX like definition lists


The rest of the patch deals with trying to make definition lists

  - term :: definition

look as in LaTex and not as in HTML.

Caution! the patch is very quirky, it does not work with nested lists at 
all.

It works fine with simple, short definitions though.

How to use it:

- create a text style named 'OrgDefinitionTerm' in your template file.  
Bold text

  is sufficient.

- create a paragraph style named 'OrgDefinitionItem' in your template file.
  I made mine having a hanging indent of 2cm and one (1) tab-stop at 2.1cm.


What the patch does:

- The 'org-odt--translate-description-lists' filter is removed from the 
filter stack,
  so descriptive lists remain just descriptive lists (and do not get 
split into descriptive-1

  and descriptive-2 item pairs.

- When transcoding 'descriptive' items to ODT, the term is retrived, 
typeset in bold,

  and inserted in front of the 'contents' of the iterm, separated by a tab.

- in all "case" constructs where "descriptive-1" and "...-2" occurs, I 
added "descriptive" too.


How *should* it work:

I guess the better solution would be to modify the 
'org-odt--translate-description-lists' filter
in a way to produce the same effect on the parsed tree representation of 
the document.

So nested definition lists would work.

Of course a customizable variable, or some per file/per subtree #+ODT 
tag is needed to

switch on demand between the two representations.

Best Regards,

Georg Lehner

- - -

diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index a76f7dd..c8b704c 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -86,7 +86,7 @@
   :export-block "ODT"
   :filters-alist '((:filter-parse-tree
 . (org-odt--translate-latex-fragments
-   org-odt--translate-description-lists
+   ;;org-odt--translate-description-lists
org-odt--translate-list-tables)))
   :menu-entry
   '(?o "Export to ODT"
@@ -157,7 +157,7 @@ and `org-odt-data-dir'.")
(eval-when-compile
  (and (boundp 'org-odt-data-dir) org-odt-data-dir ; see make install
   (expand-file-name "./styles/" org-odt-data-dir)))
-   (expand-file-name "../../etc/styles/" org-odt-lib-dir) ; git
+   (expand-file-name "../etc/styles/" org-odt-lib-dir) ; git
(expand-file-name "./etc/styles/" org-odt-lib-dir)  ; elpa
(expand-file-name "./org/" data-directory)   ; system
)
@@ -201,7 +201,7 @@ version of org in use and is initialized from
 from one of: org's own private git repository, GNU ELPA tar or
 standard Emacs.")

-(defconst org-odt-bookmark-prefix "OrgXref.")
+(defconst org-odt-bookmark-prefix "__RefHeading__")

 (defconst org-odt-manifest-file-entry-tag
   "\nmanifest:full-path=\"%s\"%s/>")
@@ -1064,9 +1064,9 @@ See `org-odt--build-date-styles' for 
implementation details."

 (defun org-odt--target (text id)
   (if (not id) text
 (concat
- (format "\n" id)
+ (format "\n" id)
  (format "\n" id) text
- (format "\n" id
+ (format "\n" id))

Re: [O] Open Document Exporter

2013-06-26 Thread Nicolas Goaziou
Hello,

Georg Lehner  writes:

> In LaTeX export I have the following behaviour:
>
> [[*Headline][Headline]] converts to a Hyperlink to the respective
> headline with description text 'Headline'.
> [[*Headline]] converts to the respective headline number
>
> In ODT export both convert to the headline number.

Fixed.

> The following patch disables smart-quotes when required so by a ':nil
> option. The (when ... clause was missing from the
> original code.

Fixed.
>
> 6. Table caption does not translate
> 
>
> I have expanded the 'org-export-dictionary' constant with german (and
> spanisch) translations of all keywords.

Added.

> However my table captions still show the englisch "Table" prefix. With
> Figures (alias 'Illustrations' in ODT) things
> work fine.

This is not fixed yet. Currently, the way ODT exporter handles
translations is incompatible with `org-export-dictionary'. I'll have
a look at it.


Thank you for the report and the patches.


Regards,

-- 
Nicolas Goaziou



Re: [O] Open Document Exporter

2013-06-24 Thread Vikas Rawal
> 
> At the end of the export process I get the message:
> 
> content.xml changed on disk; really edit the buffer? (y, n, r or C-h)
> Please type y, n or r; or ? for help
> 
> After typing 'y', I have to reconfirm with 'yes' and then with 'y' again to
> get a valid export.
> 
> Any tips how to fix or avoid this?

You perhaps have content.xml open as a buffer in emacs. Close that
buffer, and you should be fine.

Vikas



[O] Open Document Exporter

2013-06-24 Thread Georg Lehner

Hello List!

I am doing a lot of technical documentation with org-mode - until now 
primarily with

the LaTeX (pdflatex) converter (Version 8.0.3 and git head respectively).

Now I have started to use the odt-exporter since my co-workers need 
something ... compatible.


It is working very well for me, however I would like to fine-tune 
several things:


1. content.xml changed on disk
==

At the end of the export process I get the message:

content.xml changed on disk; really edit the buffer? (y, n, r or C-h)
Please type y, n or r; or ? for help

After typing 'y', I have to reconfirm with 'yes' and then with 'y' again 
to get a valid export.


Any tips how to fix or avoid this?


2. Blank lines after headlines
=

After each headline I get a blank line. Can these be suppressed? I'd 
like to control the separation between

headline and text by styles and not by extra lines.


3. Internal links exporting as numbers
==

In LaTeX export I have the following behaviour:

[[*Headline][Headline]] converts to a Hyperlink to the respective 
headline with description text 'Headline'.

[[*Headline]] converts to the respective headline number

In ODT export both convert to the headline number. I believe to have 
this tracked down to the
'org-odt-link' function in ox-odt.el where the first link form seems to 
fall through to 'org-odt-link--infer-description'.


If the link description differs from the fuzzy link, eg. [[*Headline][ 
Headline]] then the export happens
inside the 'org-odt-link' function and works well - of course LaTeX 
export then shows the extra space.


The code in ox-odt.el seems to be based loosely on ox-latex.el's 
'org-latex-link' function, however seems more contrincated.


My Lisp skills are far from being able to spot the right place to fix 
this behavior. Any help is highly appreciated.



4. Description Lists
===

These are exported "HTML"-like similar to:

*definition 1*
text 1
* definition 2*
text 2

Where each definition element is an unnumbered list item without bullet 
and each text element is an

unnumbered sublist item also without bullet.

Of course I would like to have the definition lists formatted LaTeX-like:

*definition 1*and text 1
with hanging indent
*definition 2*text 2

And have tried to mangle around in the 
'org-odt--translate-description-lists' function, however I failed bitterly

to get out something useful.

I understand that I have to boldface the description (don't know how to 
do this on the parsed tree) and concatenate somehow the definition text 
- recursively, because it could have nested text-material.


Any hints where to go?


5. Smart-Quotes cannot be disabled
=

The following patch disables smart-quotes when required so by a ':nil 
option. The (when ... clause was missing from the

original code.

--- SparkleShare/jorge/emacs/lib/org-8.0.3/lisp/ox-odt.el 2013-06-24 
22:13:27.0 +0200

+++ progs/org-mode/lisp/ox-odt.el 2013-06-22 21:53:27.0 +0200
@@ -2967,8 +2967,7 @@
(setq output (org-odt--encode-plain-text output t))
;; Handle smart quotes. Be sure to provide original string since
;; OUTPUT may have been modified.
- (when (plist-get info :with-smart-quotes)
- (setq output (org-export-activate-smart-quotes output :utf-8 info text)))
+ (setq output (org-export-activate-smart-quotes output :utf-8 info text))
;; Convert special strings.
(when (plist-get info :with-special-strings)
(mapc



6. Table caption does not translate


I have expanded the 'org-export-dictionary' constant with german (and 
spanisch) translations of all keywords.
However my table captions still show the englisch "Table" prefix. With 
Figures (alias 'Illustrations' in ODT) things

work fine.

- - -

Best Regards,

Georg Lehner


Please find below the diff to current (yesterdays) ox.el with the 
translations.



diff -u SparkleShare/jorge/emacs/lib/org-8.0.3/lisp/ox.el 
progs/org-mode/lisp/ox.el
--- SparkleShare/jorge/emacs/lib/org-8.0.3/lisp/ox.el 2013-06-22 
21:55:54.0 +0200

+++ progs/org-mode/lisp/ox.el 2013-06-22 21:40:52.0 +0200
@@ -5260,19 +5260,15 @@
("zh-CN" :html "日期" :utf-8 "日期")
("zh-TW" :html "日期" :utf-8 "日期"))
("Equation"
- ("fr" :ascii "Equation" :default "Équation")
- ("de" :default "Gleichung")
- ("es" :html "Ecuación" :default "Ecuación"))
- ("Figure"
- ("de" :default "Abbildung")
- ("es" :default "Figura"))
+ ("fr" :ascii "Equation" :default "Équation"))
+ ("Figure")
("Footnotes"
("ca" :html "Peus de pàgina")
("cs" :default "Pozn\xe1mky pod carou")
("da" :default "Fodnoter")
- ("de" :html "Fußnoten" :default "Fußnoten")
+ ("de" :html "Fußnoten")
("eo" :default "Piednotoj")
- ("es" :html "Nota al pie de página" :default "Nota al pie de 
página")

+ ("es" :html "Pies de página")
("fi" :default "Alaviitteet")
("fr" :default "Notes de bas de page")
("hu" :html "Lábjegyzet")
@@ -5291,41 +5287,26 @@
("zh-CN" :html "脚注" :utf-8 "脚注")
("zh-TW" :html "腳註" :