emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] HTML export: How to export body only, as HTML "fragment"?


From: Sebastian Rose
Subject: Re: [Orgmode] HTML export: How to export body only, as HTML "fragment"?
Date: Thu, 01 Oct 2009 06:40:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Bill Powell <address@hidden> 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









reply via email to

[Prev in Thread] Current Thread [Next in Thread]