[-- Attachment #1: Type: text/plain, Size: 353 bytes --] Hi guys, I'm a happy user of ox-rss.el, but was annoyed the other day when I wanted to export an article with a headline containing markup. The problem is that org-rss-headlines uses the raw-value of the headline to export the title, which could contain any markup. Here's a patch that uses the :EXPORT_TITLE property if present, :raw-value if not. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: org-rss-headline.diff --] [-- Type: text/x-patch, Size: 842 bytes --] diff --git a/contrib/lisp/ox-rss.el b/contrib/lisp/ox-rss.el index fddaa1d..5617d26 100644 --- a/contrib/lisp/ox-rss.el +++ b/contrib/lisp/ox-rss.el @@ -244,11 +244,12 @@ communication channel." (format-time-string "%a, %d %b %Y %H:%M:%S %z" (org-time-string-to-time pubdate0))))) - (title (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 (or (org-element-property :EXPORT_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 [-- Attachment #3: Type: text/plain, Size: 89 bytes --] Please tell me what you think. Cheers Nico -- Nicolas Petton http://nicolas-petton.fr
Hello, Nicolas Petton <nicolas@petton.fr> writes: > I'm a happy user of ox-rss.el, but was annoyed the other day when I > wanted to export an article with a headline containing markup. What problem did you encounter? > The problem is that org-rss-headlines uses the raw-value of the headline > to export the title, which could contain any markup. Actually, an export back-end isn't expected to use :raw-value. One way to handle this is to create an anonymous export back-end that strips unwanted objects, or export them differently (e.g., a link is exported as its description, if any, or its path). See, for example `org-html--format-toc-headline'. > Here's a patch that uses the :EXPORT_TITLE property if present, > :raw-value if not. :EXPORT_TITLE is meant to replace #+TITLE: during a subtree export. There is ALT_TITLE property, but this is usually used in table of contents. Regards, -- Nicolas Goaziou
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > Hello, > > Nicolas Petton <nicolas@petton.fr> writes: > >> I'm a happy user of ox-rss.el, but was annoyed the other day when I >> wanted to export an article with a headline containing markup. > > What problem did you encounter? If the headline contains *bold* text for example, the RSS item title will have the extras * characters, since it's using the :raw-value. > >> The problem is that org-rss-headlines uses the raw-value of the headline >> to export the title, which could contain any markup. > > Actually, an export back-end isn't expected to use :raw-value. > > One way to handle this is to create an anonymous export back-end that > strips unwanted objects, or export them differently (e.g., a link is > exported as its description, if any, or its path). See, for example > `org-html--format-toc-headline'. > >> Here's a patch that uses the :EXPORT_TITLE property if present, >> :raw-value if not. > > :EXPORT_TITLE is meant to replace #+TITLE: during a subtree export. > There is ALT_TITLE property, but this is usually used in table of > contents. Ok. What about an :RSS_TITLE property? Or should I have a look at `org-html--format-toc-headline' and submit a different patch? Nico -- Nicolas Petton http://nicolas-petton.fr
Nicolas Petton <nicolas@petton.fr> writes: > If the headline contains *bold* text for example, the RSS item title > will have the extras * characters, since it's using the :raw-value. OK. But what is expected instead? HTML markup? Nothing at all? > Ok. What about an :RSS_TITLE property? Or should I have a look at > `org-html--format-toc-headline' and submit a different patch? I think we can have both: an anonymous export back-end that strips markup from headline, and a property (RSS_TITLE is fine) to override the headline. WDYT? Regards,
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > Nicolas Petton <nicolas@petton.fr> writes: > >> If the headline contains *bold* text for example, the RSS item title >> will have the extras * characters, since it's using the :raw-value. > > OK. But what is expected instead? HTML markup? Nothing at all? I'd say the content of headline without any markup. > >> Ok. What about an :RSS_TITLE property? Or should I have a look at >> `org-html--format-toc-headline' and submit a different patch? > > I think we can have both: an anonymous export back-end that strips > markup from headline, and a property (RSS_TITLE is fine) to override the > headline. > > WDYT? LGTM. I'll provide another patch shortly > > Regards, -- Nicolas Petton http://nicolas-petton.fr
[-- Attachment #1: Type: text/plain, Size: 165 bytes --] Hi, Here's a new version that uses :RSS_TITLE. Do you think it's good enough for a first patch? I'll work on the export back-end, but that'll take some more time. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: org-rss-headline.diff --] [-- Type: text/x-patch, Size: 842 bytes --] diff --git a/contrib/lisp/ox-rss.el b/contrib/lisp/ox-rss.el index fddaa1d..5617d26 100644 --- a/contrib/lisp/ox-rss.el +++ b/contrib/lisp/ox-rss.el @@ -244,11 +244,12 @@ communication channel." (format-time-string "%a, %d %b %Y %H:%M:%S %z" (org-time-string-to-time pubdate0))))) - (title (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 (or (org-element-property :EXPORT_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 [-- Attachment #3: Type: text/plain, Size: 1053 bytes --] Cheers, Nico Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > Hello, > > Nicolas Petton <nicolas@petton.fr> writes: > >> I'm a happy user of ox-rss.el, but was annoyed the other day when I >> wanted to export an article with a headline containing markup. > > What problem did you encounter? > >> The problem is that org-rss-headlines uses the raw-value of the headline >> to export the title, which could contain any markup. > > Actually, an export back-end isn't expected to use :raw-value. > > One way to handle this is to create an anonymous export back-end that > strips unwanted objects, or export them differently (e.g., a link is > exported as its description, if any, or its path). See, for example > `org-html--format-toc-headline'. > >> Here's a patch that uses the :EXPORT_TITLE property if present, >> :raw-value if not. > > :EXPORT_TITLE is meant to replace #+TITLE: during a subtree export. > There is ALT_TITLE property, but this is usually used in table of > contents. > > > Regards, -- Nicolas Petton http://nicolas-petton.fr
Nicolas Petton <nicolas@petton.fr> writes: > Here's a new version that uses :RSS_TITLE. Do you think it's good enough > for a first patch? Thanks. It would be nice to document the feature somewhere in the library. > + (title (or (org-element-property :EXPORT_TITLE headline) I think you sent the wrong patch. Regards,
[-- Attachment #1: Type: text/plain, Size: 98 bytes --] Indeed, sorry about that. Here's a new patch with a short description of the RSS_TITLE property. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: ox-rss.diff --] [-- Type: text/x-patch, Size: 1220 bytes --] diff --git a/contrib/lisp/ox-rss.el b/contrib/lisp/ox-rss.el index fddaa1d..6681336 100644 --- a/contrib/lisp/ox-rss.el +++ b/contrib/lisp/ox-rss.el @@ -42,6 +42,9 @@ ;; PUBDATE property. If `org-rss-use-entry-url-as-guid', it will also add ;; an ID property, later used as the guid for the feed's item. ;; +;; The top-level headline is used as the title of each RSS item unless an +;; RSS_TITLE property is set on the headline. +;; ;; You typically want to use it within a publishing project like this: ;; ;; (add-to-list @@ -244,11 +247,12 @@ communication channel." (format-time-string "%a, %d %b %Y %H:%M:%S %z" (org-time-string-to-time pubdate0))))) - (title (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 (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 [-- Attachment #3: Type: text/plain, Size: 58 bytes --] Cheers, Nico -- Nicolas Petton http://nicolas-petton.fr
Hi guys, Any update on this? Cheers, Nico Nicolas Petton <nicolas@petton.fr> writes: > Indeed, sorry about that. > Here's a new patch with a short description of the RSS_TITLE property. > > > Cheers, > Nico -- Nicolas Petton http://nicolas-petton.fr
Nicolas Petton <nicolas@petton.fr> writes:
> Hi guys,
>
> Any update on this?
Applied, thank you.
I forgot to mention it, but next time, please provide patch with "git
format-patch" and a proper commit message.
Regards,
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > Nicolas Petton <nicolas@petton.fr> writes: > >> Hi guys, >> >> Any update on this? > > Applied, thank you. > > I forgot to mention it, but next time, please provide patch with "git > format-patch" and a proper commit message. Ahh, sorry about that. I'm not used to contributing through emails. Would cloning the repository and create branches that can be merged into the main repository be more convenient? Nico -- Nicolas Petton http://nicolas-petton.fr
Nicolas Petton <nicolas@petton.fr> writes:
> Ahh, sorry about that. I'm not used to contributing through
> emails. Would cloning the repository and create branches that can be
> merged into the main repository be more convenient?
Cloning the repository would help. You can create branches for large
patches and use format-patch for simple ones.
Regards,