* [PATCH] Prevent org-rss-headline dropping lower level headlines
@ 2016-04-19 8:47 Arun Isaac
2016-05-09 14:19 ` Arun Isaac
0 siblings, 1 reply; 7+ messages in thread
From: Arun Isaac @ 2016-04-19 8:47 UTC (permalink / raw
To: Emacs orgmode
[-- Attachment #1.1: Type: text/plain, Size: 459 bytes --]
Hi,
Currently, the RSS exporter (org-rss-headline) drops lower level
headlines (headlines with level > 1), and therefore they do not appear
in the exported RSS. This is a bug.
For example, if the following file were exported to RSS, "Headline level
2" would not appear in the output.
===== file begins here =====
* Headline level 1
foo
** Headline level 2
bar
===== file end here =====
Please find attached a patch fixing this.
Regards,
Arun Isaac.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ox-rss-Prevent-dropping-lower-level-headlines.patch --]
[-- Type: text/x-diff, Size: 5355 bytes --]
From e000940d29b4bf5f63274e82f6a7341021000fd2 Mon Sep 17 00:00:00 2001
From: Arun Isaac <theroarofthedragon@gmail.com>
Date: Tue, 19 Apr 2016 13:53:50 +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) with org-html-headline. Do not
drop them.
Previously, lower level headlines were dropped and did not appear in the
exported RSS output.
---
| 106 ++++++++++++++++++++++++-------------------------
1 file changed, 53 insertions(+), 53 deletions(-)
--git a/contrib/lisp/ox-rss.el b/contrib/lisp/ox-rss.el
index 39fce30..eba461d 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
- "<item>\n"
- "<title>%s</title>\n"
- "<link>%s</link>\n"
- "<author>%s</author>\n"
- "<guid isPermaLink=\"false\">%s</guid>\n"
- "<pubDate>%s</pubDate>\n"
- (org-rss-build-categories headline info) "\n"
- "<description><![CDATA[%s]]></description>\n"
- "</item>\n")
- title publink author guid pubdate contents)))))
+ (if (> (org-export-get-relative-level headline info) 1)
+ (org-html-headline headline contents 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
+ "<item>\n"
+ "<title>%s</title>\n"
+ "<link>%s</link>\n"
+ "<author>%s</author>\n"
+ "<guid isPermaLink=\"false\">%s</guid>\n"
+ "<pubDate>%s</pubDate>\n"
+ (org-rss-build-categories headline info) "\n"
+ "<description><![CDATA[%s]]></description>\n"
+ "</item>\n")
+ title publink author guid pubdate contents))))))
(defun org-rss-build-categories (headline info)
"Build categories for the RSS item."
--
2.8.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Prevent org-rss-headline dropping lower level headlines
2016-04-19 8:47 [PATCH] Prevent org-rss-headline dropping lower level headlines Arun Isaac
@ 2016-05-09 14:19 ` Arun Isaac
2016-05-09 21:21 ` Nicolas Goaziou
0 siblings, 1 reply; 7+ messages in thread
From: Arun Isaac @ 2016-05-09 14:19 UTC (permalink / raw
To: Emacs orgmode
Hi,
Sorry for reposting. Could somebody check out this patch (sent on April
19), and consider for inclusion?
Thanks.
> Hi,
>
> Currently, the RSS exporter (org-rss-headline) drops lower level
> headlines (headlines with level > 1), and therefore they do not appear
> in the exported RSS. This is a bug.
>
> For example, if the following file were exported to RSS, "Headline level
> 2" would not appear in the output.
>
> ===== file begins here =====
> * Headline level 1
>
> foo
>
> ** Headline level 2
>
> bar
> ===== file end here =====
>
> Please find attached a patch fixing this.
>
> Regards,
> Arun Isaac.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Prevent org-rss-headline dropping lower level headlines
2016-05-09 14:19 ` Arun Isaac
@ 2016-05-09 21:21 ` Nicolas Goaziou
2016-05-10 18:33 ` Arun Isaac
0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2016-05-09 21:21 UTC (permalink / raw
To: Arun Isaac; +Cc: Emacs orgmode
Hello,
Arun Isaac <theroarofthedragon@gmail.com> writes:
> Sorry for reposting. Could somebody check out this patch (sent on April
> 19), and consider for inclusion?
This is a contributed package. I don't mind patching it but those have,
usually, a maintainer.
>> Currently, the RSS exporter (org-rss-headline) drops lower level
>> headlines (headlines with level > 1), and therefore they do not appear
>> in the exported RSS. This is a bug.
Are you sure it is a bug? There's a comment about it in
`org-rss-headline' so maybe it is intended.
Also, isn't the output of `org-html-headline'
(`org-export-data-with-backend' is better IMO) a bit verbose? You are
going to insert <div id="outline-container-..." ...>"...
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Prevent org-rss-headline dropping lower level headlines
2016-05-09 21:21 ` Nicolas Goaziou
@ 2016-05-10 18:33 ` Arun Isaac
2016-05-10 20:16 ` Nicolas Goaziou
0 siblings, 1 reply; 7+ messages in thread
From: Arun Isaac @ 2016-05-10 18:33 UTC (permalink / raw
To: Emacs orgmode
> This is a contributed package. I don't mind patching it but those have,
> usually, a maintainer.
Is there some other maintainer I should contact? I mean, should I be
posting bug reports and patches to contributed packages on some other
mailing list?
> Are you sure it is a bug? There's a comment about it in
> `org-rss-headline' so maybe it is intended.
The comment says "Only consider first level headlines". I took that to
mean that only first level headlines will become individual RSS items,
but that all contents under that first level headline will be included
into the corresponding RSS item. Therefore, I concluded that dropping
lower level headlines was a bug.
But, even if it isn't a bug, I think it makes more sense to include all
content within the first level headline in the RSS item. I don't see a
use case where you would want to drop lower level headlines. Please
correct me if I'm wrong.
> Also, isn't the output of `org-html-headline'
> (`org-export-data-with-backend' is better IMO) a bit verbose? You are
> going to insert <div id="outline-container-..." ...>"...
I'm not sure what you mean by verbose. The RSS specification does allow
HTML within a CDATA section. Besides, org-export-data-with-backend
(with the html backend) also inserts the "<div
id="outline-container-..." ...>" things, doesn't it?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Prevent org-rss-headline dropping lower level headlines
2016-05-10 18:33 ` Arun Isaac
@ 2016-05-10 20:16 ` Nicolas Goaziou
2016-05-12 4:06 ` Arun Isaac
0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2016-05-10 20:16 UTC (permalink / raw
To: Arun Isaac; +Cc: Emacs orgmode
Hello,
Arun Isaac <theroarofthedragon@gmail.com> writes:
> Is there some other maintainer I should contact? I mean, should I be
> posting bug reports and patches to contributed packages on some other
> mailing list?
This ML is fine. The author is Bastien, who is reading it anyway.
> The comment says "Only consider first level headlines". I took that to
> mean that only first level headlines will become individual RSS items,
> but that all contents under that first level headline will be included
> into the corresponding RSS item. Therefore, I concluded that dropping
> lower level headlines was a bug.
>
> But, even if it isn't a bug, I think it makes more sense to include all
> content within the first level headline in the RSS item. I don't see a
> use case where you would want to drop lower level headlines. Please
> correct me if I'm wrong.
Fair enough.
>> Also, isn't the output of `org-html-headline'
>> (`org-export-data-with-backend' is better IMO) a bit verbose? You are
>> going to insert <div id="outline-container-..." ...>"...
>
> I'm not sure what you mean by verbose.
I mean that the HTML back-end adds data that may not be useful for the
RSS back-end.
> The RSS specification does allow HTML within a CDATA section. Besides,
> org-export-data-with-backend (with the html backend) also inserts the
> "<div id="outline-container-..." ...>" things, doesn't it?
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.
Could you send an updated patch? Thank you.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Prevent org-rss-headline dropping lower level headlines
2016-05-10 20:16 ` Nicolas Goaziou
@ 2016-05-12 4:06 ` Arun Isaac
2016-05-13 15:38 ` Nicolas Goaziou
0 siblings, 1 reply; 7+ messages in thread
From: Arun Isaac @ 2016-05-12 4:06 UTC (permalink / raw
To: Emacs orgmode
[-- Attachment #1: Type: text/plain, Size: 665 bytes --]
> I mean that the HTML back-end adds data that may not be useful for the
> RSS back-end.
Yes, things like the <div id=...> 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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ox-rss-Prevent-dropping-lower-level-headlines.patch --]
[-- Type: text/x-diff, Size: 5364 bytes --]
From a8fd0b0f4eca51a38a432ad942b695b9e565d4fe Mon Sep 17 00:00:00 2001
From: Arun Isaac <theroarofthedragon@gmail.com>
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.
---
| 106 ++++++++++++++++++++++++-------------------------
1 file changed, 53 insertions(+), 53 deletions(-)
--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
- "<item>\n"
- "<title>%s</title>\n"
- "<link>%s</link>\n"
- "<author>%s</author>\n"
- "<guid isPermaLink=\"false\">%s</guid>\n"
- "<pubDate>%s</pubDate>\n"
- (org-rss-build-categories headline info) "\n"
- "<description><![CDATA[%s]]></description>\n"
- "</item>\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
+ "<item>\n"
+ "<title>%s</title>\n"
+ "<link>%s</link>\n"
+ "<author>%s</author>\n"
+ "<guid isPermaLink=\"false\">%s</guid>\n"
+ "<pubDate>%s</pubDate>\n"
+ (org-rss-build-categories headline info) "\n"
+ "<description><![CDATA[%s]]></description>\n"
+ "</item>\n")
+ title publink author guid pubdate contents))))))
(defun org-rss-build-categories (headline info)
"Build categories for the RSS item."
--
2.8.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Prevent org-rss-headline dropping lower level headlines
2016-05-12 4:06 ` Arun Isaac
@ 2016-05-13 15:38 ` Nicolas Goaziou
0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2016-05-13 15:38 UTC (permalink / raw
To: Arun Isaac; +Cc: Emacs orgmode
Hello,
Arun Isaac <theroarofthedragon@gmail.com> writes:
> Yes, things like the <div id=...> 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.
Fair enough.
> Please find attached an updated patch.
Applied. Thank you.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-05-13 15:38 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-19 8:47 [PATCH] Prevent org-rss-headline dropping lower level headlines Arun Isaac
2016-05-09 14:19 ` Arun Isaac
2016-05-09 21:21 ` Nicolas Goaziou
2016-05-10 18:33 ` Arun Isaac
2016-05-10 20:16 ` Nicolas Goaziou
2016-05-12 4:06 ` Arun Isaac
2016-05-13 15:38 ` Nicolas Goaziou
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.