all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: wenbushi <wenbushi@gmail.com>
Cc: 34685@debbugs.gnu.org
Subject: bug#34685: 26.1; function nnrss-get-namespace-prefix always returns nil
Date: Thu, 04 Apr 2019 20:50:54 -0400	[thread overview]
Message-ID: <8736mxe0lt.fsf@gmail.com> (raw)
In-Reply-To: <CAF6JJ+AzMnvHrh8bPnjyoK+TyTaO3AWO3ZBLAfeTPTUqVWZF1w@mail.gmail.com> (wenbushi@gmail.com's message of "Thu, 28 Feb 2019 20:31:02 +0800")

tags 34685 + moreinfo
quit

wenbushi <wenbushi@gmail.com> writes:

> The function "nnrss-get-namespace-prefix" in gnus/nnrss.el always
> returns nil, which causes the contents in "<content:encoded>" tag of
> an RSS XML not showing in the gnus article buffer.
>
> Here is a fix:
>
> --- nnrss.el    2019-02-28 20:02:29.224675750 +0800
> +++ nnrss-fixed.el      2019-02-28 20:02:04.534267796 +0800
> @@ -1031,7 +1031,7 @@
>    "Given EL (containing a parsed element) and URI (containing a string
>  that gives the URI for which you want to retrieve the namespace
>  prefix), return the prefix."
> -  (let* ((prefix (car (rassoc uri (cadar el))))
> +  (let* ((prefix (car (rassoc uri (cadar (nthcdr 2 (car el))))))

> the argument "el" in the function is a list of the parsed XML, like(some
> fields are ignored)
>
> ((rss ((version . "2.0") (xmlns:atom . "http://www.w3.org/2005/Atom"))
>       (channel ((xmlns:content . "http://purl.org/rss/1.0/modules/content/"))
>                (title nil "RSS title")
>                (item nil
>                      (title nil "article title")
>                      (content:encoded nil "article content")))))
>
> The function "nnrss-get-namespace-prefix" should extract tag
> "xmlns:content". But it only returns nil because "(cadar el)" matches
> nothing.

That's only due to the particular encoding of your RSS feed though,
isn't it?  I believe xmlns prefixes can technically go on any element in
a document; I expect the current code works for some feeds, and your fix
would break things for them.

We should gather some test cases to be able to fix this properly.





       reply	other threads:[~2019-04-05  0:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAF6JJ+AzMnvHrh8bPnjyoK+TyTaO3AWO3ZBLAfeTPTUqVWZF1w@mail.gmail.com>
2019-04-05  0:50 ` Noam Postavsky [this message]
2019-04-12 10:21 ` bug#34685: 26.1; function nnrss-get-namespace-prefix always returns nil Noam Postavsky
2019-04-12 11:55   ` Noam Postavsky
2019-09-26 22:34     ` Lars Ingebrigtsen
     [not found]       ` <877dgx76x0.fsf@arrian.i-did-not-set--mail-host-address--so-tickle-me>
2021-08-09 12:13         ` Lars Ingebrigtsen
2021-08-09 16:30           ` Benjamin Riefenstahl
2021-08-10 13:48             ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736mxe0lt.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=34685@debbugs.gnu.org \
    --cc=wenbushi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.