emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [new exporter] :wrap problems
@ 2012-12-05 20:31 Michael Gauland
  2012-12-05 20:42 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Gauland @ 2012-12-05 20:31 UTC (permalink / raw)
  To: emacs-orgmode

I've run into trouble using the :wrap option with babel, with the new exporter.
Using :wrap to put the result in an EXAMPLE block works consistently, but
putting the result into a SRC block is inconsistent.  This example:

* :wrap example
  #+BEGIN_SRC ruby :results value :exports both :wrap EXAMPLE
  "This string came from Ruby."
  #+END_SRC

  #+BEGIN_SRC ruby :results value :exports both :wrap SRC fundamental
  "This string also came from Ruby."
  #+END_SRC

Works as I would expect with the old exporter, but the new exporter does not
process the generated SRC block. Exporting to ASCII gives me:

:wrap example
=============

  ,----
  | "This string came from Ruby."
  `----

  ,----
  | This string came from Ruby.
  `----

  ,----
  | "This string also came from Ruby."
  `----

  #+BEGIN_SRC fundamental This string also came from Ruby.
  #+END_SRC fundamental

The HTML and LaTeX exporters behave similarly (ie., the old exporters work; the
new ones don't). The org files I'm using contain several such blocks, and I've
found that some will be exported corretly, and others won't, though I haven't
noticed any pattern.

Can anyone verify that this behaviour is not unique to my system (and perhaps
suggest where the problem may be?)

Kind Regards,
Mike Gauland

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

* Re: [new exporter] :wrap problems
  2012-12-05 20:31 [new exporter] :wrap problems Michael Gauland
@ 2012-12-05 20:42 ` Nicolas Goaziou
  2012-12-05 21:25   ` Michael Gauland
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2012-12-05 20:42 UTC (permalink / raw)
  To: Michael Gauland; +Cc: emacs-orgmode

Hello,

Michael Gauland <mikelygee@no8wireless.co.nz> writes:

> I've run into trouble using the :wrap option with babel, with the new exporter.
> Using :wrap to put the result in an EXAMPLE block works consistently, but
> putting the result into a SRC block is inconsistent.  This example:
>
> * :wrap example
>   #+BEGIN_SRC ruby :results value :exports both :wrap EXAMPLE
>   "This string came from Ruby."
>   #+END_SRC
>   #+BEGIN_SRC ruby :results value :exports both :wrap SRC fundamental
>   "This string also came from Ruby."
>   #+END_SRC
>
> Works as I would expect with the old exporter, but the new exporter does not
> process the generated SRC block. Exporting to ASCII gives me:
>
> :wrap example
> =============
>
>   ,----
>   | "This string came from Ruby."
>   `----
>
>   ,----
>   | This string came from Ruby.
>   `----
>
>   ,----
>   | "This string also came from Ruby."
>   `----
>
>   #+BEGIN_SRC fundamental This string also came from Ruby.
>   #+END_SRC fundamental

I only have time for a cursory look at the problem right now, but
I notice one obvious error: ":wrap src fundamental" generates wrong Org
syntax. It should be "#+END_SRC" not "#+END_SRC fundamental".

I assume that fixing it on the Babel side should make the problem go
away.


Regards,

-- 
Nicolas Goaziou

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

* Re: [new exporter] :wrap problems
  2012-12-05 20:42 ` Nicolas Goaziou
@ 2012-12-05 21:25   ` Michael Gauland
  2012-12-05 21:27     ` [PATCH] Babel: Fix the #+END_ directive from the :wrap param Michael Gauland
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Gauland @ 2012-12-05 21:25 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <n.goaziou <at> gmail.com> writes:
> I only have time for a cursory look at the problem right now, but
> I notice one obvious error: ":wrap src fundamental" generates wrong Org
> syntax. It should be "#+END_SRC" not "#+END_SRC fundamental".
> 
> I assume that fixing it on the Babel side should make the problem go
> away.

That seems to do the trick--thanks for spotting it.

I'll submit a patch.

--Mike

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

* [PATCH] Babel: Fix the #+END_ directive from the :wrap param
  2012-12-05 21:25   ` Michael Gauland
@ 2012-12-05 21:27     ` Michael Gauland
  2012-12-19 20:17       ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Gauland @ 2012-12-05 21:27 UTC (permalink / raw)
  To: emacs-orgmode


* lisp/ob.el: Only use the :wrap argument up to the first space when creating
  the #+END_ directive.

Using an option like ":wrap SRC fundamental" was generating and end marker of
"#+END_SRC fundamental", which caused the new exporter to fail to handle to
block properly.

TINYCHANGE
---
 lisp/ob.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
 mode change 100644 => 100755 lisp/ob.el

diff --git a/lisp/ob.el b/lisp/ob.el
old mode 100644
new mode 100755
index c030a7f..563233e
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -1997,7 +1997,8 @@ code ---- the results are extracted in the syntax of the
source
 		(cond
 		 ((assoc :wrap (nth 2 info))
 		  (let ((name (or (cdr (assoc :wrap (nth 2 info))) "RESULTS")))
-		    (funcall wrap (concat "#+BEGIN_" name) (concat "#+END_" name))))
+		    (funcall wrap (concat "#+BEGIN_" name) 
+			     (concat "#+END_" (car (split-string name))))))
 		 ((member "html" result-params)
 		  (funcall wrap "#+BEGIN_HTML" "#+END_HTML"))
 		 ((member "latex" result-params)
-- 
1.7.9

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

* Re: [PATCH] Babel: Fix the #+END_ directive from the :wrap param
  2012-12-05 21:27     ` [PATCH] Babel: Fix the #+END_ directive from the :wrap param Michael Gauland
@ 2012-12-19 20:17       ` Nicolas Goaziou
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2012-12-19 20:17 UTC (permalink / raw)
  To: Michael Gauland; +Cc: emacs-orgmode

Hello,

Michael Gauland <mikelygee@no8wireless.co.nz> writes:

> * lisp/ob.el: Only use the :wrap argument up to the first space when creating
>   the #+END_ directive.

Applied. Thank you.


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2012-12-19 20:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-05 20:31 [new exporter] :wrap problems Michael Gauland
2012-12-05 20:42 ` Nicolas Goaziou
2012-12-05 21:25   ` Michael Gauland
2012-12-05 21:27     ` [PATCH] Babel: Fix the #+END_ directive from the :wrap param Michael Gauland
2012-12-19 20:17       ` 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).