emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tftorrey@tftorrey.com (T.F. Torrey)
To: emacs-orgmode@gnu.org
Subject: [PATCH] Works around bug in exporting subtree with HTML_CONTAINER_CLASS
Date: Sat, 01 Sep 2012 03:31:06 -0700	[thread overview]
Message-ID: <87sjb2f311.fsf@lapcat.tftorrey.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1010 bytes --]

Hello all,

When exporting a subtree with an HTML_CONTAINER_CLASS property set,
exporting fails with this error: (error "Before first headline at
position 455 in buffer *temp*") This happens because the system is
trying to apply the class to the parent level, but the exporting of a
subtree doesn't bring the parent level into the temp buffer.

The attached patch modifies org-export-remember-html-container-classes
to ignore the HTML_CONTAINER_CLASS property altogether in these cases.
It would probably be better to apply the designated class to the
container div or perhaps the body, but this change works for me, and I
may be the only one bothered by this.

If it is determined that another fix is more in the spirit of these
files, I will not be offended.

ChangeLog entry: Fix export of subtree with HTML_CONTAINER_CLASS

Modify org-export-remember-html-container-classes to work around problem
when exporting subtree with HTML_CONTAINER_CLASS property.

TINYCHANGE

All the best,
Terry
-- 
T.F. Torrey


[-- Attachment #2: Patch for org-export-remember-html-container-classes --]
[-- Type: text/plain, Size: 569 bytes --]

diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index c901a88..875bdf8 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -1476,8 +1476,11 @@ the current file."
 	    "^[ \t]*:HTML_CONTAINER_CLASS:[ \t]+\\(.+\\)$" nil t)
       (setq class (match-string 1))
       (save-excursion
+	(if (re-search-backward "^\\*" (point-min) t)
+	    (progn
 	(org-back-to-heading t)
 	(put-text-property (point-at-bol) (point-at-eol) 'html-container-class class)))))
+))
 
 (defvar org-export-format-drawer-function nil
   "Function to be called to format the contents of a drawer.

             reply	other threads:[~2012-09-01 10:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-01 10:31 T.F. Torrey [this message]
2012-09-02 11:10 ` [PATCH] Works around bug in exporting subtree with HTML_CONTAINER_CLASS Bastien

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=87sjb2f311.fsf@lapcat.tftorrey.com \
    --to=tftorrey@tftorrey.com \
    --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).