emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christian Moe <mail@christianmoe.com>
To: Ken Mankoff <mankoff@gmail.com>
Cc: "'emacs-orgmode@gnu.org'" <emacs-orgmode@gnu.org>
Subject: Re: odt macro export
Date: Sat, 06 Aug 2016 11:20:50 +0200	[thread overview]
Message-ID: <m2k2fucky5.fsf@vpn-client267.uio.no> (raw)
In-Reply-To: <m2vazfwg3l.fsf@gmail.com>



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	other threads:[~2016-08-06  9:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-05 12:33 odt macro export Ken Mankoff
2016-08-06  9:20 ` Christian Moe [this message]
2016-08-06 14:19   ` Ken Mankoff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2k2fucky5.fsf@vpn-client267.uio.no \
    --to=mail@christianmoe.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mankoff@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).