" . "\n
")
(concat
(org-lparse-format '("\n" . "
") img)
(org-lparse-format '("\n" . "
") caption))
extra)))
(buffer-string))
img))))
(defun org-export-xhtml-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))))
(defun org-xhtml-format-table (lines olines)
(let ((org-xhtml-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-xhtml-format-table-no-css)
(defvar org-table-number-regexp) ; defined in org-table.el
;; FIXME: This function is called from other modules. Use xhtml suffix
;; to avoid conflict
(defun org-format-table-xhtml (lines olines &optional no-css)
"Find out which HTML converter to use and return the HTML code.
NO-CSS is passed to the exporter."
(let* ((org-lparse-backend 'xhtml)
(org-lparse-entity-control-callbacks-alist
(org-lparse-get 'ENTITY-CONTROL))
(org-lparse-entity-format-callbacks-alist
(org-lparse-get 'ENTITY-FORMAT))
(org-xhtml-format-table-no-css no-css))
(org-lparse-format-table lines olines)))
;; FIXME: This function is called from other modules. Use xhtml suffix
;; to avoid conflict
(defun org-format-org-table-xhtml (lines &optional splice no-css)
;; This routine might get called outside of org-export-as-html. For
;; example, this could happen as part of org-table-export or as part
;; of org-export-as-docbook. Explicitly bind the parser callback to
;; the html ones for the duration of the call.
(let* ((org-lparse-backend 'xhtml)
(org-lparse-entity-control-callbacks-alist
(org-lparse-get 'ENTITY-CONTROL))
(org-lparse-entity-format-callbacks-alist
(org-lparse-get 'ENTITY-FORMAT))
(org-xhtml-format-table-no-css no-css))
(org-lparse-format-org-table lines splice)))
;; FIXME: it already exists in org-html.el
(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)))
;; FIXME: This function is called from other modules. Use xhtml suffix
;; to avoid conflict
(defun org-format-table-table-xhtml (lines)
(let* ((org-lparse-get 'html)
(org-lparse-entity-control-callbacks-alist
(org-lparse-get 'ENTITY-CONTROL))
(org-lparse-entity-format-callbacks-alist
(org-lparse-get 'ENTITY-FORMAT)))
(org-lparse-format-table-table lines)))
;; FIXME: it already exists in org-html.el
(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-xhtmlize-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-xhtmlize-output-type)
(htmlize-css-name-prefix org-export-xhtmlize-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-xhtmlize-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-xhtmlize-output-type' to `css', calls to
the function `org-export-xhtmlize-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 "