emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Carriage return in macro
@ 2013-08-23 20:04 Timothy Aldrich
  2013-08-26 10:16 ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Timothy Aldrich @ 2013-08-23 20:04 UTC (permalink / raw)
  To: emacs-orgmode

Hello all.

I have a simple macro defined to simplify the inclusion of a style for
odt-export. It looks like this:

#+MACRO: HEADING #+ODT:<text:p style-name="MyHeading">$1</text:p>

and then to add this style to any text within the document, I simply call it
like this:
 
{{{HEADING( A really great headline )}}}

This is all fine... Until I want to apply the same process to a multi-line
section.  I end up with several macro calls , one per line.

{{{BODY(line one of body)}}} {{{BODY(line two of body)}}} {{{BODY(line three
of body)}}} {{{BODY(line four of body)}}}

Is there any way to have carriage returns within the text of the macro ?

I have already tried using the #+BEGIN_ODT...#+END_ODT construct, but that
*really* messes with the format of the text within it.


-Tim

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

* Re: Carriage return in macro
  2013-08-23 20:04 Carriage return in macro Timothy Aldrich
@ 2013-08-26 10:16 ` Nicolas Goaziou
  2013-08-27 17:40   ` Tim
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2013-08-26 10:16 UTC (permalink / raw)
  To: Timothy Aldrich; +Cc: emacs-orgmode

Hello,

Timothy Aldrich <wiskey5alpha@gmail.com> writes:

> I have a simple macro defined to simplify the inclusion of a style for
> odt-export. It looks like this:
>
> #+MACRO: HEADING #+ODT:<text:p style-name="MyHeading">$1</text:p>
>
> and then to add this style to any text within the document, I simply call it
> like this:
>  
> {{{HEADING( A really great headline )}}}
>
> This is all fine... Until I want to apply the same process to a multi-line
> section.  I end up with several macro calls , one per line.
>
> {{{BODY(line one of body)}}} {{{BODY(line two of body)}}} {{{BODY(line three
> of body)}}} {{{BODY(line four of body)}}}
>
> Is there any way to have carriage returns within the text of the
> macro ?

No, there isn't. Macros target small substitutions.

> I have already tried using the #+BEGIN_ODT...#+END_ODT construct, but that
> *really* messes with the format of the text within it.

What do you mean? I don't know odt exporter very well, but contents of
the block should be included as-is.


Regards,

-- 
Nicolas Goaziou

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

* Re: Carriage return in macro
  2013-08-26 10:16 ` Nicolas Goaziou
@ 2013-08-27 17:40   ` Tim
  2013-08-27 19:06     ` Nicolas Goaziou
  2013-08-30 11:05     ` Jambunathan K
  0 siblings, 2 replies; 7+ messages in thread
From: Tim @ 2013-08-27 17:40 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Timothy Aldrich

At Mon, 26 Aug 2013 12:16:53 +0200,
Nicolas Goaziou wrote:
> > Is there any way to have carriage returns within the text of the
> > macro ?
> 
> No, there isn't. Macros target small substitutions.
> 
> > I have already tried using the #+BEGIN_ODT...#+END_ODT construct, but that
> > *really* messes with the format of the text within it.
> 
> What do you mean? I don't know odt exporter very well, but contents of
> the block should be included as-is.
> 
If I put several lines into an #+BEGIN_ODT..#+END_ODT block, all whitespace 
formating is lost.  A list like

- List one
- List two
- List three 

becomes

- List one - List two - List three

This is why I started puting the formatting on each line, and rather than 
type all of the <text:p... on every line, i created a macro.  Ill just stick
with that i guess... still better than using a word processer ;-) 

Thanks
Tim
--

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

* Re: Carriage return in macro
  2013-08-27 17:40   ` Tim
@ 2013-08-27 19:06     ` Nicolas Goaziou
  2013-08-30 11:05     ` Jambunathan K
  1 sibling, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2013-08-27 19:06 UTC (permalink / raw)
  To: Tim; +Cc: emacs-orgmode

Hello,

Tim <wiskey5alpha@gmail.com> writes:

> If I put several lines into an #+BEGIN_ODT..#+END_ODT block, all whitespace 
> formating is lost.  A list like
>
> - List one
> - List two
> - List three 
>
> becomes
>
> - List one - List two - List three

I don't quite understand. You are expected to put valid odt code within
an ODT block. You may be after an example block?


Regards,

-- 
Nicolas Goaziou

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

* Re: Carriage return in macro
  2013-08-27 17:40   ` Tim
  2013-08-27 19:06     ` Nicolas Goaziou
@ 2013-08-30 11:05     ` Jambunathan K
  2013-08-31  6:41       ` Jambunathan K
  1 sibling, 1 reply; 7+ messages in thread
From: Jambunathan K @ 2013-08-30 11:05 UTC (permalink / raw)
  To: Tim; +Cc: emacs-orgmode, Nicolas Goaziou

[-- Attachment #1: Type: text/plain, Size: 1447 bytes --]

Tim <wiskey5alpha@gmail.com> writes:

> At Mon, 26 Aug 2013 12:16:53 +0200,
> Nicolas Goaziou wrote:
>> > Is there any way to have carriage returns within the text of the
>> > macro ?
>> 
>> No, there isn't. Macros target small substitutions.
>> 
>> > I have already tried using the #+BEGIN_ODT...#+END_ODT construct, but that
>> > *really* messes with the format of the text within it.
>> 
>> What do you mean? I don't know odt exporter very well, but contents of
>> the block should be included as-is.
>> 
> If I put several lines into an #+BEGIN_ODT..#+END_ODT block, all whitespace 
> formating is lost.  A list like
>
> - List one
> - List two
> - List three 
>
> becomes
>
> - List one - List two - List three
>
> This is why I started puting the formatting on each line, and rather than 
> type all of the <text:p... on every line, i created a macro.  Ill just stick
> with that i guess... still better than using a word processer ;-) 
>
> Thanks
> Tim

The attached document shows how you can attach custom styles to
standalone paragraphs and the paragraph within lists.  You can export
with and without ATTR_ODT lines and see whether it offers what you want.

The changes are available from my git repository at 

Web URL:  http://repo.or.cz/w/org-mode/org-kjn.git
Pull URL: http://repo.or.cz/r/org-mode/org-kjn.git

Note that the above URL is my own repository and not the official
Orgmode's.

I am CCing Nicolas.  Just in case...

> --

[-- Attachment #2: parstyles.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 10820 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: parstyles.org --]
[-- Type: text/x-org, Size: 1788 bytes --]

* COMMENT Simple paragraphs

Testing testing testing testing Testing testing testing testing
Testing testing testing testing Testing testing testing testing
Testing testing testing testing Testing testing testing testing
Testing testing testing testing Testing testing testing testing
Testing testing testing testing Testing testing testing testing
Testing testing testing testing

#+ATTR_ODT: :style "Text_20_body_20_indent"
Testing testing testing testing Testing testing testing testing
Testing testing testing testing Testing testing testing testing
Testing testing testing testing Testing testing testing testing
Testing testing testing testing Testing testing testing testing
Testing testing testing testing Testing testing testing testing
Testing testing testing testing

#+ATTR_ODT: :style "Text_20_body_20_bold"
Testing testing testing testing Testing testing testing testing
Testing testing testing testing Testing testing testing testing
Testing testing testing testing Testing testing testing testing
Testing testing testing testing Testing testing testing testing
Testing testing testing testing Testing testing testing testing
Testing testing testing testing

* COMMENT Paragraphs in Simple list

1. L1N1
2. L1N4
3. L1N5

#+ATTR_ODT: :p-style "Text_20_body_20_bold"
1. L1N1
2. L1N4
3. L1N5

* Paragraphs in Complex list

#+ATTR_ODT: :style "OrgBulletedList" :p-style "Text_20_body_20_bold"
1. N1
   1. N11
   2. N12
2. N2
   #+ATTR_ODT: :style "OrgNumberedList" :p-style "Preformatted_20_Text"
   * B21

   * B22
     - B221

       First paragraph.

       #+ATTR_ODT: :style "OrgBibliographyList" :p-style "Text_20_body"
       1. one
       2. two
       3. three

       #+ATTR_ODT: :style "Text_20_body_20_indent"
       Second paragraph.

     - B222
   * B23
3. N3



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

* Re: Carriage return in macro
  2013-08-30 11:05     ` Jambunathan K
@ 2013-08-31  6:41       ` Jambunathan K
  2013-08-31 12:38         ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Jambunathan K @ 2013-08-31  6:41 UTC (permalink / raw)
  To: Tim; +Cc: Nicolas Goaziou, emacs-orgmode


Nicolas

In the context of the example below (i.e., the way #+ATTR_ODT are used
/within/ the list) is it fair to say this:

    A #+ATTR_ODT: can be attached only to a plain-list - Visually they
    come before the first item of the top-level list or a nested list.

    Using an #+ATTR_ODT line before a second or subsequent item will
    result in splitting of the original list.

I just want to confirm my understanding of the /existing/ behaviour so
that I can extract maximum juice out of ox.el.

To avoid confusion: Opinions surrounding how comments and meta lines
influence the list structure doesn't bother me one way or the other.

Jambunathan K <kjambunathan@gmail.com> writes:

> #+ATTR_ODT: :style "OrgBulletedList" :p-style "Text_20_body_20_bold"
> 1. N1
>    1. N11
>    2. N12
> 2. N2
>    #+ATTR_ODT: :style "OrgNumberedList" :p-style "Preformatted_20_Text"
>    * B21
>
>    * B22
>      - B221
>
>        First paragraph.
>
>        #+ATTR_ODT: :style "OrgBibliographyList" :p-style "Text_20_body"
>        1. one
>        2. two
>        3. three
>
>        #+ATTR_ODT: :style "Text_20_body_20_indent"
>        Second paragraph.
>
>      - B222
>    * B23
> 3. N3

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

* Re: Carriage return in macro
  2013-08-31  6:41       ` Jambunathan K
@ 2013-08-31 12:38         ` Nicolas Goaziou
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2013-08-31 12:38 UTC (permalink / raw)
  To: Jambunathan K; +Cc: emacs-orgmode, Tim

Hello,

Jambunathan K <kjambunathan@gmail.com> writes:

> In the context of the example below (i.e., the way #+ATTR_ODT are used
> /within/ the list) is it fair to say this:
>
>     A #+ATTR_ODT: can be attached only to a plain-list - Visually they
>     come before the first item of the top-level list or a nested list.
>
>     Using an #+ATTR_ODT line before a second or subsequent item will
>     result in splitting of the original list.
>
> I just want to confirm my understanding of the /existing/ behaviour so
> that I can extract maximum juice out of ox.el.

That's correct: items cannot get affiliated keywords (see list of
exceptions at line 32 in org-element.el).


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2013-08-31 12:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-23 20:04 Carriage return in macro Timothy Aldrich
2013-08-26 10:16 ` Nicolas Goaziou
2013-08-27 17:40   ` Tim
2013-08-27 19:06     ` Nicolas Goaziou
2013-08-30 11:05     ` Jambunathan K
2013-08-31  6:41       ` Jambunathan K
2013-08-31 12:38         ` Nicolas Goaziou

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).