From 46964bfa4da1b9f4c2fb85768bcaca2ccfdab741 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 23 Dec 2008 01:33:08 +0100 Subject: rss-2: Fix buglets. * src/guile/skribilo/reader/rss-2.scm (html-string->parse-tree): Remove. (generic-tag->skribe): Handle `*TOP*' here. This allows us to make sure we generate a valid tree, regardless of whether TAG is flat or not. (item->section): Parse the title as HTML, too. Don't `unquote-splice' the result of `generic-tag->skribe'. (feed->document): Likewise. --- src/guile/skribilo/reader/rss-2.scm | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/guile/skribilo/reader/rss-2.scm b/src/guile/skribilo/reader/rss-2.scm index 4347282..946ebdc 100755 --- a/src/guile/skribilo/reader/rss-2.scm +++ b/src/guile/skribilo/reader/rss-2.scm @@ -93,13 +93,12 @@ (string-append "rss-2: " fmt "~%") args)) -(define (html-string->parse-tree str) - ;; Remove the leading `*TOP*'. - (cdr (html->shtml str))) - (define (generic-tag->skribe tag) (let loop ((tag tag)) (match tag + (('*TOP* body ...) + `(list ,@(map loop body))) + ((? string? tag) tag) @@ -235,7 +234,7 @@ (('*PI* 'xml (? string? body)) ;; Seen on MS-generated code: an tag in the middle of the ;; ! - `(list ,@(loop (html-string->parse-tree body)))) + `(list ,@(loop (html->shtml body)))) (((? symbol? unsupported-tag) rest ...) (warn* (_ "tag `~s' ignored") tag) @@ -279,15 +278,15 @@ (let ((title (find-tag item 'title)) (date (find-tag item 'pubDate)) (desc (find-tag item 'description))) - `(,markup :title ',(cadr title) + `(,markup :title ,(generic-tag->skribe (html->shtml (cadr title))) (p (bold ,(string-trim-both (date->string (english-date->date (cadr date)) "~e ~B ~Y"))) ". ") - ,@(generic-tag->skribe - (html-string->parse-tree (cadr desc)))))) + ,(generic-tag->skribe + (html->shtml (cadr desc)))))) (define (feed->document feed) ;; Return a Skribilo `(document ...)' S-exp from FEED, the SXML tree of an @@ -300,7 +299,7 @@ (let ((title (channel-title (car channels))) (single? (null? (cdr channels)))) ;; When there's only one channel, promote items as chapters. - `(document :title ,title + `(document :title ,(generic-tag->skribe (html->shtml title)) ,@(if single? (map (lambda (item) (item->section item 'chapter)) -- cgit v1.2.3