|
@@ -1567,21 +1567,26 @@ INFO is the current state of the export process, as a plist."
|
|
|
(org-html-html5-p info)))
|
|
|
|
|
|
(defun org-html-close-tag (tag attr info)
|
|
|
- (concat "<" tag " " attr
|
|
|
+ "Return close-tag for string TAG.
|
|
|
+ATTR specifies additional attributes. INFO is a property list
|
|
|
+containing current export state."
|
|
|
+ (concat "<" tag
|
|
|
+ (org-string-nw-p (concat " " attr))
|
|
|
(if (org-html-xhtml-p info) " />" ">")))
|
|
|
|
|
|
(defun org-html-doctype (info)
|
|
|
- "Return correct html doctype tag from `org-html-doctype-alist',
|
|
|
-or the literal value of :html-doctype from INFO if :html-doctype
|
|
|
-is not found in the alist.
|
|
|
-INFO is a plist used as a communication channel."
|
|
|
+ "Return correct HTML doctype tag.
|
|
|
+INFO is a plist used as a communication channel. Doctype tag is
|
|
|
+extracted from `org-html-doctype-alist', or the literal value
|
|
|
+of :html-doctype from INFO if :html-doctype is not found in the
|
|
|
+alist."
|
|
|
(let ((dt (plist-get info :html-doctype)))
|
|
|
(or (cdr (assoc dt org-html-doctype-alist)) dt)))
|
|
|
|
|
|
(defun org-html--make-attribute-string (attributes)
|
|
|
"Return a list of attributes, as a string.
|
|
|
-ATTRIBUTES is a plist where values are either strings or nil. An
|
|
|
-attributes with a nil value will be omitted from the result."
|
|
|
+ATTRIBUTES is a plist where values are either strings or nil. An
|
|
|
+attribute with a nil value will be omitted from the result."
|
|
|
(let (output)
|
|
|
(dolist (item attributes (mapconcat 'identity (nreverse output) " "))
|
|
|
(cond ((null item) (pop output))
|
|
@@ -3591,20 +3596,16 @@ information."
|
|
|
"Transcode a VERSE-BLOCK element from Org to HTML.
|
|
|
CONTENTS is verse block contents. INFO is a plist holding
|
|
|
contextual information."
|
|
|
- ;; Replace each newline character with line break. Also replace
|
|
|
- ;; each blank line with a line break.
|
|
|
- (setq contents (replace-regexp-in-string
|
|
|
- "^ *\\\\\\\\$" (format "%s\n" (org-html-close-tag "br" nil info))
|
|
|
- (replace-regexp-in-string
|
|
|
- "\\(\\\\\\\\\\)?[ \t]*\n"
|
|
|
- (format "%s\n" (org-html-close-tag "br" nil info)) contents)))
|
|
|
- ;; Replace each white space at beginning of a line with a
|
|
|
- ;; non-breaking space.
|
|
|
- (while (string-match "^[ \t]+" contents)
|
|
|
- (let* ((num-ws (length (match-string 0 contents)))
|
|
|
- (ws (org-html--make-string num-ws " ")))
|
|
|
- (setq contents (replace-match ws nil t contents))))
|
|
|
- (format "<p class=\"verse\">\n%s</p>" contents))
|
|
|
+ (format "<p class=\"verse\">\n%s</p>"
|
|
|
+ ;; Replace leading white spaces with non-breaking spaces.
|
|
|
+ (replace-regexp-in-string
|
|
|
+ "^[ \t]+" (lambda (m) (org-html--make-string (length m) " "))
|
|
|
+ ;; Replace each newline character with line break. Also
|
|
|
+ ;; remove any trailing "br" close-tag so as to avoid
|
|
|
+ ;; duplicates.
|
|
|
+ (let* ((br (org-html-close-tag "br" nil info))
|
|
|
+ (re (format "\\(%s\\)[ \t]*$" (regexp-quote br))))
|
|
|
+ (replace-regexp-in-string re br contents)))))
|
|
|
|
|
|
|
|
|
;;; Filter Functions
|