emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* HTML export: How to export body only, as HTML "fragment"?
@ 2009-09-30 14:53 Bill Powell
  0 siblings, 0 replies; 4+ messages in thread
From: Bill Powell @ 2009-09-30 14:53 UTC (permalink / raw)
  To: emacs-orgmode

Hi! First off, thanks to all for this amazing org-mode.

I'd like to set up org-mode publishing mode to work with the
blogging program pyblosxom. The HTML export that works
out-of-the-box is almost perfect, but I need to:

- get HTML export to just convert the text to HTML,
  without wrapping a template and <head> and <html> and
<body> tags around it. I can't find an option to do this,
but it seems like if there isn't one, it should be fairly
easy to implement. Pyblosxom needs HTML fragments so it can
wrap my custom templates with dynamic title lists, etc.

- tell org-mode to export the first few lines without
  touching them. Pyblosxom uses these lines to store things
like the title, the tag list, and other variables. This
pyblosxom "header" looks like this:

First line is the title.
#tags meta,about
#blurb A pyblosxom variable line begins with #.

HTML Export will slurp lines that begin with # by default:
is there a way to turn this feature off?

Anyhow, thanks very much for having a look. Sorry if the
solution's already thre and I missed it. I know I could
write a custom function to do this, but it seems cleaner to
/not/ wrap the file, rather than wrap and then clean it.

Bill Powell



-- 
_____________________________________________________________

http://stmarysmessenger.com : New Catholic magazine for kids!
http://wineskinmedia.com : Books and sites crafted with care.
http://billpowellisalive.com : Man found alive with two legs.  
_____________________________________________________________

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

* HTML export: How to export body only, as HTML "fragment"?
@ 2009-10-01  1:47 Bill Powell
  2009-10-01  3:06 ` Matt Lundin
  2009-10-01  4:40 ` Sebastian Rose
  0 siblings, 2 replies; 4+ messages in thread
From: Bill Powell @ 2009-10-01  1:47 UTC (permalink / raw)
  To: emacs-orgmode

Hi! First off, thanks to all for this amazing org-mode.

Second, sorry if this posts twice. I've just joined the
list, and may have messed up. :)

I've just come in and seen the thread on using org-mode for
blogging. Actually, I'd like to set up org-mode publishing
mode to work with the blogging program called pyblosxom. The
HTML export that works out-of-the-box is almost perfect, but
I need to:

- get HTML export to just convert the text to HTML,
  without wrapping a template and <head> and <html> and
<body> tags around it. I can't find an option to do this,
but it seems like if there isn't one, it should be fairly
easy to implement. Pyblosxom needs HTML fragments so it can
wrap my custom templates with dynamic title lists, etc.

- tell org-mode to export the first few lines without
  touching them. Pyblosxom uses these lines to store things
like the title, the tag list, and other variables. This
pyblosxom "header" looks like this:

First line is the title.
#tags meta,about
#blurb A pyblosxom variable line begins with #.

HTML Export will slurp lines that begin with # by default:
is there a way to turn this feature off?

Anyhow, thanks very much for having a look. Sorry if the
solution's already thre and I missed it. I know I could
write a custom function to do this, but it seems cleaner to
/not/ wrap the file, rather than wrap and then clean it.

Bill Powell


-- 
_____________________________________________________________

http://stmarysmessenger.com : New Catholic magazine for kids!
http://wineskinmedia.com : Books and sites crafted with care.
http://billpowellisalive.com : Man found alive with two legs.  
_____________________________________________________________

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

* Re: HTML export: How to export body only, as HTML "fragment"?
  2009-10-01  1:47 HTML export: How to export body only, as HTML "fragment"? Bill Powell
@ 2009-10-01  3:06 ` Matt Lundin
  2009-10-01  4:40 ` Sebastian Rose
  1 sibling, 0 replies; 4+ messages in thread
From: Matt Lundin @ 2009-10-01  3:06 UTC (permalink / raw)
  To: Bill Powell; +Cc: emacs-orgmode

Bill Powell <bill@billpowellisalive.com> writes:

> - get HTML export to just convert the text to HTML,
>   without wrapping a template and <head> and <html> and
> <body> tags around it. I can't find an option to do this,
> but it seems like if there isn't one, it should be fairly
> easy to implement. Pyblosxom needs HTML fragments so it can
> wrap my custom templates with dynamic title lists, etc.

There are BODY-ONLY arguments for both org-export-as-html and
org-export-region-as-html.

Here's an example provided in the docstring of
org-export-region-as-html:

,----
|   (setq html (org-export-region-as-html beg end t 'string))
`----

Best,
Matt

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

* Re: HTML export: How to export body only, as HTML "fragment"?
  2009-10-01  1:47 HTML export: How to export body only, as HTML "fragment"? Bill Powell
  2009-10-01  3:06 ` Matt Lundin
@ 2009-10-01  4:40 ` Sebastian Rose
  1 sibling, 0 replies; 4+ messages in thread
From: Sebastian Rose @ 2009-10-01  4:40 UTC (permalink / raw)
  To: Bill Powell; +Cc: emacs-orgmode

Bill Powell <bill@billpowellisalive.com> writes:
> - get HTML export to just convert the text to HTML,
>   without wrapping a template and <head> and <html> and
> <body> tags around it. I can't find an option to do this,
> but it seems like if there isn't one, it should be fairly
> easy to implement. Pyblosxom needs HTML fragments so it can
> wrap my custom templates with dynamic title lists, etc.



(require 'org-publish)
(setq org-publish-project-alist
      '(("org-notes"
         ...
         :body-only t  ;; w.o. head and body tags
         ...


> - tell org-mode to export the first few lines without
>   touching them. Pyblosxom uses these lines to store things
> like the title, the tag list, and other variables. This
> pyblosxom "header" looks like this:
>
> First line is the title.
> #tags meta,about
> #blurb A pyblosxom variable line begins with #.


You could add a completion-function to the export project in
question. OK, this is a hack, but using Org-mode to produce Pyblosxom
somthing is too, isn't it?



(require 'org-publish)
(setq org-publish-project-alist
      '(("org-notes"
         ...
         :body-only t  ;; w.o. head and body tags
         ...
         :completion-function my-re-add-header-lines


(defun my-re-add-header-lines ()
  "Docstring.."

  ;; You can access the project-plist, that the export functions have
  ;; set up for you. All those values are set in
  ;; `org-publish-project-alist'.

  (let* ((base-dir
          (file-name-as-directory
            (plist-get project-plist :base-directory)))
         (orig
          (expand-file-name
           (concat base-dir
           (plist-get project-plist :index-filename))))
         (strip-suffix
          (or (plist-get project-plist :base-extension) "org"))
         (add-suffix
          (or (plist-get project-plist :html-extension) "html"))
   ....

)


BTW: you could even define your own values in
`org-publish-project-alist' since the list is used just as is.


> HTML Export will slurp lines that begin with # by default:
> is there a way to turn this feature off?

No, they're considered comments.



    Sebastian

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

end of thread, other threads:[~2009-10-01  4:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-01  1:47 HTML export: How to export body only, as HTML "fragment"? Bill Powell
2009-10-01  3:06 ` Matt Lundin
2009-10-01  4:40 ` Sebastian Rose
  -- strict thread matches above, loose matches on Subject: below --
2009-09-30 14:53 Bill Powell

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