Fixed issue where the wrong blog content was in the wrong rss item

This commit is contained in:
j4nk 2023-07-11 18:56:47 -04:00
parent ec2765a9bd
commit bfa3d6be68
3 changed files with 11 additions and 11 deletions

View File

@ -1,4 +1,4 @@
<rss version="2.0"><channel><title>RSS Test</title><link>http://example.com</link><description>An example blog for testing RSS capability of md4tj.</description><language>en-US</language><pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate><managingEditor>editor@example.com</managingEditor><webMaster>webmaster@example.com</webMaster><docs>https://www.rssboard.org/rss-specification</docs><generator>md4tj-rss.el</generator><lastBuildDate>Tue, 11 Jul 2023 09:45:27 GMT</lastBuildDate><item><title>Blog Post 2</title><link>https://example.com/blog/blogpost2.html</link><guid>https://example.com/blog/blogpost2.html</guid><description> <rss version="2.0"><channel><title>RSS Test</title><link>http://example.com</link><description>An example blog for testing RSS capability of md4tj.</description><language>en-US</language><pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate><managingEditor>editor@example.com</managingEditor><webMaster>webmaster@example.com</webMaster><docs>https://www.rssboard.org/rss-specification</docs><generator>md4tj-rss.el</generator><lastBuildDate>Tue, 11 Jul 2023 18:56:34 GMT</lastBuildDate><item><title>Blog Post 2</title><link>https://example.com/blog/blogpost2.html</link><guid>https://example.com/blog/blogpost2.html</guid><description>
&lt;br&gt; &lt;br&gt;

View File

@ -344,7 +344,7 @@
;; Link ;; Link
(defun md4tj-blog-all-blogs-list () (defun md4tj-blog-all-blogs-list ()
"Get all blogs in current buffer." "Get all blogs in current buffer."
(-sort (lambda (l1 l2) (> (string-to-number (nth 1 l1)) (string-to-number (nth 1 l2)))) (md4tj-util-zip (list (md4tj-blog-titles) (md4tj-blog-times) (md4tj-blog-links))))) (-sort (lambda (l1 l2) (> (string-to-number (nth 1 l1)) (string-to-number (nth 1 l2)))) (md4tj-util-zip (list (md4tj-blog-titles) (md4tj-blog-times) (md4tj-blog-links) (md4tj-blog-files)))))
(defun md4tj-blog-all-blogs-list-elt-to-html (elt) (defun md4tj-blog-all-blogs-list-elt-to-html (elt)
"Convert abl list elt ELT to html." "Convert abl list elt ELT to html."
@ -425,19 +425,19 @@
;; This is really messy but the easiest way to get the filename into ;; This is really messy but the easiest way to get the filename into
;; md4tj-rss-item in order to be able to provide the entire blog post ;; md4tj-rss-item in order to be able to provide the entire blog post
;; in the RSS feed ;; in the RSS feed
(defun md4tj-rss-item (eltfilelist) (defun md4tj-rss-item (elt)
"Return RSS for ELTFILELIST." "Return RSS for ELT."
(concat (md4tj-rss-begin-tag "item") (concat (md4tj-rss-begin-tag "item")
(md4tj-rss-begin-tag "title") (nth 0 (nth 1 eltfilelist)) (md4tj-rss-end-tag "title") (md4tj-rss-begin-tag "title") (nth 0 elt) (md4tj-rss-end-tag "title")
(md4tj-rss-begin-tag "link") (nth 2 (nth 1 eltfilelist)) (md4tj-rss-end-tag "link") (md4tj-rss-begin-tag "link") (nth 2 elt) (md4tj-rss-end-tag "link")
(md4tj-rss-begin-tag "guid") (nth 2 (nth 1 eltfilelist)) (md4tj-rss-end-tag "guid") (md4tj-rss-begin-tag "guid") (nth 2 elt) (md4tj-rss-end-tag "guid")
(md4tj-rss-begin-tag "description") (md4tj-rss-escape-string-for-rss (md4tj-parse-to-string (nth 0 eltfilelist))) (md4tj-rss-end-tag "description") (md4tj-rss-begin-tag "description") (md4tj-rss-escape-string-for-rss (md4tj-parse-to-string (nth 3 elt))) (md4tj-rss-end-tag "description")
(md4tj-rss-begin-tag "pubDate") (format-time-string "%a, %d %b %Y %H:%M:%S %Z" (string-to-number (nth 1 (nth 1 eltfilelist)))) (md4tj-rss-end-tag "pubDate") (md4tj-rss-begin-tag "pubDate") (format-time-string "%a, %d %b %Y %H:%M:%S %Z" (string-to-number (nth 1 elt))) (md4tj-rss-end-tag "pubDate")
(md4tj-rss-end-tag "item"))) (md4tj-rss-end-tag "item")))
(defun md4tj-rss-items () (defun md4tj-rss-items ()
"Return all RSS for all elements." "Return all RSS for all elements."
(mapconcat 'md4tj-rss-item (md4tj-util-zip (list (reverse (md4tj-blog-files)) (md4tj-blog-all-blogs-list))) "")) (mapconcat 'md4tj-rss-item (md4tj-blog-all-blogs-list) ""))

View File

@ -75,7 +75,7 @@ int main() {
<p>This is a div that has monospace text.</p> <p>This is a div that has monospace text.</p>
</div> </div>
<p id="lastupdated">Last updated: Tue Jul 11 09:45:26 2023</p> <p id="lastupdated">Last updated: Tue Jul 11 18:56:34 2023</p>
<br> <br>