Gopher RSS feed with gopher links - cl-yag - Common Lisp Yet Another website Ge… | |
git clone git://bitreich.org/cl-yag/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
LICENSE | |
--- | |
commit e187e771f1bad099c9f9ac8d98085aefa8998af9 | |
parent b8e92c61d9ff8d0a7e7fd65c33b0fd26c9741e68 | |
Author: Solene Rapenne <[email protected]> | |
Date: Tue, 17 Apr 2018 08:06:04 +0200 | |
Gopher RSS feed with gopher links | |
Diffstat: | |
M generator.lisp | 36 +++++++++++++++++++++--------… | |
M templates/gopher_head.tpl | 2 ++ | |
M templates/layout.tpl | 1 + | |
3 files changed, 27 insertions(+), 12 deletions(-) | |
--- | |
diff --git a/generator.lisp b/generator.lisp | |
@@ -248,7 +248,7 @@ | |
collect (create-article article :tiny t)))) | |
;; xml generation of the items for the rss | |
-(defun generate-rss-item() | |
+(defun generate-rss-item(&key (gopher nil)) | |
(apply #'concatenate 'string | |
(loop for article in *articles* | |
for i from 1 to (min (length *articles*) (getf *config* :rss-item-… | |
@@ -262,19 +262,26 @@ | |
(subseq (getf (article-dat… | |
(subseq (getf (article-dat… | |
(template "%%Url%%" | |
- (format nil "~d~d-~d.html" | |
- (getf *config* :url) | |
- (date-format "%Year-%MonthNumber-%Day… | |
- (article-date article)) | |
- (article-id article))))))) | |
+ (if gopher | |
+ (format nil "gopher://~a:~d/0~a/~a.txt" | |
+ (getf *config* :gopher-server) | |
+ (getf *config* :gopher-port) | |
+ (getf *config* :gopher-path) | |
+ (article-id article)) | |
+ (format nil "~d~d-~d.html" | |
+ (getf *config* :url) | |
+ (date-format "%Year-%MonthNumber-… | |
+ (article-date articl… | |
+ (article-id article)))))))) | |
+ | |
;; Generate the rss xml data | |
-(defun generate-rss() | |
+(defun generate-rss(&key (gopher nil)) | |
(prepare "templates/rss.tpl" | |
(template "%%Description%%" (getf *config* :description)) | |
(template "%%Title%%" (getf *config* :title)) | |
(template "%%Url%%" (getf *config* :url)) | |
- (template "%%Items%%" (generate-rss-item)))) | |
+ (template "%%Items%%" (generate-rss-item :gopher gopher)))) | |
;; We do all the website | |
(defun create-html-site() | |
@@ -302,13 +309,20 @@ | |
(loop for tag in (articles-by-tag) do | |
(generate (format nil "output/html/tag-~d.html" (getf tag :NAME)) | |
(generate-tag-mainpage (getf tag :VALUE)))) | |
- | |
+ | |
+ ;; generate rss gopher in html folder if gopher is t | |
+ (when (getf *config* :gopher) | |
+ (save-file "output/html/rss-gopher.xml" (generate-rss :gopher t))) | |
+ | |
;;(generate-file-rss) | |
(save-file "output/html/rss.xml" (generate-rss))) | |
;; we do all the gopher hole | |
(defun create-gopher-hole() | |
+ ;;(generate-file-rss) | |
+ (save-file "output/gopher/rss.xml" (generate-rss :gopher t)) | |
+ | |
;; produce the gophermap file | |
(save-file (concatenate 'string "output/gopher/" (getf *config* :gopher-inde… | |
(let ((output (load-file "templates/gopher_head.tpl"))) | |
@@ -340,9 +354,7 @@ | |
(with-converter | |
(let ((id (article-id article))) | |
(save-file (format nil "output/gopher/article-~d.txt" id) | |
- (load-file (format nil "data/~d~d" id (converter-extensi… | |
- | |
- ) | |
+ (load-file (format nil "data/~d~d" id (converter-extensi… | |
;; This is function called when running the tool | |
diff --git a/templates/gopher_head.tpl b/templates/gopher_head.tpl | |
@@ -1,5 +1,7 @@ | |
Hello, this is the head of your gophermap page, you can | |
customize it how you want ! | |
+[0|RSS Feed|/~me/rss.xml|server|port] | |
+ | |
----------------------------------------------------------------- | |
diff --git a/templates/layout.tpl b/templates/layout.tpl | |
@@ -7,6 +7,7 @@ | |
<title>%%Title%%</title> | |
<link rel="stylesheet" type="text/css" href="static/css/style.css" media="… | |
<link rel="alternate" type="application/rss+xml" title="%%Title%% RSS Feed… | |
+ <link rel="alternate" type="application/rss+xml" title="%%Title%% RSS Feed… | |
<!-- <link rel="alternate" type="application/atom+xml" title="%%Title%% Ato… | |
<link rel="icon" type="image/x-icon" href="static/img/clyagFav.ico" /> | |
</head> |