From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arun Isaac Subject: Re: [PATCH] Prevent org-rss-headline dropping lower level headlines Date: Thu, 12 May 2016 09:36:09 +0530 Message-ID: <87futnapji.fsf@gmail.com> References: <87h9eyc7da.fsf@gmail.com> <8760un9uuq.fsf@gmail.com> <874ma7ylk2.fsf@saiph.selenimh> <874ma5ahll.fsf@gmail.com> <87twi5k6ta.fsf@saiph.selenimh> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0hte-00005W-46 for emacs-orgmode@gnu.org; Thu, 12 May 2016 00:06:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b0htZ-0006Yz-R3 for emacs-orgmode@gnu.org; Thu, 12 May 2016 00:06:44 -0400 Received: from mail-pf0-x234.google.com ([2607:f8b0:400e:c00::234]:36794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0htZ-0006Yt-HJ for emacs-orgmode@gnu.org; Thu, 12 May 2016 00:06:41 -0400 Received: by mail-pf0-x234.google.com with SMTP id c189so27011105pfb.3 for ; Wed, 11 May 2016 21:06:41 -0700 (PDT) Received: from steel ([223.227.25.173]) by smtp.gmail.com with ESMTPSA id nz6sm15674399pab.39.2016.05.11.21.06.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 May 2016 21:06:39 -0700 (PDT) In-reply-to: <87twi5k6ta.fsf@saiph.selenimh> 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 orgmode --=-=-= Content-Type: text/plain > I mean that the HTML back-end adds data that may not be useful for the > RSS back-end. Yes, things like the
tags are not useful. But, technically, they aren't wrong either. And, the alternative is to modify ox-rss so it depends less on ox-html. That is a bigger modification, not within the scope of this patch, I think. > My remark about `org-export-data-with-backend' is orthogonal to the > output of the function. It is usually better because it doesn't depend > on the name of the translators in HTML back-end. I have made this modification. > Could you send an updated patch? Thank you. Please find attached an updated patch. Thank you. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=ox-rss-Prevent-dropping-lower-level-headlines.patch >From a8fd0b0f4eca51a38a432ad942b695b9e565d4fe Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 12 May 2016 09:21:18 +0530 Subject: [PATCH] ox-rss: Prevent dropping lower level headlines * contrib/lisp/ox-rss.el (org-rss-headline): Transcode lower level headlines (headlines with level > 1) using the html backend. Do not drop them. Previously, lower level headlines were dropped and did not appear in the exported RSS output. --- contrib/lisp/ox-rss.el | 106 ++++++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/contrib/lisp/ox-rss.el b/contrib/lisp/ox-rss.el index 39fce30..0c4a2f2 100644 --- a/contrib/lisp/ox-rss.el +++ b/contrib/lisp/ox-rss.el @@ -228,59 +228,59 @@ Return output file name." "Transcode HEADLINE element into RSS format. CONTENTS is the headline contents. INFO is a plist used as a communication channel." - (unless (or (org-element-property :footnote-section-p headline) - ;; Only consider first-level headlines - (> (org-export-get-relative-level headline info) 1)) - (let* ((author (and (plist-get info :with-author) - (let ((auth (plist-get info :author))) - (and auth (org-export-data auth info))))) - (htmlext (plist-get info :html-extension)) - (hl-number (org-export-get-headline-number headline info)) - (hl-home (file-name-as-directory (plist-get info :html-link-home))) - (hl-pdir (plist-get info :publishing-directory)) - (hl-perm (org-element-property :RSS_PERMALINK headline)) - (anchor (org-export-get-reference headline info)) - (category (org-rss-plain-text - (or (org-element-property :CATEGORY headline) "") info)) - (pubdate0 (org-element-property :PUBDATE headline)) - (pubdate (let ((system-time-locale "C")) - (if pubdate0 - (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)))) - (publink - (or (and hl-perm (concat (or hl-home hl-pdir) hl-perm)) - (concat - (or hl-home hl-pdir) - (file-name-nondirectory - (file-name-sans-extension - (plist-get info :input-file))) "." htmlext "#" anchor))) - (guid (if org-rss-use-entry-url-as-guid - publink - (org-rss-plain-text - (or (org-element-property :ID headline) - (org-element-property :CUSTOM_ID headline) - publink) - info)))) - (if (not pubdate0) "" ;; Skip entries with no PUBDATE prop - (format - (concat - "\n" - "%s\n" - "%s\n" - "%s\n" - "%s\n" - "%s\n" - (org-rss-build-categories headline info) "\n" - "\n" - "\n") - title publink author guid pubdate contents))))) + (if (> (org-export-get-relative-level headline info) 1) + (org-export-data-with-backend headline 'html info) + (unless (org-element-property :footnote-section-p headline) + (let* ((author (and (plist-get info :with-author) + (let ((auth (plist-get info :author))) + (and auth (org-export-data auth info))))) + (htmlext (plist-get info :html-extension)) + (hl-number (org-export-get-headline-number headline info)) + (hl-home (file-name-as-directory (plist-get info :html-link-home))) + (hl-pdir (plist-get info :publishing-directory)) + (hl-perm (org-element-property :RSS_PERMALINK headline)) + (anchor (org-export-get-reference headline info)) + (category (org-rss-plain-text + (or (org-element-property :CATEGORY headline) "") info)) + (pubdate0 (org-element-property :PUBDATE headline)) + (pubdate (let ((system-time-locale "C")) + (if pubdate0 + (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)))) + (publink + (or (and hl-perm (concat (or hl-home hl-pdir) hl-perm)) + (concat + (or hl-home hl-pdir) + (file-name-nondirectory + (file-name-sans-extension + (plist-get info :input-file))) "." htmlext "#" anchor))) + (guid (if org-rss-use-entry-url-as-guid + publink + (org-rss-plain-text + (or (org-element-property :ID headline) + (org-element-property :CUSTOM_ID headline) + publink) + info)))) + (if (not pubdate0) "" ;; Skip entries with no PUBDATE prop + (format + (concat + "\n" + "%s\n" + "%s\n" + "%s\n" + "%s\n" + "%s\n" + (org-rss-build-categories headline info) "\n" + "\n" + "\n") + title publink author guid pubdate contents)))))) (defun org-rss-build-categories (headline info) "Build categories for the RSS item." -- 2.8.2 --=-=-=--