" . "\n
")
+ (concat
+ (org-lparse-format '("\n" . "
") img)
+ (org-lparse-format '("\n" . "
") caption))
+ extra)))
+ (buffer-string))
+ img))))
+
+(defun org-export-e-html-get-bibliography ()
+ "Find bibliography, cut it out and return it."
+ (catch 'exit
+ (let (beg end (cnt 1) bib)
+ (save-excursion
+ (goto-char (point-min))
+ (when (re-search-forward "^[ \t]*" nil t)
+ (setq cnt (+ cnt (if (string= (match-string 0) "
") (forward-char 1))
+ (setq bib (buffer-substring beg (point)))
+ (delete-region beg (point))
+ (throw 'exit bib))))
+ nil))))
+
+(defmacro with-org-lparse-backend (backend &rest body)
+ `(let* ((org-lparse-backend ,backend)
+ (org-lparse-entity-control-callbacks-alist
+ (org-lparse-get 'ENTITY-CONTROL))
+ (org-lparse-entity-format-callbacks-alist
+ (org-lparse-get 'ENTITY-FORMAT)))
+ ,@body))
+
+(defun org-e-html-format-table (lines olines)
+ (let ((org-e-html-format-table-no-css nil))
+ (org-lparse-format-table lines olines)))
+
+;; Following variable is defined for native tables i.e., when
+;; `org-lparse-table-is-styled' evals to t.
+(defvar org-e-html-format-table-no-css)
+(defvar org-table-number-regexp) ; defined in org-table.el
+
+(defun org-format-table-html (lines olines &optional no-css)
+ "Find out which HTML converter to use and return the HTML code.
+NO-CSS is passed to the exporter."
+ (with-org-lparse-backend
+ 'html (let* ((org-e-html-format-table-no-css no-css))
+ (org-lparse-format-table lines olines))))
+
+(defun org-format-org-table-html (lines &optional splice no-css)
+ (with-org-lparse-backend
+ 'html (let* ((org-e-html-format-table-no-css no-css))
+ (org-lparse-format-org-table lines splice))))
+
+(defun org-export-splice-attributes (tag attributes)
+ "Read attributes in string ATTRIBUTES, add and replace in HTML tag TAG."
+ (if (not attributes)
+ tag
+ (let (oldatt newatt)
+ (setq oldatt (org-extract-attributes-from-string tag)
+ tag (pop oldatt)
+ newatt (cdr (org-extract-attributes-from-string attributes)))
+ (while newatt
+ (setq oldatt (plist-put oldatt (pop newatt) (pop newatt))))
+ (if (string-match ">" tag)
+ (setq tag
+ (replace-match (concat (org-attributes-to-string oldatt) ">")
+ t t tag)))
+ tag)))
+
+(defun org-format-table-table-html (lines)
+ (with-org-lparse-backend
+ 'html (org-lparse-format-table-table lines)))
+
+(defun org-export-splice-style (style extra)
+ "Splice EXTRA into STYLE, just before \"\"."
+ (if (and (stringp extra)
+ (string-match "\\S-" extra)
+ (string-match "" style))
+ (concat (substring style 0 (match-beginning 0))
+ "\n" extra "\n"
+ (substring style (match-beginning 0)))
+ style))
+
+(defvar htmlize-buffer-places) ; from htmlize.el
+(defun org-export-e-htmlize-region-for-paste (beg end)
+ "Convert the region to HTML, using htmlize.el.
+This is much like `htmlize-region-for-paste', only that it uses
+the settings define in the org-... variables."
+ (let* ((htmlize-output-type org-export-e-htmlize-output-type)
+ (htmlize-css-name-prefix org-export-e-htmlize-css-font-prefix)
+ (htmlbuf (htmlize-region beg end)))
+ (unwind-protect
+ (with-current-buffer htmlbuf
+ (buffer-substring (plist-get htmlize-buffer-places 'content-start)
+ (plist-get htmlize-buffer-places 'content-end)))
+ (kill-buffer htmlbuf))))
+
+;;;###autoload
+(defun org-export-e-htmlize-generate-css ()
+ "Create the CSS for all font definitions in the current Emacs session.
+Use this to create face definitions in your CSS style file that can then
+be used by code snippets transformed by htmlize.
+This command just produces a buffer that contains class definitions for all
+faces used in the current Emacs session. You can copy and paste the ones you
+need into your CSS file.
+
+If you then set `org-export-e-htmlize-output-type' to `css', calls to
+the function `org-export-e-htmlize-region-for-paste' will produce code
+that uses these same face definitions."
+ (interactive)
+ (require 'htmlize)
+ (and (get-buffer "*html*") (kill-buffer "*html*"))
+ (with-temp-buffer
+ (let ((fl (face-list))
+ (htmlize-css-name-prefix "org-")
+ (htmlize-output-type 'css)
+ f i)
+ (while (setq f (pop fl)
+ i (and f (face-attribute f :inherit)))
+ (when (and (symbolp f) (or (not i) (not (listp i))))
+ (insert (org-add-props (copy-sequence "1") nil 'face f))))
+ (htmlize-region (point-min) (point-max))))
+ (org-pop-to-buffer-same-window "*html*")
+ (goto-char (point-min))
+ (if (re-search-forward "