diff options
author | Ulf Jasper <ulf.jasper@web.de> | 2014-10-01 19:20:00 +0200 |
---|---|---|
committer | Ulf Jasper <ulf.jasper@web.de> | 2014-10-01 19:20:00 +0200 |
commit | 34912c0a2be7a48969652b1556d2998240c59a22 (patch) | |
tree | 8ca358808d6395e7bbf00de4aebdfb0a2257dd20 /lisp/net/newst-reader.el | |
parent | f94ec2f3c82123e284c412ca8841c57491924f85 (diff) | |
download | emacs-34912c0a2be7a48969652b1556d2998240c59a22.tar.gz |
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up.
* lisp/net/newst-backend.el: Remove Time-stamp. Rename variable
`newsticker--download-logos' to `newsticker-download-logos' and
make it customizable.
(newsticker--sentinel-work): Move xml-workarounds to function
`newsticker--do-xml-workarounds', call unless libxml-parser is
used. Allow single quote in regexp for encoding. Use
libxml-parser if available, else fall back to `xml-parse-region'.
Take care of possibly missing namespace prefixes (like "RDF"
instead of "rdf:RDF") when checking xml nodes and attributes (as
libxml correctly removes the prefixes). Always use Atom 1.0 as
fallback feed type. Rename `newsticker--download-logos' to
`newsticker-download-logos'
(newsticker--unxml, newsticker--unxml-node)
(newsticker--unxml-attribute): New.
(newsticker--parse-atom-1.0): Call `unxml' in case that embedded
HTML code has become part of the xml parse tree.
(newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care
of possibly missing namespace prefixes.
(newsticker--parse-generic-items): Code formatting. Typo.
(newsticker--images-dir): Add trailing slash.
(newsticker--image-get): Fix error message.
* lisp/net/newst-plainview.el: Remove Time-stamp.
* lisp/net/newst-reader.el: Remove Time-stamp.
(newsticker-download-logos): Rename variable
`newsticker--download-logos' to `newsticker-download-logos' and
make it customizable.
(newsticker--print-extra-elements): Add optional parameter
'htmlish for using html markup. Amend list of ignored elements.
(newsticker--do-print-extra-element): Add parameter 'htmlish for
using html markup.
* lisp/net/newst-ticker.el: Remove Time-stamp.
* lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html
for formatting extra elements.
* lisp/net/newsticker.el: Remove Time-stamp, Version.
(newsticker-version): Make obsolete.
Diffstat (limited to 'lisp/net/newst-reader.el')
-rw-r--r-- | lisp/net/newst-reader.el | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/lisp/net/newst-reader.el b/lisp/net/newst-reader.el index 737aac22d46..8232e4bd9bd 100644 --- a/lisp/net/newst-reader.el +++ b/lisp/net/newst-reader.el @@ -5,7 +5,6 @@ ;; Author: Ulf Jasper <ulf.jasper@web.de> ;; Filename: newst-reader.el ;; URL: http://www.nongnu.org/newsticker -;; Time-stamp: "24. September 2011, 15:47:49 (ulf)" ;; Package: newsticker ;; ====================================================================== @@ -67,6 +66,12 @@ This must be one of the functions `newsticker-plainview' or :group 'newsticker-reader) ;; image related things +(defcustom newsticker-download-logos + t + "If non-nil newsticker downloads logo images of subscribed feeds." + :type 'boolean + :group 'newsticker-reader) + (defcustom newsticker-enable-logo-manipulations t "If non-nil newsticker manipulates logo images. @@ -186,15 +191,17 @@ KEYMAP will be applied." 'nt-type 'desc)) (insert "\n"))))) -(defun newsticker--print-extra-elements (item keymap) +(defun newsticker--print-extra-elements (item keymap &optional htmlish) "Insert extra-elements of ITEM in a pretty form into the current buffer. KEYMAP is applied." (let ((ignored-elements '(items link title description content - content:encoded dc:subject - dc:date entry item guid pubDate + content:encoded encoded + dc:subject subject + dc:date date entry item guid pubDate published updated enclosure)) (left-column-width 1)) + (if htmlish (insert "<ul>")) (mapc (lambda (extra-element) (when (listp extra-element) ;; take care of broken xml ;; data, 2007-05-25 @@ -209,15 +216,19 @@ KEYMAP is applied." (unless (memq (car extra-element) ignored-elements) (newsticker--do-print-extra-element extra-element left-column-width - keymap)))) - (newsticker--extra item)))) + keymap + htmlish)))) + (newsticker--extra item)) + (if htmlish (insert "</ul>")))) -(defun newsticker--do-print-extra-element (extra-element width keymap) +(defun newsticker--do-print-extra-element (extra-element width keymap htmlish) "Actually print an EXTRA-ELEMENT using the given WIDTH. KEYMAP is applied." (let ((name (symbol-name (car extra-element)))) - (insert (format "%s: " name)) - (insert (make-string (- width (length name)) ? ))) + (if htmlish + (insert (format "<li>%s: " name)) + (insert (format "%s: " name)) + (insert (make-string (- width (length name)) ? )))) (let (;;(attributes (cadr extra-element)) ;FIXME!!!! (contents (cddr extra-element))) (cond ((listp contents) @@ -238,7 +249,9 @@ KEYMAP is applied." contents)) (t (insert (format "%s" contents)))) - (insert "\n"))) + (if htmlish + (insert "</li>") + (insert "\n")))) (defun newsticker--image-read (feed-name-symbol disabled) "Read the cached image for FEED-NAME-SYMBOL from disk. |