diff options
author | Ludovic Courtès | 2008-12-23 01:33:08 +0100 |
---|---|---|
committer | Ludovic Courtès | 2008-12-23 01:33:08 +0100 |
commit | 46964bfa4da1b9f4c2fb85768bcaca2ccfdab741 (patch) | |
tree | eabdb76bd765afcb9909e8c50ae5cf6303fb7916 /src/guile | |
parent | 40926e06cd062e5945dfb796ddacf57372278f9b (diff) | |
download | skribilo-46964bfa4da1b9f4c2fb85768bcaca2ccfdab741.tar.gz skribilo-46964bfa4da1b9f4c2fb85768bcaca2ccfdab741.tar.lz skribilo-46964bfa4da1b9f4c2fb85768bcaca2ccfdab741.zip |
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.
Diffstat (limited to 'src/guile')
-rwxr-xr-x | src/guile/skribilo/reader/rss-2.scm | 17 |
1 files changed, 8 insertions, 9 deletions
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 <xml> tag in the middle of the ;; <description>! - `(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)) |