emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-export-blocks, HTML, <p> problem.
@ 2011-10-07 23:16 Jacek Generowicz
  2011-10-07 23:58 ` Samuel Wales
  0 siblings, 1 reply; 3+ messages in thread
From: Jacek Generowicz @ 2011-10-07 23:16 UTC (permalink / raw)
  To: emacs-orgmode

I am trying to define a custom block for export to HTML with
org-export-blocks, but I'm getting confused by the way <p> tags are
inserted.

I've whittled my org-export-blocks-format-blah function down to the form

(defun huh/org-export-blocks-format-blah (body &rest headers)
    ;; One of the two trivial bodies shown below
        )

Both of my versions of the test function ignore the block body and
write a hard-wired placeholder instead. The placeholder is sandwiched
between a preamble and a postamble. In one test function the preamble
and post amble are written as HTML, in the other as plain text.

Odd things happen when I export *two* consecutive blocks with the HTML
version. The implementations of the two test functions and their
corresponding results are shown below.

  ==================================   |   
==================================
      body of format function          |     body of format function
  ==================================   |   
==================================
(concat                               |  (concat
  "\n#+HTML: . . . . BEFORE . . . .\n" |   "\n. . . . BEFORE . . . .\n"
  "body of block goes here"            |   "body of block goes here"
  "\n#+HTML: . . . . AFTER . . . .")   |   "\n . . . . AFTER . . . .")
                                       |
                                       |   
==================================
  ==================================   |               output
              output                   |   
==================================
  ==================================   |   <div id="content">
  <div id="content">                   |  <h1 class="title">My  
heading</h1>
  <h1 class="title">My heading</h1>    |
                                       |
                                       |
  <p>                                  |
  . . . . BEFORE . . . .               |  . . . . BEFORE . . . .
  body of block goes here              |      <p>
   . . . . AFTER . . . .               |  body of block goes here
  </p>                                 |  . . . . AFTER . . . .
  <p>                                  |
  . . . . BEFORE . . . .               |  . . . . BEFORE . . . .
  body of block goes here              |      body of block goes here
   . . . . AFTER . . . .               |  . . . . AFTER . . . .
  </p></div>                           |  </p></div>
  ==================================   |  
==================================

In the plain version, the all of preamble-body-postamble text is
enclosed in <p> ... </p>, once for each exported block.

In the HTML version, only one <p> ... </p> pair appears, enclosing
everything except the first preamble. (As my real preamble should
contain an opening tag which is closed in the postamble, the presence
of an unmatched <p> between the two causes trouble.)

Can you shed any light on what is going on?

Thanks.

(I am using org-mode version 7.7)

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

* Re: org-export-blocks, HTML, <p> problem.
  2011-10-07 23:16 org-export-blocks, HTML, <p> problem Jacek Generowicz
@ 2011-10-07 23:58 ` Samuel Wales
  2011-10-08  7:25   ` Jacek Generowicz
  0 siblings, 1 reply; 3+ messages in thread
From: Samuel Wales @ 2011-10-07 23:58 UTC (permalink / raw)
  To: Jacek Generowicz; +Cc: emacs-orgmode

Although you are talking about special blocks, it's worth pointing out that
the following exports with incorrect nesting.  To make it
nest properly you have to add newlines.

I did not follow the previous thread, so this might be irrelevant.

===

#+html: <div something>
this is a paragraph.

and another.
#+html: </div>

third.

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

* Re: org-export-blocks, HTML, <p> problem.
  2011-10-07 23:58 ` Samuel Wales
@ 2011-10-08  7:25   ` Jacek Generowicz
  0 siblings, 0 replies; 3+ messages in thread
From: Jacek Generowicz @ 2011-10-08  7:25 UTC (permalink / raw)
  To: Samuel Wales; +Cc: emacs-orgmode


On 2011 Oct 8, at 01:58, Samuel Wales wrote:

> Although you are talking about special blocks, it's worth pointing  
> out that
> the following exports with incorrect nesting.  To make it
> nest properly you have to add newlines.
>
> [...]
>
> ===
>
> #+html: <div something>
> this is a paragraph.
>
> and another.
> #+html: </div>
>
> third.


Yes, I can reproduce that. And a newline before the second #+html  
fixes it. Adding an extra newline to my org-export-blocks-format-blah  
seems to fix my problem.

Thank you.

> I did not follow the previous thread, so this might be irrelevant.


I'm not sure which other thread you mean? This one:

    http://article.gmane.org/gmane.emacs.orgmode/41407

?

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

end of thread, other threads:[~2011-10-08  7:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-07 23:16 org-export-blocks, HTML, <p> problem Jacek Generowicz
2011-10-07 23:58 ` Samuel Wales
2011-10-08  7:25   ` Jacek Generowicz

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