emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] odt macro export


From: Christian Moe
Subject: Re: [O] odt macro export
Date: Sat, 06 Aug 2016 11:20:50 +0200
User-agent: mu4e 0.9.17; emacs 24.5.1


Ken Mankoff writes:

> This works:
>
> #+BEGIN_ODT
> <text:p text:style-name="Text_20_body_20_bold">
> This paragraph is specially formatted and uses bold text.
> </text:p>
> #+END_ODT
>
> But this does not. Should it?
>
> #+MACRO: BEGIN_RC @@odt:<text:p  text:style-name="Text_20_body_20_bold">@@
> #+MACRO: END_RC @@odt:</text:p>@@
> {{{BEGIN_RC}}}
> This paragraph is specially formatted and uses bold text.
> {{{END_RC}}}

You can analyze the problem by examining the content.xml part of the ODT
document. (On my system, simply opening the ODT file in Emacs reveals
the unzipped files in dired; your settings may vary.)

In this case, your source is already treated as a block and wrapped in a
<p> element, so macro expansion results in a <p> illegally wrapped in a
<p>:

#+begin_example
  <text:p text:style-name="OrgSubtitle"/>
  <text:p text:style-name="Text_20_body"><text:p  
text:style-name="Text_20_body_20_bold">
  This paragraph is specially formatted and uses bold text.
  </text:p>
  </text:p>
#+end_example

This makes it different to style a paragraph block with macros. You
could add closing and opening tags to the macros, but that would result
in empty paragraphs (double spacing) on either side.

However, following the example in the Info, you could create a bold
character style, and use the inline <text:span> instead of the block
<text:p> in your macro. Actually, my version of LibreOffice has a "Bold"
character style pre-defined, so I can just do this:

#+begin_example
  #+MACRO: BEGIN_RC @@odt:<text:span text:style-name="Bold">@@
  #+MACRO: END_RC @@odt:</text:span>@@

  {{{BEGIN_RC}}}This paragraph is specially formatted and uses bold 
text.{{{END_RC}}}
#+end_example

This should solve your use case. It does not provide a convenient method
if you want to affect paragraph-style properties rather than
character-style ones, though.

Yours,
Christian



reply via email to

[Prev in Thread] Current Thread [Next in Thread]