emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sebastian Rose <sebastian_rose@gmx.de>
To: Bill Powell <bill@billpowellisalive.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: HTML export: How to export body only, as HTML "fragment"?
Date: Thu, 01 Oct 2009 06:40:58 +0200	[thread overview]
Message-ID: <87ws3fd8v9.fsf@gmx.de> (raw)
In-Reply-To: <20091001014756.GA11179@billpowellisalive.com> (Bill Powell's message of "Wed, 30 Sep 2009 21:47:56 -0400")

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

  parent reply	other threads:[~2009-10-01  4:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-09-30 14:53 Bill Powell

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=87ws3fd8v9.fsf@gmx.de \
    --to=sebastian_rose@gmx.de \
    --cc=bill@billpowellisalive.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).