* export to temporary HTML file and open
@ 2014-02-13 2:37 Erik Hetzner
0 siblings, 0 replies; only message in thread
From: Erik Hetzner @ 2014-02-13 2:37 UTC (permalink / raw)
To: Org Mode
Hi all,
This may be of some interest to list members, and possibly for org
mode itself.
I find myself wanting to get a nice view of org files, for printing or
otherwise, and would like to export to HTML. But I don’t want to have
a bunch of HTML files in my org directory. Here is a hack to allow you
to export to a temporary HTML file and open in a browser, for when you
don’t want to create an HTML file in your org directory.
best, Erik
(defun org-html-export-to-temp-file
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to a temporary HTML file.
If narrowing is active in the current buffer, only export its
narrowed part.
If a region is active, export that region.
A non-nil optional argument ASYNC means the process should happen
asynchronously. The resulting file should be accessible through
the `org-export-stack' interface.
When optional argument SUBTREEP is non-nil, export the sub-tree
at point, extracting information from the headline properties
first.
When optional argument VISIBLE-ONLY is non-nil, don't export
contents of hidden elements.
When optional argument BODY-ONLY is non-nil, only write code
between \"<body>\" and \"</body>\" tags.
EXT-PLIST, when provided, is a property list with external
parameters overriding Org default settings, but still inferior to
file-local settings.
Return output file's name."
(interactive)
(let* ((extension (concat "." org-html-extension))
(file (make-temp-file "org-export" nil extension))
(org-export-coding-system org-html-coding-system))
(org-export-to-file 'html file
async subtreep visible-only body-only ext-plist)))
(org-export-define-derived-backend 'html-temp 'html
:menu-entry
'(?h 2
((?t "As temporary HTML file and open"
(lambda (a s v b)
(if a (org-html-export-to-temp-file t s v b)
(org-open-file (org-html-export-to-temp-file nil s v b))))))))
--
Sent from my free software system <http://fsf.org/>.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-02-13 2:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-13 2:37 export to temporary HTML file and open Erik Hetzner
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).