ox-*: single-armed “if” -> “when”

* lisp/ox-html.el (org-html-htmlize-generate-css):
(org-html-template, org-html-final-function):
* lisp/ox-publish.el (org-publish-cache-set-file-property):
* lisp/ox-texinfo.el (org-texinfo-quote-block): Transform ‘if’ with no
else to ‘when’.
This commit is contained in:
Aaron Ecay 2018-05-10 01:17:12 +01:00
parent ccfe51d83c
commit 673165c035
3 changed files with 16 additions and 16 deletions

View File

@ -1764,12 +1764,12 @@ produce code that uses these same face definitions."
(htmlize-region (point-min) (point-max))))
(pop-to-buffer-same-window "*html*")
(goto-char (point-min))
(if (re-search-forward "<style" nil t)
(delete-region (point-min) (match-beginning 0)))
(if (re-search-forward "</style>" nil t)
(delete-region (1+ (match-end 0)) (point-max)))
(when (re-search-forward "<style" nil t)
(delete-region (point-min) (match-beginning 0)))
(when (re-search-forward "</style>" nil t)
(delete-region (1+ (match-end 0)) (point-max)))
(beginning-of-line 1)
(if (looking-at " +") (replace-match ""))
(when (looking-at " +") (replace-match ""))
(goto-char (point-min)))
(defun org-html--make-string (n string)
@ -2097,12 +2097,12 @@ holding export options."
;; Postamble.
(org-html--build-pre/postamble 'postamble info)
;; Possibly use the Klipse library live code blocks.
(if (plist-get info :html-klipsify-src)
(concat "<script>" (plist-get info :html-klipse-selection-script)
"</script><script src=\""
org-html-klipse-js
"\"></script><link rel=\"stylesheet\" type=\"text/css\" href=\""
org-html-klipse-css "\"/>"))
(when (plist-get info :html-klipsify-src)
(concat "<script>" (plist-get info :html-klipse-selection-script)
"</script><script src=\""
org-html-klipse-js
"\"></script><link rel=\"stylesheet\" type=\"text/css\" href=\""
org-html-klipse-css "\"/>"))
;; Closing document.
"</body>\n</html>"))
@ -3716,8 +3716,8 @@ contextual information."
(with-temp-buffer
(insert contents)
(set-auto-mode t)
(if (plist-get info :html-indent)
(indent-region (point-min) (point-max)))
(when (plist-get info :html-indent)
(indent-region (point-min) (point-max)))
(buffer-substring-no-properties (point-min) (point-max))))

View File

@ -1321,7 +1321,7 @@ the file including them will be republished as well."
Use cache file of PROJECT-NAME. If the entry does not exist, it
will be created. Return VALUE."
;; Evtl. load the requested cache file:
(if project-name (org-publish-initialize-cache project-name))
(when project-name (org-publish-initialize-cache project-name))
(let ((pl (org-publish-cache-get filename)))
(if pl (progn (plist-put pl property value) value)
(org-publish-cache-get-file-property

View File

@ -1342,8 +1342,8 @@ CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
(let* ((title (org-element-property :name quote-block))
(start-quote (concat "@quotation"
(if title
(format " %s" title)))))
(when title
(format " %s" title)))))
(format "%s\n%s@end quotation" start-quote contents)))
;;;; Radio Target