fixing gopher title - cl-yag - Common Lisp Yet Another website Generator
HTML git clone git://bitreich.org/cl-yag/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/cl-yag/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
DIR LICENSE
---
DIR commit 0beb1a03cf6a8f8aa14c515b74938bddc7b33fbe
DIR parent b0fb013bac0ad806bc90e487b552d3affa7f7413
HTML Author: Solène Rapenne <solene@perso.pw>
Date: Fri, 24 Mar 2017 13:07:52 +0100
fixing gopher title
Diffstat:
M generator.lisp | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
---
DIR diff --git a/generator.lisp b/generator.lisp
@@ -186,16 +186,26 @@
(let ((output (load-file "template/gopher_head.tpl")))
(dolist (article *articles*)
(setf output
- (concatenate 'string output
- (format nil "~a by ~a (~a) ~%0~a /article-~d.txt ~a ~a~%~%"
- (getf article :date)
- (getf article :author (getf *config* :webmaster))
- (format nil "~{#~a ~}" (split-str (getf article :tag)))
- (getf article :title)
- (getf article :id)
- (getf *config* :gopher-server)
- (getf *config* :gopher-port)
- ))))
+ (string
+ (concatenate 'string output
+ (format nil "0~a ~a/article-~d.txt ~a ~a~%~%"
+
+ ;; here we create a 80 width char string with title on the left
+ ;; and date on the right
+ ;; we truncate the article title if it's too large
+ (let ((title (format nil "~80a"
+ (if (< 80 (length (getf article :title)))
+ (subseq (getf article :title) 0 80)
+ (getf article :title)))))
+ (replace title (getf article :date) :start1 (- (length title) (length (getf article :date)))))
+
+
+ (getf *config* :gopher-path)
+ (getf article :id)
+ (getf *config* :gopher-server)
+ (getf *config* :gopher-port)
+ )))))
+
output))
;; produce each article file (only a copy/paste in fact)