From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: New exporter problem with #+AUTHOR Date: Mon, 08 Apr 2013 09:01:17 +0200 Message-ID: <871ualwloi.fsf@gmail.com> References: <87zjxa3zal.fsf@norang.ca> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:34462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UP653-0006TZ-1d for emacs-orgmode@gnu.org; Mon, 08 Apr 2013 03:01:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UP64w-0006ib-S6 for emacs-orgmode@gnu.org; Mon, 08 Apr 2013 03:01:28 -0400 Received: from mail-wi0-x22b.google.com ([2a00:1450:400c:c05::22b]:61011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UP64w-0006iO-Du for emacs-orgmode@gnu.org; Mon, 08 Apr 2013 03:01:22 -0400 Received: by mail-wi0-f171.google.com with SMTP id hn17so2223403wib.10 for ; Mon, 08 Apr 2013 00:01:21 -0700 (PDT) In-Reply-To: <87zjxa3zal.fsf@norang.ca> (Bernt Hansen's message of "Sun, 07 Apr 2013 15:40:02 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bernt Hansen Cc: emacs-orgmode@gnu.org Hello, Bernt Hansen writes: > I have the following line in my org-mode document > > #+AUTHOR: Bernt Hansen (IRC:BerntH on freenode) > > On the old exporter this became > > > > I just tried exporting this with the new exporter and I get this > > BerntH > on freenode)"/> > > which isn't legal HTML. The quotes on the href="BerntH" close the > previous context= quote. > > Adding a space after IRC: seems to work > > Well, technically, irc:BerntH is a plain link, like http://orgmode.org, since irc: is a valid protocol. That may bite you in other parts of the document. Of course, the anchor shouldn't appear in the attribute. I'll have a look at it. Thanks for reporting it. Regards, -- Nicolas Goaziou From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: New exporter problem with #+AUTHOR Date: Sun, 07 Apr 2013 15:40:02 -0400 Message-ID: <87zjxa3zal.fsf@norang.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([208.118.235.92]:41734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UOvRe-0000H5-Pe for emacs-orgmode@gnu.org; Sun, 07 Apr 2013 15:40:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UOvRd-0002HS-Oi for emacs-orgmode@gnu.org; Sun, 07 Apr 2013 15:40:06 -0400 Received: from mho-03-ewr.mailhop.org ([204.13.248.66]:47641 helo=mho-01-ewr.mailhop.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UOvRd-0002H0-Lt for emacs-orgmode@gnu.org; Sun, 07 Apr 2013 15:40:05 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou Cc: emacs-orgmode@gnu.org Hi Nicolas, I have the following line in my org-mode document #+AUTHOR: Bernt Hansen (IRC:BerntH on freenode) On the old exporter this became I just tried exporting this with the new exporter and I get this BerntH on freenode)"/> which isn't legal HTML. The quotes on the href="BerntH" close the previous context= quote. Adding a space after IRC: seems to work Regards, Bernt From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: New exporter problem with #+AUTHOR Date: Mon, 08 Apr 2013 21:27:28 +0200 Message-ID: <87mwt8yg9r.fsf@bzg.ath.cx> References: <87zjxa3zal.fsf@norang.ca> <871ualwloi.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:42898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPHj1-0000nw-JK for emacs-orgmode@gnu.org; Mon, 08 Apr 2013 15:27:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPHj0-00010n-LD for emacs-orgmode@gnu.org; Mon, 08 Apr 2013 15:27:31 -0400 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]:37483) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPHj0-00010f-Eh for emacs-orgmode@gnu.org; Mon, 08 Apr 2013 15:27:30 -0400 Received: by mail-wi0-f170.google.com with SMTP id hm11so4226097wib.1 for ; Mon, 08 Apr 2013 12:27:29 -0700 (PDT) In-Reply-To: <871ualwloi.fsf@gmail.com> (Nicolas Goaziou's message of "Mon, 08 Apr 2013 09:01:17 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou Cc: Bernt Hansen , emacs-orgmode@gnu.org Hi Bernt, Nicolas Goaziou writes: > Well, technically, irc:BerntH is a plain link, like http://orgmode.org, > since irc: is a valid protocol. That may bite you in other parts of the > document. As a workaround, you can also remove org-irc.el from `org-modules' so that irc:... is not recognized as a link protocol. HTH, -- Bastien From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: New exporter problem with #+AUTHOR Date: Mon, 08 Apr 2013 22:33:45 +0200 Message-ID: <8738v0vk2e.fsf@gmail.com> References: <87zjxa3zal.fsf@norang.ca> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:33676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPIlU-0001aw-RR for emacs-orgmode@gnu.org; Mon, 08 Apr 2013 16:34:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPIlD-0008RE-Ok for emacs-orgmode@gnu.org; Mon, 08 Apr 2013 16:34:08 -0400 Received: from mail-we0-x233.google.com ([2a00:1450:400c:c03::233]:56419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPIlD-0008Qm-DX for emacs-orgmode@gnu.org; Mon, 08 Apr 2013 16:33:51 -0400 Received: by mail-we0-f179.google.com with SMTP id p43so4842341wea.24 for ; Mon, 08 Apr 2013 13:33:50 -0700 (PDT) In-Reply-To: <87zjxa3zal.fsf@norang.ca> (Bernt Hansen's message of "Sun, 07 Apr 2013 15:40:02 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bernt Hansen Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hello, Bernt Hansen writes: > I have the following line in my org-mode document > > #+AUTHOR: Bernt Hansen (IRC:BerntH on freenode) > > On the old exporter this became > > > > I just tried exporting this with the new exporter and I get this > > BerntH > on freenode)"/> > > which isn't legal HTML. The quotes on the href="BerntH" close the > previous context= quote. Here is a suggested patch to fix export of data meant to appear as an attribute value. WDYT? Regards, -- Nicolas Goaziou --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-ox-html-Fix-invalid-syntax-in-html-attributes.patch >From 6d8c48145ffd00ce82f2f19d1fd223a6a1c13a15 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 8 Apr 2013 22:24:29 +0200 Subject: [PATCH] ox-html: Fix invalid syntax in html attributes * lisp/ox-html.el (org-html--export-attribute): New function. (org-html--build-meta-info): Use new function. --- lisp/ox-html.el | 62 ++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 9 deletions(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 39b0ec9..6b964da 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -1265,6 +1265,48 @@ ELEMENT is either a src block or an example block." (or (plist-get attr :height) (org-count-lines code)) code))) +(defun org-html--export-attribute (data info) + "Export DATA as a string suitable for an attribute value. + +DATA is an object, a secondary string or a string. INFO is +a plist used as a communication channel. + +To make output suitable as an attribute value, every markup is +removed and special characters, including quotes, are escaped." + (replace-regexp-in-string + "\"" """ + (org-export-data + (org-export-data-with-translations + data + (append + (mapcar + (lambda (type) + (cond ((eq type 'link) + (cons type + (lambda (link contents info) + (or (org-string-nw-p contents) + (org-element-property :raw-link link))))) + ((eq type 'subscript) + (cons type + (lambda (super contents info) (format "_%s" contents)))) + ((eq type 'superscript) + (cons type + (lambda (super contents info) (format "^%s" contents)))) + ((eq type 'plain-text) (cons type (lambda (text info) text))) + ((memq type '(code verbatim)) + (cons type (lambda (obj contents info) + (org-element-property :value obj)))) + ((memq type org-element-recursive-objects) + (cons type (lambda (obj contents info) contents))) + ((memq type '(export-snippet + footnote-reference latex-fragment line-break + statistics-cookie target)) + (cons type 'ignore)))) + org-element-all-objects) + (org-export-backend-translate-table 'html)) + info) + info))) + ;;;; Bibliography (defun org-html-bibliography () @@ -1423,12 +1465,13 @@ INFO is a plist used as a communication channel." (defun org-html--build-meta-info (info) "Return meta tags for exported document. 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 ((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-html--export-attribute auth info))))) + (description (org-html--export-attribute + (plist-get info :description) info)) + (keywords (org-html--export-attribute (plist-get info :keywords) info))) (concat (format "%s\n" title) (format @@ -1442,10 +1485,11 @@ INFO is a plist used as a communication channel." (coding-system-get org-html-coding-system 'mime-charset)) "iso-8859-1")) (format "\n") - (and author (format "\n" author)) - (and description + (and (org-string-nw-p author) + (format "\n" author)) + (and (org-string-nw-p description) (format "\n" description)) - (and keywords + (and (org-string-nw-p keywords) (format "\n" keywords))))) (defun org-html--build-head (info) -- 1.8.2.1 --=-=-=--