From: Bernt Hansen <bernt@norang.ca>
To: emacs-orgmode@gnu.org
Subject: HTML export and heading levels
Date: Tue, 15 Jan 2008 21:05:26 -0500 [thread overview]
Message-ID: <87wsqaplsp.fsf@gollum.intra.norang.ca> (raw)
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
next reply other threads:[~2008-01-16 2:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-16 2:05 Bernt Hansen [this message]
2008-01-16 2:42 ` HTML export and heading levels Bastien
2008-01-16 5:06 ` Bernt Hansen
2008-01-17 13:49 ` Bernt Hansen
2008-01-17 15:02 ` William Henney
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=87wsqaplsp.fsf@gollum.intra.norang.ca \
--to=bernt@norang.ca \
--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).