emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* odt macro export
@ 2016-08-05 12:33 Ken Mankoff
  2016-08-06  9:20 ` Christian Moe
  0 siblings, 1 reply; 3+ messages in thread
From: Ken Mankoff @ 2016-08-05 12:33 UTC (permalink / raw)
  To: 'emacs-orgmode@gnu.org'

Hi Org List,

I'm trying to style some ODT exports and having trouble. I'm following the examples here: http://orgmode.org/manual/Creating-one_002doff-styles.html#Creating-one_002doff-styles

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}}}

The text between the macros does not appear to be exported at all.

Thanks,

  -k.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: odt macro export
  2016-08-05 12:33 odt macro export Ken Mankoff
@ 2016-08-06  9:20 ` Christian Moe
  2016-08-06 14:19   ` Ken Mankoff
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Moe @ 2016-08-06  9:20 UTC (permalink / raw)
  To: Ken Mankoff; +Cc: 'emacs-orgmode@gnu.org'



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: odt macro export
  2016-08-06  9:20 ` Christian Moe
@ 2016-08-06 14:19   ` Ken Mankoff
  0 siblings, 0 replies; 3+ messages in thread
From: Ken Mankoff @ 2016-08-06 14:19 UTC (permalink / raw)
  To: Christian Moe; +Cc: 'emacs-orgmode@gnu.org'

Hi Christian,

On 2016-08-06 at 09:20, Christian Moe <mail@christianmoe.com> wrote:
> #+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.

Yes that does work, but as you point out, a blank line within does not work:

{{{BEGIN_RC}}}
Foo

Bar
{{{END_RC}}}

Anyway, I can work around this.

Thanks,

  -k.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-06 14:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-05 12:33 odt macro export Ken Mankoff
2016-08-06  9:20 ` Christian Moe
2016-08-06 14:19   ` Ken Mankoff

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).