Code cleanup: always use 'backend instead of htmlp, latexp, etc.

This commit is contained in:
Bastien Guerry 2011-02-16 10:58:04 +01:00
parent 4db5a1edcf
commit d03d3575cb
4 changed files with 9 additions and 17 deletions

View File

@ -76,11 +76,6 @@
(require 'cl))
(require 'org)
(defvar htmlp)
(defvar latexp)
(defvar docbookp)
(defvar asciip)
(defun org-export-blocks-set (var value)
"Set the value of `org-export-blocks' and install fontification."
(set var value)
@ -247,7 +242,7 @@ passed to the ditaa utility as command line arguments."
"\n")))
(prog1
(cond
((or htmlp latexp docbookp)
((member backend '(html latex docbook))
(unless (file-exists-p out-file)
(mapc ;; remove old hashed versions of this file
(lambda (file)
@ -306,7 +301,7 @@ digraph data_relationships {
(out-file (concat (car out-file-parts) "_" hash "." (cdr out-file-parts))))
(prog1
(cond
((or htmlp latexp docbookp)
((member backend '(html latex docbook))
(unless (file-exists-p out-file)
(mapc ;; remove old hashed versions of this file
(lambda (file)
@ -338,7 +333,7 @@ other backends, it converts the comment into an EXAMPLE segment."
(let ((owner (if headers (car headers)))
(title (if (cdr headers) (mapconcat 'identity (cdr headers) " "))))
(cond
(htmlp ;; We are exporting to HTML
((eq backend 'html) ;; We are exporting to HTML
(concat "#+BEGIN_HTML\n"
"<div class=\"org-comment\""
(if owner (format " id=\"org-comment-%s\" " owner))

View File

@ -1033,8 +1033,7 @@ to export. It then creates a temporary buffer where it does its job.
The result is then again returned as a string, and the exporter works
on this string to produce the exported version."
(interactive)
(let* ((docbookp (eq (plist-get parameters :for-backend) 'docbook))
(backend (plist-get parameters :for-backend))
(let* ((backend (plist-get parameters :for-backend))
(archived-trees (plist-get parameters :archived-trees))
(inhibit-read-only t)
(drawers org-drawers)
@ -1610,7 +1609,7 @@ from the buffer."
(while formatters
(setq fmt (pop formatters))
;; Handle #+Backend: stuff
;; Handle #+backend: stuff
(goto-char (point-min))
(while (re-search-forward (concat "^\\([ \t]*\\)#\\+" (cadr fmt)
":[ \t]*\\(.*\\)") nil t)
@ -1620,7 +1619,7 @@ from the buffer."
(add-text-properties
(point-at-bol) (min (1+ (point-at-eol)) (point-max))
'(org-protected t))))
;; Delete #+attr_Backend: stuff of another backend. Those
;; Delete #+attr_backend: stuff of another backend. Those
;; matching the current backend will be taken care of by
;; `org-export-attach-captions-and-attributes'
(goto-char (point-min))
@ -1628,7 +1627,7 @@ from the buffer."
":[ \t]*\\(.*\\)") nil t)
(when (not (eq (car fmt) backend))
(delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))))
;; Handle #+begin_Backend and #+end_Backend stuff
;; Handle #+begin_backend and #+end_backend stuff
(goto-char (point-min))
(while (re-search-forward (concat "^[ \t]*#\\+" (caddr fmt) "\\>.*\n?")
nil t)

View File

@ -73,7 +73,6 @@
org-closed-string"\\)")
"Regexp matching special time planning keywords plus the time after it.")
(defvar latexp) ; dynamically scoped from org.el
(defvar re-quote) ; dynamically scoped from org.el
(defvar commentsp) ; dynamically scoped from org.el

View File

@ -45,12 +45,11 @@
by org-special-blocks. These blocks will presumably be
interpreted by other mechanisms.")
(defvar htmlp)
(defvar latexp)
(defvar backend)
(defun org-special-blocks-make-special-cookies ()
"Adds special cookies when #+begin_foo and #+end_foo tokens are
seen. This is run after a few special cases are taken care of."
(when (or htmlp latexp)
(when (or (eq backend 'html) (eq backend 'latex))
(goto-char (point-min))
(while (re-search-forward "^[ \t]*#\\+\\(begin\\|end\\)_\\(.*\\)$" nil t)
(unless (org-string-match-p org-special-blocks-ignore-regexp (match-string 2))