Forgot to escape text for RSS, done that now
This commit is contained in:
parent
81abca1171
commit
4054cdfdbf
|
@ -4,4 +4,4 @@
|
|||
@@BLOGPOSTDATE 1677804254
|
||||
# Blog post 1
|
||||
blog text 1!
|
||||
[Link to example.com!](https://www.example.com ())
|
||||
[Link to example.com!](https://www.example.com)
|
|
@ -1,21 +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>
|
||||
<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>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
<h1>Blog post 2</h1>
|
||||
<h1>Blog post 2</h1>
|
||||
|
||||
<p>blog text 2 text!</p>
|
||||
<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>
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
<h1>Blog post 1</h1>
|
||||
<h1>Blog post 1</h1>
|
||||
|
||||
<p>blog text 1!</p>
|
||||
<p>blog text 1!</p>
|
||||
|
||||
<p>[Link to example.com!](https://www.example.com ())</p>
|
||||
<p><a href="https://www.example.com">Link to example.com!</a></p>
|
||||
</description><pubDate>Thu, 02 Mar 2023 19:44:14 EST</pubDate></item></channel></rss>
|
|
@ -13,6 +13,6 @@
|
|||
|
||||
<p>blog text 1!</p>
|
||||
|
||||
<p>[Link to example.com!](https://www.example.com ())</p>
|
||||
<p><a href="https://www.example.com">Link to example.com!</a></p>
|
||||
</body>
|
||||
</html>
|
12
md4tj.el
12
md4tj.el
|
@ -366,6 +366,16 @@
|
|||
;; End md4tj blog stuff
|
||||
|
||||
;; md4tj rss stuff
|
||||
|
||||
(defun md4tj-rss-escape-string-for-rss (str)
|
||||
"Escape STR for RSS."
|
||||
(replace-regexp-in-string "'" "'"
|
||||
(replace-regexp-in-string "\"" """
|
||||
(replace-regexp-in-string ">" ">"
|
||||
(replace-regexp-in-string "<" "<"
|
||||
(replace-regexp-in-string "&" "&"
|
||||
(replace-regexp-in-string "'" "'" str)))))))
|
||||
|
||||
(defun md4tj-rss-needs-rss ()
|
||||
"Scans current buffer, returning t if needing rss."
|
||||
(save-excursion
|
||||
|
@ -422,7 +432,7 @@
|
|||
(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 "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-end-tag "item")))
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ int main() {
|
|||
|
||||
<p>This is a div that has monospace text.</p>
|
||||
</div>
|
||||
<p id="lastupdated">Last updated: Tue Jul 11 09:19:23 2023</p>
|
||||
<p id="lastupdated">Last updated: Tue Jul 11 09:45:26 2023</p>
|
||||
|
||||
<br>
|
||||
|
||||
|
|
Loading…
Reference in New Issue