;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org
-;; Version: 6.29c
+;; Version: 6.33x
;;
;; This file is part of GNU Emacs.
;;
;;; Commentary:
(require 'org-exp)
+(eval-when-compile (require 'cl))
(declare-function org-id-find-id-file "org-id" (id))
(declare-function htmlize-region "ext:htmlize" (beg end))
:type 'string)
(defcustom org-export-html-home/up-format
- "<div style=\"text-align:right;font-size:70%%;white-space:nowrap;\">
+ "<div id=\"org-div-home-and-up\" style=\"text-align:right;font-size:70%%;white-space:nowrap;\">
<a accesskey=\"h\" href=\"%s\"> UP </a>
|
<a accesskey=\"H\" href=\"%s\"> HOME </a>
(defvar org-export-html-after-blockquotes-hook nil
"Hook run during HTML export, after blockquote, verse, center are done.")
+(defvar org-export-html-final-hook nil
+ "Hook run during HTML export, after blockquote, verse, center are done.")
+
;;; HTML export
(defun org-export-html-preprocess (parameters)
(setq buffer "*Org HTML Export*"))
(let ((transient-mark-mode t) (zmacs-regions t)
ext-plist rtn)
- (setq ext-plist (plist-put ext-plist :ignore-subree-p t))
+ (setq ext-plist (plist-put ext-plist :ignore-subtree-p t))
(goto-char end)
(set-mark (point)) ;; to activate the region
(goto-char beg)
(org-set-local 'buffer-file-name
(with-current-buffer (buffer-base-buffer)
buffer-file-name))
- (error "Need a file name to be able to export.")))
+ (error "Need a file name to be able to export")))
(message "Exporting...")
(setq-default org-todo-line-regexp org-todo-line-regexp)
(rbeg (and region-p (region-beginning)))
(rend (and region-p (region-end)))
(subtree-p
- (if (plist-get opt-plist :ignore-subree-p)
+ (if (plist-get opt-plist :ignore-subtree-p)
nil
(when region-p
(save-excursion
<html xmlns=\"http://www.w3.org/1999/xhtml\"
lang=\"%s\" xml:lang=\"%s\">
<head>
-%s
<title>%s</title>
<meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"/>
<meta name=\"generator\" content=\"Org-mode\"/>
</head>
<body>
<div id=\"content\">
+%s
"
(format
(or (and (stringp org-export-html-xml-declaration)
"")
(or charset "iso-8859-1"))
language language
+ (org-html-expand title)
+ (or charset "iso-8859-1")
+ date author description keywords
+ style
(if (or link-up link-home)
(concat
(format org-export-html-home/up-format
(or link-up link-home)
(or link-home link-up))
"\n")
- "")
- (org-html-expand title)
- (or charset "iso-8859-1")
- date author description keywords
- style))
+ "")))
(org-export-html-insert-plist-item opt-plist :preamble opt-plist)
(setq line (concat line "\\\\")))))
;; make targets to anchors
+ (setq start 0)
(while (string-match
- "<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line)
+ "<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line start)
(cond
+ ((get-text-property (match-beginning 1) 'org-protected line)
+ (setq start (match-end 1)))
((match-end 2)
(setq line (replace-match
(format
((and org-export-with-toc (equal (string-to-char line) ?*))
;; FIXME: NOT DEPENDENT on TOC?????????????????????
(setq line (replace-match
- (concat "@<span class=\"target\">" (match-string 1 line) "@</span> ")
-; (concat "@<i>" (match-string 1 line) "@</i> ")
+ (concat "@<span class=\"target\">"
+ (match-string 1 line) "@</span> ")
+ ;; (concat "@<i>" (match-string 1 line) "@</i> ")
t t line)))
(t
(setq line (replace-match
(concat "@<a name=\""
(org-solidify-link-text (match-string 1 line))
- "\" class=\"target\">" (match-string 1 line) "@</a> ")
+ "\" class=\"target\">" (match-string 1 line)
+ "@</a> ")
t t line)))))
-
+
(setq line (org-html-handle-time-stamps line))
;; replace "&" by "&", "<" and ">" by "<" and ">"
;; Does this contain a reference to a footnote?
(when org-export-with-footnotes
(setq start 0)
- (while (string-match "\\([^* \t].*\\)?\\[\\([0-9]+\\)\\]" line start)
+ (while (string-match "\\([^* \t].*?\\)\\[\\([0-9]+\\)\\]" line start)
(if (get-text-property (match-beginning 2) 'org-protected line)
(setq start (match-end 2))
(let ((n (match-string 2 line)) extra a)
(setq line
(replace-match
(format
- (concat (if (match-string 1 line) "%s" "")
+ (concat "%s"
(format org-export-html-footnote-format
"<a class=\"footref\" name=\"fnr.%s%s\" href=\"#fn.%s\">%s</a>"))
- (match-string 1 line) n extra n n)
+ (or (match-string 1 line) "") n extra n n)
t t line))))))
(cond
(let ((n (match-string 1 line)))
(setq org-par-open t
line (replace-match
- (concat "<p class=\"footnote\">"
- (format org-export-html-footnote-format
- "<a class=\"footnum\" name=\"fn.%s\" href=\"#fnr.%s\">%s</a>"
- n n n) t t line))))))
+ (format
+ (concat "<p class=\"footnote\">"
+ (format org-export-html-footnote-format
+ "<a class=\"footnum\" name=\"fn.%s\" href=\"#fnr.%s\">%s</a>"))
+ n n n) t t line)))))
;; Check if the line break needs to be conserved
(cond
((string-match "\\\\\\\\[ \t]*$" line)
(unless (plist-get opt-plist :buffer-will-be-killed)
(normal-mode)
- (if (eq major-mode (default-value 'major-mode)) (html-mode)))
+ (if (eq major-mode (default-value 'major-mode))
+ (html-mode)))
;; insert the table of contents
(goto-char (point-min))
(delete-region beg end)
(insert (format "<span style=\"visibility:hidden;\">%s</span>"
(make-string n ?x)))))
+ (run-hooks 'org-export-html-final-hook)
(or to-buffer (save-buffer))
(goto-char (point-min))
(or (org-export-push-to-kill-ring "HTML")
(let* ((caption (org-find-text-property-in-string 'org-caption src))
(attr (org-find-text-property-in-string 'org-attributes src))
(label (org-find-text-property-in-string 'org-label src)))
- (format "%s<div %sclass=\"figure\">
-<p><img src=\"%s\"%s /></p>%s
-</div>%s"
- (if org-par-open "</p>\n" "")
- (if label (format "id=\"%s\" " label) "")
+ (concat
+ (if caption
+ (format "%s<div %sclass=\"figure\">
+<p>"
+ (if org-par-open "</p>\n" "")
+ (if label (format "id=\"%s\" " label) "")))
+ (format "<img src=\"%s\"%s />"
src
(if (string-match "\\<alt=" (or attr ""))
(concat " " attr )
- (concat " " attr " alt=\"" src "\""))
- (if caption (concat "\n<p>" caption "</p>") "")
- (if org-par-open "\n<p>" ""))))))
+ (concat " " attr " alt=\"" src "\"")))
+ (if caption
+ (format "</p>%s
+</div>%s"
+ (concat "\n<p>" caption "</p>")
+ (if org-par-open "\n<p>" ""))))))))
(defun org-export-html-get-bibliography ()
"Find bibliography, cut it out and return it."
(unless splice (push "</table>\n" html))
(setq html (nreverse html))
(unless splice
- ;; Put in col tags with the alignment (unfortuntely often ignored...)
+ ;; Put in col tags with the alignment (unfortunately often ignored...)
(unless (car org-table-colgroup-info)
(setq org-table-colgroup-info
(cons :start (cdr org-table-colgroup-info))))
(push (mapconcat
(lambda (x)
(setq gr (pop org-table-colgroup-info))
- (format "%s<col align=\"%s\"></col>%s"
+ (format "%s<col align=\"%s\" />%s"
(if (memq gr '(:start :startend))
(prog1
(if colgropen "</colgroup>\n<colgroup>" "<colgroup>")
(setq start (+ start (length wd))))))))
s)
-(defconst org-export-html-special-string-regexps
- '(("\\\\-" . "­")
- ("---\\([^-]\\)" . "—\\1")
- ("--\\([^-]\\)" . "–\\1")
- ("\\.\\.\\." . "…"))
- "Regular expressions for special string conversion.")
-
(defun org-export-html-convert-special-strings (string)
"Convert special characters in STRING to HTML."
(let ((all org-export-html-special-string-regexps)