From bfa3d6be68e60b5ebc535060039d5a47b0d3813a Mon Sep 17 00:00:00 2001 From: j4nk Date: Tue, 11 Jul 2023 18:56:47 -0400 Subject: [PATCH] Fixed issue where the wrong blog content was in the wrong rss item --- blog/feed.xml | 2 +- md4tj.el | 18 +++++++++--------- test_file.html | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/blog/feed.xml b/blog/feed.xml index 0c38959..f59a9f9 100644 --- a/blog/feed.xml +++ b/blog/feed.xml @@ -1,4 +1,4 @@ -RSS Testhttp://example.comAn example blog for testing RSS capability of md4tj.en-USTue, 10 Jun 2003 04:00:00 GMTeditor@example.comwebmaster@example.comhttps://www.rssboard.org/rss-specificationmd4tj-rss.elTue, 11 Jul 2023 09:45:27 GMTBlog Post 2https://example.com/blog/blogpost2.htmlhttps://example.com/blog/blogpost2.html +RSS Testhttp://example.comAn example blog for testing RSS capability of md4tj.en-USTue, 10 Jun 2003 04:00:00 GMTeditor@example.comwebmaster@example.comhttps://www.rssboard.org/rss-specificationmd4tj-rss.elTue, 11 Jul 2023 18:56:34 GMTBlog Post 2https://example.com/blog/blogpost2.htmlhttps://example.com/blog/blogpost2.html <br> diff --git a/md4tj.el b/md4tj.el index 643d86a..651557a 100644 --- a/md4tj.el +++ b/md4tj.el @@ -344,7 +344,7 @@ ;; Link (defun md4tj-blog-all-blogs-list () "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) "Convert abl list elt ELT to html." @@ -425,19 +425,19 @@ ;; 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 ;; in the RSS feed -(defun md4tj-rss-item (eltfilelist) - "Return RSS for ELTFILELIST." +(defun md4tj-rss-item (elt) + "Return RSS for ELT." (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 "link") (nth 2 (nth 1 eltfilelist)) (md4tj-rss-end-tag "link") - (md4tj-rss-begin-tag "guid") (nth 2 (nth 1 eltfilelist)) (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 "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 "title") (nth 0 elt) (md4tj-rss-end-tag "title") + (md4tj-rss-begin-tag "link") (nth 2 elt) (md4tj-rss-end-tag "link") + (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 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 elt))) (md4tj-rss-end-tag "pubDate") (md4tj-rss-end-tag "item"))) (defun md4tj-rss-items () "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) "")) diff --git a/test_file.html b/test_file.html index c4f7d2b..9011ca1 100644 --- a/test_file.html +++ b/test_file.html @@ -75,7 +75,7 @@ int main() {

This is a div that has monospace text.

-

Last updated: Tue Jul 11 09:45:26 2023

+

Last updated: Tue Jul 11 18:56:34 2023