Browse Source

Merge branch 'master' of orgmode.org:org-mode

Bastien Guerry 12 years ago
parent
commit
6e1a39bd6e
1 changed files with 25 additions and 11 deletions
  1. 25 11
      lisp/ox-html.el

+ 25 - 11
lisp/ox-html.el

@@ -1421,12 +1421,22 @@ INFO is a plist used as a communication channel."
 (defun org-html--build-meta-info (info)
 (defun org-html--build-meta-info (info)
   "Return meta tags for exported document.
   "Return meta tags for exported document.
 INFO is a plist used as a communication channel."
 INFO is a plist used as a communication channel."
-  (let* ((title (org-export-data (plist-get info :title) info))
-	 (author (and (plist-get info :with-author)
-		      (let ((auth (plist-get info :author)))
-			(and auth (org-export-data auth info)))))
-	 (description (plist-get info :description))
-	 (keywords (plist-get info :keywords)))
+  (let ((protect-string
+	 (lambda (str)
+	   (replace-regexp-in-string
+	    "\"" """ (org-html-encode-plain-text str))))
+	(title (org-export-data (plist-get info :title) info))
+	(author (and (plist-get info :with-author)
+		     (let ((auth (plist-get info :author)))
+		       (and auth
+			    ;; Return raw Org syntax, skipping non
+			    ;; exportable objects.
+			    (org-element-interpret-data
+			     (org-element-map auth
+				 (cons 'plain-text org-element-all-objects)
+			       'identity info))))))
+	(description (plist-get info :description))
+	(keywords (plist-get info :keywords)))
     (concat
     (concat
      (format "<title>%s</title>\n" title)
      (format "<title>%s</title>\n" title)
      (format
      (format
@@ -1440,11 +1450,15 @@ INFO is a plist used as a communication channel."
 	       (coding-system-get org-html-coding-system 'mime-charset))
 	       (coding-system-get org-html-coding-system 'mime-charset))
 	  "iso-8859-1"))
 	  "iso-8859-1"))
      (format "<meta name=\"generator\" content=\"Org-mode\"/>\n")
      (format "<meta name=\"generator\" content=\"Org-mode\"/>\n")
-     (and author (format "<meta name=\"author\" content=\"%s\"/>\n" author))
-     (and description
-	  (format "<meta name=\"description\" content=\"%s\"/>\n" description))
-     (and keywords
-	  (format "<meta name=\"keywords\" content=\"%s\"/>\n" keywords)))))
+     (and (org-string-nw-p author)
+	  (format "<meta name=\"author\" content=\"%s\"/>\n"
+		  (funcall protect-string author)))
+     (and (org-string-nw-p description)
+	  (format "<meta name=\"description\" content=\"%s\"/>\n"
+		  (funcall protect-string description)))
+     (and (org-string-nw-p keywords)
+	  (format "<meta name=\"keywords\" content=\"%s\"/>\n"
+		  (funcall protect-string keywords))))))
 
 
 (defun org-html--build-head (info)
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
   "Return information for the <head>..</head> of the HTML output.