summaryrefslogtreecommitdiff
path: root/lisp/ox-html.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/ox-html.el')
-rw-r--r--lisp/ox-html.el84
1 files changed, 41 insertions, 43 deletions
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 63a8c84..9c0ba65 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1,6 +1,6 @@
;;; ox-html.el --- HTML Back-End for Org Export Engine -*- lexical-binding: t; -*-
-;; Copyright (C) 2011-2016 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2017 Free Software Foundation, Inc.
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Jambunathan K <kjambunathan at gmail dot com>
@@ -229,7 +229,7 @@ property on the headline itself.")
@licstart The following is the entire license notice for the
JavaScript code in this tag.
-Copyright (C) 2012-2013 Free Software Foundation, Inc.
+Copyright (C) 2012-2017 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
@@ -768,7 +768,7 @@ INFO the export options (plist).
The function result will be used in the section format string."
:group 'org-export-html
- :version "25.2"
+ :version "26.1"
:package-version '(Org . "8.3")
:type 'function)
@@ -800,7 +800,7 @@ The function must accept seven parameters:
The function should return the string to be exported."
:group 'org-export-html
- :version "25.2"
+ :version "26.1"
:package-version '(Org . "8.3")
:type 'function)
@@ -1153,7 +1153,7 @@ See `format-time-string' for more information on its components."
;;;; Template :: Mathjax
(defcustom org-html-mathjax-options
- '((path "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" )
+ '((path "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML" )
(scale "100")
(align "center")
(font "TeX")
@@ -1191,12 +1191,7 @@ You can also customize this for each buffer, using something like
For further information about MathJax options, see the MathJax documentation:
- http://docs.mathjax.org/
-
-Please note that by using the default CDN one must agree with
-MathJax CDN Terms of Service.
-
- http://www.mathjax.org/mathjax-cdn-terms-of-service.html"
+ http://docs.mathjax.org/"
:group 'org-export-html
:package-version '(Org . "8.3")
:type '(list :greedy t
@@ -1511,7 +1506,7 @@ The viewport meta tag is inserted if this variable is non-nil.
See the following site for a reference:
https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag"
:group 'org-export-html
- :version "25.2"
+ :version "26.1"
:package-version '(Org . "8.3")
:type '(choice (const :tag "Disable" nil)
(list :tag "Enable"
@@ -1566,21 +1561,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))
@@ -1596,12 +1596,12 @@ INFO is a plist used as a communication channel. When optional
arguments CAPTION and LABEL are given, use them for caption and
\"id\" attribute."
(let ((html5-fancy (org-html--html5-fancy-p info)))
- (format (if html5-fancy "\n<figure%s>%s%s\n</figure>"
- "\n<div%s class=\"figure\">%s%s\n</div>")
+ (format (if html5-fancy "\n<figure%s>\n%s%s\n</figure>"
+ "\n<div%s class=\"figure\">\n%s%s\n</div>")
;; ID.
(if (org-string-nw-p label) (format " id=\"%s\"" label) "")
;; Contents.
- (format "\n<p>%s</p>" contents)
+ (if html5-fancy contents (format "<p>%s</p>" contents))
;; Caption.
(if (not (org-string-nw-p caption)) ""
(format (if html5-fancy "\n<figcaption>%s</figcaption>"
@@ -2624,12 +2624,14 @@ CONTENTS is nil. INFO is a plist holding contextual information."
"Transcode an INLINE-SRC-BLOCK element from Org to HTML.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
- (let ((lang (org-element-property :language inline-src-block))
- (code (org-element-property :value inline-src-block))
- (label
- (let ((lbl (and (org-element-property :name inline-src-block)
- (org-export-get-reference inline-src-block info))))
- (if (not lbl) "" (format " id=\"%s\"" lbl)))))
+ (let* ((lang (org-element-property :language inline-src-block))
+ (code (org-html-fontify-code
+ (org-element-property :value inline-src-block)
+ lang))
+ (label
+ (let ((lbl (and (org-element-property :name inline-src-block)
+ (org-export-get-reference inline-src-block info))))
+ (if (not lbl) "" (format " id=\"%s\"" lbl)))))
(format "<code class=\"src src-%s\"%s>%s</code>" lang label code)))
;;;; Inlinetask
@@ -3047,7 +3049,7 @@ INFO is a plist holding contextual information. See
;; equivalent line number.
((string= type "coderef")
(let ((fragment (concat "coderef-" (org-html-encode-plain-text path))))
- (format "<a href=\"#%s\"%s%s>%s</a>"
+ (format "<a href=\"#%s\" %s%s>%s</a>"
fragment
(format "class=\"coderef\" onmouseover=\"CodeHighlightOn(this, \
'%s');\" onmouseout=\"CodeHighlightOff(this, '%s');\""
@@ -3587,20 +3589,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 "&#xa0;")))
- (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) "&#xa0;"))
+ ;; 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]*\n" (regexp-quote br))))
+ (replace-regexp-in-string re (concat br "\n") contents)))))
;;; Filter Functions