emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Publishing HTML with style sheets
@ 2008-08-10 15:14 Bernt Hansen
  0 siblings, 0 replies; only message in thread
From: Bernt Hansen @ 2008-08-10 15:14 UTC (permalink / raw)
  To: emacs-orgmode

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:www-data@www:~/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:www-data@www:~/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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-08-10 15:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-10 15:14 Publishing HTML with style sheets Bernt Hansen

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