From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arun Isaac Subject: Re: Bug: XML entities in the ox-rss exporter Date: Thu, 26 May 2016 17:35:42 +0530 Message-ID: <87zirdf2i1.fsf@gmail.com> References: <87r3d05w5f.fsf@gmail.com> <8737p79o8m.fsf@saiph.selenimh> <87fut6qwen.fsf@gmail.com> <87bn3trun4.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5u3Q-0006kQ-EW for emacs-orgmode@gnu.org; Thu, 26 May 2016 08:06:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5u3M-0003Kg-4L for emacs-orgmode@gnu.org; Thu, 26 May 2016 08:06:19 -0400 Received: from mail-pa0-x232.google.com ([2607:f8b0:400e:c03::232]:34212) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5u3L-0003KW-TF for emacs-orgmode@gnu.org; Thu, 26 May 2016 08:06:16 -0400 Received: by mail-pa0-x232.google.com with SMTP id qo8so29288334pab.1 for ; Thu, 26 May 2016 05:06:15 -0700 (PDT) Received: from steel ([223.227.129.83]) by smtp.gmail.com with ESMTPSA id to9sm20102070pab.27.2016.05.26.05.06.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 May 2016 05:06:13 -0700 (PDT) In-reply-to: <87bn3trun4.fsf@gmail.com> 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" To: emacs-org --=-=-= Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --==-=-= Content-Type: text/plain > I think my patch introduces a bug in `org-rss-build-channel-info'. I'll > fix this and send a new patch soon. I didn't realize (plist-get info :title) returns a list, and not a string. I have now fixed the bug. Please find attached a new patch. --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXRuaWAAoJEC4l7othgCuzIf8IAKEdwXtvVmIXCfgmSfAq7rFG I+2CM07iH7rG8SgyacNuqdPLZfgn4jmY2IOiR3Z0/Xz+EVZvUv9H8Z2mvvmwJVC6 891nDIKhyhRrg24HcuohSY3Q/JpjzT7SmbfX3ANw3HKYgXgoY45E3nbP+DJuzHST UzSXqPnZEJsk+4PvE4pulcQTwOAZjX9twIoK7Pvav+l2RJOndppLXw5GYkAWDkyc ZXVscTIcDAuiNamGg74lLzMSZVMvYM85S608z85agOko+kolZph1ExP/foE9q/rK BNHlDIlNza3IqEGL5XytGgAwcxsfAhporApO01yIFo0rgICdiOYFNFYXmSAbXW0= =agXr -----END PGP SIGNATURE----- --==-=-=-- --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=ox-rss-Encode-characters-to-their-XML-entities.patch >From 58c290c9308f07e44bf893331ccf9d9c5d255e04 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 26 May 2016 17:24:29 +0530 Subject: [PATCH] ox-rss: Encode characters to their XML entities * contrib/lisp/ox-rss.el (org-rss-build-channel-info, org-rss-headline): Encode disallowed characters in `title' to their XML entities The `title' field is user specified and may contain characters such as "&", "<" or ">" that are disallowed in XML. These characters should be encoded into their corresponding XML entities. --- contrib/lisp/ox-rss.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/contrib/lisp/ox-rss.el b/contrib/lisp/ox-rss.el index 0c4a2f2..44ee8db 100644 --- a/contrib/lisp/ox-rss.el +++ b/contrib/lisp/ox-rss.el @@ -248,12 +248,13 @@ communication channel." (format-time-string "%a, %d %b %Y %H:%M:%S %z" (org-time-string-to-time pubdate0))))) - (title (or (org-element-property :RSS_TITLE headline) - (replace-regexp-in-string - org-bracket-link-regexp - (lambda (m) (or (match-string 3 m) - (match-string 1 m))) - (org-element-property :raw-value headline)))) + (title (org-rss-plain-text + (or (org-element-property :RSS_TITLE headline) + (replace-regexp-in-string + org-bracket-link-regexp + (lambda (m) (or (match-string 3 m) + (match-string 1 m))) + (org-element-property :raw-value headline))) info)) (publink (or (and hl-perm (concat (or hl-home hl-pdir) hl-perm)) (concat @@ -318,7 +319,7 @@ as a communication channel." (defun org-rss-build-channel-info (info) "Build the RSS channel information." (let* ((system-time-locale "C") - (title (plist-get info :title)) + (title (org-export-data (plist-get info :title) info)) (email (org-export-data (plist-get info :email) info)) (author (and (plist-get info :with-author) (let ((auth (plist-get info :author))) -- 2.8.2 --=-=-=--