From: thorne <ego111@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Emacs lisp code export difference between `org-export-region-as-html' and `org-export-as-html'
Date: Mon, 24 Sep 2012 00:34:17 -0600 [thread overview]
Message-ID: <CALrBS=PYPPcPw2oqu6cmtii79MEMr1Nv42M1PzF_DC4VtCgPqw@mail.gmail.com> (raw)
Can I use babel to generate html to be exported in a #+BEGIN_HTML
... section using `org-export-region-as-html'? I ask because the
behaviour I am seeing is different depending on whether I use that
function or `org-export-as-html'. The former function exports
the html code to show the html code, whereas the later exports
the html code directly as html.
To concretize that a bit, I have a pair of functions that look
like this (have I misunderstood they way the export is supposed
to work?) --
(defun embed-pdf-function (pdf-file)
(concat "<iframe src=\"http://docs.google.com/gview?url=http://example.net/"
pdf-file
"&embedded=true\" style=\"width:25em; height:38em;\"
frameborder=\"0\"></iframe>\n"))
(defun embed-pdf (pdf-file)
(interactive "MFile name: ")
(insert (concat
"#+BEGIN_SRC emacs-lisp :exports results :results html\n"
"(embed-pdf-function \"" pdf-file "\")\n"
"#+END_SRC")))
When I call the first in an org buffer and give it "foo.pdf" as
an argument, it inserts something that looks like this:
#+BEGIN_SRC emacs-lisp :exports results :results html
(embed-pdf-function "foo.pdf")
#+END_SRC
When I use `org-export-as-html' in that buffer I end up with an
html file that includes this, which IS what I would want:
<iframe src="http://docs.google.com/gview?url=http://example.net/foo.pdf&embedded=true"
style="width:25em; height:38em;" frameborder="0"></iframe>
But, when I instead use `org-export-region-as-html' in a
program (because I am hoping to get the results as a string,
rather than in a buffer) using something like this --
(org-export-region-as-html (point-min) (point-max) t 'string)
-- the result I get in the html looks like this:
<pre class="example">
<iframe src="http://docs.google.com/gview?url=http://example.net/foo.pdf&embedded=true"
style="width:25em; height:38em;" frameborder="0"></iframe>
</pre>
Which of course is not the iframe I was hoping for, but is the
code to render the code for it in html.
Should the region export function work the way I am hoping at
all? -- can it be made to do so?
(
I also have the following set globally, if it is relevant:
(setq org-confirm-babel-evaluate nil)
(setq org-export-babel-evaluate t)
and --
M-x org-version RET ==> "Org-mode version 7.8.11"
)
next reply other threads:[~2012-09-24 6:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-24 6:34 thorne [this message]
2012-09-24 21:53 ` Emacs lisp code export difference between `org-export-region-as-html' and `org-export-as-html' thorne
2012-09-25 1:24 ` Bastien
2012-09-25 6:05 ` thorne
2012-09-25 9:13 ` Bastien
2012-09-26 7:28 ` thorne
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='CALrBS=PYPPcPw2oqu6cmtii79MEMr1Nv42M1PzF_DC4VtCgPqw@mail.gmail.com' \
--to=ego111@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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).