emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] Publishing HTML with style sheets


From: Bernt Hansen
Subject: [Orgmode] Publishing HTML with style sheets
Date: Sun, 10 Aug 2008 11:14:42 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Hi all,

I've recently converted almost all of my in-house documents to the
org-publishing system.  I like this system a lot.  I thought I would
share some of my settings with the list.

I use external stylesheets for document formatting and I noticed that
all of the generated HTML pages have embedded style information that I
want to get rid of.

I don't think it makes sense to have a specified external stylesheet for
the publishing project and embedded styles in the document - you would
normally just put everything in the style sheet to make the documents
shorter to download.

I don't want to clobber the default style with 

,----
| (setq org-export-html-style-default "")
`----

because I want to keep the default style for single page exports but not
for projects that specify a style sheet.

My current work-around for this is to clear the default style before
publishing my project.

Here are my publishing settings

,----[ .emacs publishing settings ]
| ;; Org publishing
| (setq org-publish-project-alist
|       '(("doc-org"
|        :base-directory "~/git/org/doc.norang.ca/"
|        :publishing-directory "/ssh:address@hidden:~/doc.norang.ca/htdocs"
|        :recursive t
|        :section_numbers nil
|        :table-of-contents nil
|        :base-extention "org"
|        :publishing-function org-publish-org-to-html
|        :style "<link rel=\"stylesheet\"
|                   href=\"/org.css\"
|                   type=\"text/css\">"
|        :author-info nil
|        :creator-info nil)
|       ("doc-css"
|        :base-directory "~/git/org/doc.norang.ca/"
|        :publishing-directory "/ssh:address@hidden:~/doc.norang.ca/htdocs"
|        :base-extension "css"
|        :publishing-function org-publish-attachment
|        :recursive t
|        :author nil)
| 
|       ("doc"
|        :components("doc-org" "doc-css"))
|       ))
`----

and I have C-M-F12 bound to a function that saves the current buffer,
clears the default style, and publishes the project like this:

,----
| (defun my-save-then-publish ()
|   (interactive)
|   (save-buffer)
|   (org-save-all-org-buffers)
|   (let (org-export-html-style-default)
|     (setq org-export-html-style-default "")
|     (org-publish-current-project)))
|
| (global-set-key (kbd "C-M-<f12>") 'my-save-then-publish)
|
`----

Then I just edit the org file and hit C-M-f12 and I'm done.

This works great for me.

-Bernt




reply via email to

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