Put blog content in the RSS feeds now.
This commit is contained in:
parent
df185b88d0
commit
81abca1171
2
Makefile
2
Makefile
|
@ -3,6 +3,6 @@ all: test_file test_blog
|
|||
test_file:
|
||||
emacs --no-site-file --batch -l ./md4tj.el --eval "(md4tj-parse \"test_file.md4tj\" \"test_file.html\")"
|
||||
test_blog:
|
||||
emacs --no-site-file --batch -l ./md4tj.el --eval "(md4tj-parse \"test_blog.md4tj\" \"test_blog.html\")"
|
||||
emacs --no-site-file --batch -l ./md4tj.el --eval "(md4tj-parse \"test_blog.md4tj\" \"./test_blog.html\")"
|
||||
emacs --no-site-file --batch -l ./md4tj.el --eval "(md4tj-parse \"./blog/blogpost1.md4tj\" \"blogpost1.html\")"
|
||||
emacs --no-site-file --batch -l ./md4tj.el --eval "(md4tj-parse \"./blog/blogpost2.md4tj\" \"blogpost2.html\")"
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<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:19:23 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>
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
<h1>Blog post 2</h1>
|
||||
|
||||
<p>blog text 2 text!</p>
|
||||
</description><pubDate>Thu, 02 Mar 2023 19:44:50 EST</pubDate></item><item><title>Blog Post 1</title><link>https://example.com/blog/blogpost1.html</link><guid>https://example.com/blog/blogpost1.html</guid><description>
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
<h1>Blog post 1</h1>
|
||||
|
||||
<p>blog text 1!</p>
|
||||
|
||||
<p>[Link to example.com!](https://www.example.com ())</p>
|
||||
</description><pubDate>Thu, 02 Mar 2023 19:44:14 EST</pubDate></item></channel></rss>
|
1
feed.xml
1
feed.xml
|
@ -1 +0,0 @@
|
|||
<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>Mon, 10 Jul 2023 08:50:16 GMT</lastBuildDate></channel><item><title>Blog Post 2</title><author>j4nk</author><link>https://example.com/blog/blogpost2.html</link><guid>https://example.com/blog/blogpost2.html</guid><pubDate>Thu, 02 Mar 2023 19:44:50 EST</pubDate></item><item><title>Blog Post 1</title><author>j4nk</author><link>https://example.com/blog/blogpost1.html</link><guid>https://example.com/blog/blogpost1.html</guid><pubDate>Thu, 02 Mar 2023 19:44:14 EST</pubDate></item></rss>
|
29
md4tj.el
29
md4tj.el
|
@ -406,22 +406,29 @@
|
|||
(md4tj-rss-begin-tag "generator") "md4tj-rss.el" (md4tj-rss-end-tag "generator")
|
||||
(md4tj-rss-begin-tag "lastBuildDate") (format-time-string "%a, %d %b %Y %H:%M:%S GMT") (md4tj-rss-end-tag "lastBuildDate")))
|
||||
|
||||
;; Elt is triple of
|
||||
;; Title
|
||||
;; Time
|
||||
;; Link
|
||||
(defun md4tj-rss-item (elt)
|
||||
"Return RSS for ELT."
|
||||
;; eltfilelist is a tuple of
|
||||
;; File name
|
||||
;; Elt, where
|
||||
;; Elt is triple of
|
||||
;; Title
|
||||
;; Time
|
||||
;; Link
|
||||
;; 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."
|
||||
(concat (md4tj-rss-begin-tag "item")
|
||||
(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 "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-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-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-end-tag "item")))
|
||||
|
||||
(defun md4tj-rss-items ()
|
||||
"Return all RSS for all elements."
|
||||
(mapconcat 'md4tj-rss-item (md4tj-blog-all-blogs-list) ""))
|
||||
(mapconcat 'md4tj-rss-item (md4tj-util-zip (list (reverse (md4tj-blog-files)) (md4tj-blog-all-blogs-list))) ""))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<h1>Blogs</h1>
|
||||
<a href=".//feed.xml"><img src="rss.png" alt="RSS icon" style="width:20px;height:20px;"></img></a>
|
||||
<div id="rssicon"><a href="https://example.com/blog/feed.xml"><img src="img/rss.png" alt="RSS icon" style="width:20px;height:20px;"></img></a></div>
|
||||
<div class=blogpost>
|
||||
<a href="https://example.com/blog/blogpost2.html"><h4>Blog Post 2</h4></a>
|
||||
<h5>2023 March 02 19:44</h5>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# Blogs
|
||||
@@RSSINSERT
|
||||
@@BLOGBASEURL https://example.com/blog/
|
||||
@@BLOGBASEDIR ./blog/
|
||||
@@BLOGBASEDIR ./blog
|
||||
@@BLOGINSERT
|
||||
|
||||
### Non blog text!!
|
||||
|
|
|
@ -75,7 +75,7 @@ int main() {
|
|||
|
||||
<p>This is a div that has monospace text.</p>
|
||||
</div>
|
||||
<p id="lastupdated">Last updated: Mon Jul 10 08:35:47 2023</p>
|
||||
<p id="lastupdated">Last updated: Tue Jul 11 09:19:23 2023</p>
|
||||
|
||||
<br>
|
||||
|
||||
|
|
Loading…
Reference in New Issue