From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: HTML export and heading levels Date: Tue, 15 Jan 2008 21:05:26 -0500 Message-ID: <87wsqaplsp.fsf@gollum.intra.norang.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JExex-000561-CB for emacs-orgmode@gnu.org; Tue, 15 Jan 2008 21:05:43 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JExew-00055P-Ov for emacs-orgmode@gnu.org; Tue, 15 Jan 2008 21:05:43 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JExew-00055C-Hs for emacs-orgmode@gnu.org; Tue, 15 Jan 2008 21:05:42 -0500 Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JExew-0004WU-Hq for emacs-orgmode@gnu.org; Tue, 15 Jan 2008 21:05:42 -0500 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1JExer-00005h-Ti for emacs-orgmode@gnu.org; Wed, 16 Jan 2008 02:05:37 +0000 Received: from cpe000102d0fe75-cm0012256ecbde.cpe.net.cable.rogers.com ([99.239.148.180]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 16 Jan 2008 02:05:37 +0000 Received: from bernt by cpe000102d0fe75-cm0012256ecbde.cpe.net.cable.rogers.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 16 Jan 2008 02:05:37 +0000 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi Carsten and list, I started playing with HTML export this week and since I'm lazy I don't want to have to remember to export. I created a few simple functions that export my org file to HTML and copies the resulting HTML file to my webserver when I save my org file using C-x C-s. This works great for sharing my ToDo list and other documents with other people. -----8<----- (defvar bth-publish-command "/home/bernt/bin/publish" "Command used to publish a document") (defun bth-publish-buffer () "Publish the document associated with the current buffer." (interactive) (cond ((not (buffer-file-name)) (error "This buffer is not associated with a file")) ((buffer-modified-p) (error "Save buffer prior to publishing this document")) (t (message "Updating document..") (if (/= 0 (call-process bth-publish-command nil nil nil (buffer-file-name))) (error "Failed to update document") (message "Done."))))) (defun bth-export-save-then-publish () "Save the current buffer, export to HTML, and publish on the website" (interactive) (save-buffer) (org-export-as-html 2) (bth-publish-buffer) (message "Published.")) (defun bth-org-define-keys () "Define C-x C-s for buffer whose filename ends with .org" (when (and (buffer-file-name) (string= (substring (buffer-file-name) -4) ".org")) (local-set-key "\C-x\C-s" 'bth-export-save-then-publish))) (add-hook 'text-mode-hook 'bth-org-define-keys) ----->8----- Now I have multiple org-mode files and they don't all have the same structure. I've hardcoded the HTML export to level 2 in bth-export-save-then-publish but it would be much better to have the export honour the org-mode file option instead. I have the following at the top of my org files: #+TITLE: ToDo List #+OPTIONS: H:2 ^:nil f:nil author:nil toc:t I tried various things but if I change the H:2 to something else (H:3, etc) it always exports with level 2 in the table of contents when I save the file with C-x C-s. If I export manually with the C-c C-e h sequences then the #+OPTIONS: heading level is used. All of the other #+OPTIONS seem to work fine it's just the heading level from my (org-export-as-html 2) seems to override the file level setting. Is there an easy fix for this? I'm still a lisp novice. One other thing that would be handy is a way to skip tasks in the export. I'm not sure if anything like that exists yet or not. I normally have a * Timelog entry at the top of every org file which has the clock table format that is appropriate for that file. I really don't want that included in my export to HTML so it would be great if there was a way to say 'skip this heading and all sublevel headings' on export - maybe as a property or something. For now I've delete the Timelog tasks from the files I'm exporting to keep the time log tables off the published version. Thanks, Bernt