emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-rss-headline
@ 2015-01-13 18:09 Nicolas Petton
  2015-01-13 19:23 ` Nicolas Goaziou
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Petton @ 2015-01-13 18:09 UTC (permalink / raw)
  To: Org-mode Org-Mode

[-- 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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] org-rss-headline
  2015-01-13 18:09 [PATCH] org-rss-headline Nicolas Petton
@ 2015-01-13 19:23 ` Nicolas Goaziou
  2015-01-13 19:42   ` Nicolas Petton
  2015-01-14 22:51   ` Nicolas Petton
  0 siblings, 2 replies; 12+ messages in thread
From: Nicolas Goaziou @ 2015-01-13 19:23 UTC (permalink / raw)
  To: Nicolas Petton; +Cc: Org-mode Org-Mode

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] org-rss-headline
  2015-01-13 19:23 ` Nicolas Goaziou
@ 2015-01-13 19:42   ` Nicolas Petton
  2015-01-13 22:14     ` Nicolas Goaziou
  2015-01-14 22:51   ` Nicolas Petton
  1 sibling, 1 reply; 12+ messages in thread
From: Nicolas Petton @ 2015-01-13 19:42 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Nicolas Petton, Org-mode Org-Mode


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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] org-rss-headline
  2015-01-13 19:42   ` Nicolas Petton
@ 2015-01-13 22:14     ` Nicolas Goaziou
  2015-01-13 22:21       ` Nicolas Petton
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Goaziou @ 2015-01-13 22:14 UTC (permalink / raw)
  To: Nicolas Petton; +Cc: Org-mode Org-Mode

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,

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] org-rss-headline
  2015-01-13 22:14     ` Nicolas Goaziou
@ 2015-01-13 22:21       ` Nicolas Petton
  0 siblings, 0 replies; 12+ messages in thread
From: Nicolas Petton @ 2015-01-13 22:21 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Nicolas Petton, Org-mode Org-Mode


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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] org-rss-headline
  2015-01-13 19:23 ` Nicolas Goaziou
  2015-01-13 19:42   ` Nicolas Petton
@ 2015-01-14 22:51   ` Nicolas Petton
  2015-01-16  8:42     ` Nicolas Goaziou
  1 sibling, 1 reply; 12+ messages in thread
From: Nicolas Petton @ 2015-01-14 22:51 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Nicolas Petton, Org-mode Org-Mode

[-- 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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] org-rss-headline
  2015-01-14 22:51   ` Nicolas Petton
@ 2015-01-16  8:42     ` Nicolas Goaziou
  2015-01-18 23:04       ` Nicolas Petton
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Goaziou @ 2015-01-16  8:42 UTC (permalink / raw)
  To: Nicolas Petton; +Cc: Org-mode Org-Mode

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,

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] org-rss-headline
  2015-01-16  8:42     ` Nicolas Goaziou
@ 2015-01-18 23:04       ` Nicolas Petton
  2015-01-20 14:17         ` Nicolas Petton
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Petton @ 2015-01-18 23:04 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode Org-Mode

[-- 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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] org-rss-headline
  2015-01-18 23:04       ` Nicolas Petton
@ 2015-01-20 14:17         ` Nicolas Petton
  2015-01-20 23:36           ` Nicolas Goaziou
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Petton @ 2015-01-20 14:17 UTC (permalink / raw)
  To: Nicolas Goaziou, Org-mode Org-Mode

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] org-rss-headline
  2015-01-20 14:17         ` Nicolas Petton
@ 2015-01-20 23:36           ` Nicolas Goaziou
  2015-01-20 23:46             ` Nicolas Petton
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Goaziou @ 2015-01-20 23:36 UTC (permalink / raw)
  To: Nicolas Petton; +Cc: Org-mode Org-Mode

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,

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] org-rss-headline
  2015-01-20 23:36           ` Nicolas Goaziou
@ 2015-01-20 23:46             ` Nicolas Petton
  2015-01-21 21:06               ` Nicolas Goaziou
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Petton @ 2015-01-20 23:46 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Nicolas Petton, Org-mode Org-Mode


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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] org-rss-headline
  2015-01-20 23:46             ` Nicolas Petton
@ 2015-01-21 21:06               ` Nicolas Goaziou
  0 siblings, 0 replies; 12+ messages in thread
From: Nicolas Goaziou @ 2015-01-21 21:06 UTC (permalink / raw)
  To: Nicolas Petton; +Cc: Org-mode Org-Mode

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,

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-01-21 21:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-13 18:09 [PATCH] org-rss-headline Nicolas Petton
2015-01-13 19:23 ` Nicolas Goaziou
2015-01-13 19:42   ` Nicolas Petton
2015-01-13 22:14     ` Nicolas Goaziou
2015-01-13 22:21       ` Nicolas Petton
2015-01-14 22:51   ` Nicolas Petton
2015-01-16  8:42     ` Nicolas Goaziou
2015-01-18 23:04       ` Nicolas Petton
2015-01-20 14:17         ` Nicolas Petton
2015-01-20 23:36           ` Nicolas Goaziou
2015-01-20 23:46             ` Nicolas Petton
2015-01-21 21:06               ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).