Fixed unknown type 'listp errors

This commit is contained in:
j4nk 2025-01-23 21:21:02 -05:00
parent c9e5cf5760
commit cf0b0983b4
3 changed files with 12 additions and 12 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>Sat, 30 Mar 2024 21:59:21 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>Thu, 23 Jan 2025 21:20:24 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;

View File

@ -37,7 +37,7 @@
(defun md4tj-util-zip (ls)
"Turn list of lists LS into list of tuples."
(cl-labels ((zip-help (ll) (if (not (car ll)) nil (cons (cl-map 'listp #'car ll) (zip-help (cl-map 'listp 'cdr ll))))))
(cl-labels ((zip-help (ll) (if (not (car ll)) nil (cons (cl-map 'list #'car ll) (zip-help (cl-map 'list 'cdr ll))))))
(zip-help ls)))
;; End basic utilities
@ -45,7 +45,7 @@
(defun md4tj-begin-tag (tag &optional attrs)
"Return beginning html tag for TAG with optional ATTRS."
(concat "<" tag
(mapconcat 'identity (cl-map 'listp (lambda (l) (concat " " (nth 0 l) "=" "\"" (nth 1 l) "\"")) attrs) "")
(mapconcat 'identity (cl-map 'list (lambda (l) (concat " " (nth 0 l) "=" "\"" (nth 1 l) "\"")) attrs) "")
">"))
(defun md4tj-end-tag (tag)
@ -319,15 +319,15 @@
;; (defun md4tj-blog-names ()
;; "Find all blogs on blog page."
;; (cl-map #'listp (lambda (l) (nth 1 l)) (cl-map #'listp 'split-string (cl-remove-if-not (lambda (s) (string-match "^@@BLOGPOST" s)) (split-string (buffer-string) "\n")))))
;; (cl-map 'list (lambda (l) (nth 1 l)) (cl-map 'list 'split-string (cl-remove-if-not (lambda (s) (string-match "^@@BLOGPOST" s)) (split-string (buffer-string) "\n")))))
(defun md4tj-blog-names ()
"Get all blogs names from buffer."
(cl-map 'listp (lambda (s) (string-replace (md4tj-blog-base-dir) "" s)) (cl-map 'listp (lambda (s) (replace-regexp-in-string "\\.md4tj$" "" s)) (md4tj-blog-files))))
(cl-map 'list (lambda (s) (string-replace (md4tj-blog-base-dir) "" s)) (cl-map 'list (lambda (s) (replace-regexp-in-string "\\.md4tj$" "" s)) (md4tj-blog-files))))
(defun md4tj-blog-links ()
"Get all links on the blog page."
(let ((base-url (md4tj-blog-base-url)))
(cl-map #'listp (lambda (s) (concat base-url s ".html")) (md4tj-blog-names))))
(cl-map 'list (lambda (s) (concat base-url s ".html")) (md4tj-blog-names))))
(defun md4tj-blog-file (name)
"Get full filename from NAME."
@ -335,8 +335,8 @@
(defun md4tj-blog-files ()
"Get all blog .md4tj files."
(cl-map 'listp (lambda (s) (concat (md4tj-blog-base-dir) s)) (cl-remove-if-not (lambda (s) (string-match ".*\\.md4tj$" s)) (directory-files (md4tj-blog-base-dir)))))
;(cl-map #'listp 'md4tj-blog-file (md4tj-blog-names)))
(cl-map 'list (lambda (s) (concat (md4tj-blog-base-dir) s)) (cl-remove-if-not (lambda (s) (string-match ".*\\.md4tj$" s)) (directory-files (md4tj-blog-base-dir)))))
;(cl-map 'list 'md4tj-blog-file (md4tj-blog-names)))
(defun md4tj-blog-title (f)
"Get blog title from file F."
@ -349,7 +349,7 @@
(defun md4tj-blog-titles ()
"Get all blog titles in current file."
(cl-map #'listp 'md4tj-blog-title (md4tj-blog-files)))
(cl-map 'list 'md4tj-blog-title (md4tj-blog-files)))
(defun md4tj-blog-time (f)
"Get blog time (unix time) from file F."
@ -362,7 +362,7 @@
(defun md4tj-blog-times ()
"Get all blog times in current file."
(cl-map #'listp 'md4tj-blog-time (md4tj-blog-files)))
(cl-map 'list 'md4tj-blog-time (md4tj-blog-files)))
;; triple of
@ -427,7 +427,7 @@
(defun md4tj-rss-get-channel-statements ()
"Get all channel statements from current buffer."
(cl-remove-if-not #'md4tj-rss-is-valid-channel-statement (cl-map 'listp (lambda (toks) (cons (string-replace "@@RSSCHANNEL" "" (car toks)) (cdr toks))) (cl-map 'listp #'split-string (cl-remove-if-not (lambda (line) (string-match "^@@RSSCHANNEL.*" line)) (split-string (buffer-string) "\n"))))))
(cl-remove-if-not #'md4tj-rss-is-valid-channel-statement (cl-map 'list (lambda (toks) (cons (string-replace "@@RSSCHANNEL" "" (car toks)) (cdr toks))) (cl-map 'list #'split-string (cl-remove-if-not (lambda (line) (string-match "^@@RSSCHANNEL.*" line)) (split-string (buffer-string) "\n"))))))
(defun md4tj-rss-channel-statement-toks-to-rss (toks)
"Generate RSS syntax for RSS channel statement tokenized to TOKS."

View File

@ -77,7 +77,7 @@ int main() {
<p>This is a div that has monospace text.</p>
</div>
<p id="lastupdated">Last updated: Sun 31 Mar 2024 01:59 UTC</p>
<p id="lastupdated">Last updated: Fri 24 Jan 2025 02:20 UTC</p>
<br>