git.fiddlerwoaroof.com
Browse code

chore: reformat

Edward Langley authored on 23/10/2022 22:40:47
Showing 4 changed files
... ...
@@ -99,26 +99,27 @@
99 99
           (doc-icon (get-feed-elem "feed > icon"))
100 100
           (doc-logo (get-feed-elem "feed > logo"))
101 101
           (doc-id (get-feed-elem "feed > id"))
102
-          (doc-updated (awhen (get-feed-elem "feed > updated") (local-time:parse-timestring it)))
102
+          (doc-updated (awhen (get-feed-elem "feed > updated")
103
+                         (local-time:parse-timestring it)))
103 104
           (doc-link (get-feed-elem-attr "feed > link[rel=alternate]" "href"))
104 105
           (doc-feed-link (or feed-link (get-feed-elem-attr "feed > link[rel=self]" "href")))
105 106
           (doc-categories ($ (inline xml-dom) "feed > category"
106
-                             (combine (attr "term") (attr "label") (attr "scheme"))
107
-                             (map-apply #'make-category)))
107
+                            (combine (attr "term") (attr "label") (attr "scheme"))
108
+                            (map-apply #'make-category)))
108 109
           (doc-authors (get-authors xml-dom)))
109 110
       (make-instance 'atom-feed
110
-        :title doc-title
111
-        :description doc-summary
112
-        :icon doc-icon
113
-        :logo doc-logo
114
-        :link doc-link
115
-        :updated doc-updated
116
-        :id doc-id
117
-        :feed-link doc-feed-link
118
-        :subtitle doc-subtitle
119
-        :categories (coerce doc-categories 'list)
120
-        :authors doc-authors
121
-        ))))
111
+                     :title doc-title
112
+                     :description doc-summary
113
+                     :icon doc-icon
114
+                     :logo doc-logo
115
+                     :link doc-link
116
+                     :updated doc-updated
117
+                     :id doc-id
118
+                     :feed-link doc-feed-link
119
+                     :subtitle doc-subtitle
120
+                     :categories (coerce doc-categories 'list)
121
+                     :authors doc-authors
122
+                     ))))
122 123
 ;}}}
123 124
 
124 125
 (defmacro defconstants (&body constants)
... ...
@@ -25,18 +25,18 @@
25 25
 
26 26
 (defmethod format-document (formatter stream (document alimenta::feed-entity))
27 27
   (format stream "~&~v,4@t~a~%~v,4@t~a~%"
28
-	  (level formatter) (format-title formatter (alimenta:title document))
29
-	  (level formatter) (format-link formatter (alimenta:link document))))
28
+          (level formatter) (format-title formatter (alimenta:title document))
29
+          (level formatter) (format-link formatter (alimenta:link document))))
30 30
 
31 31
 (defmethod format-document (formatter stream (document alimenta:item))
32 32
   (call-next-method)
33 33
   (let ((paragraphs (remove-if (op (every #'whitespacep _))
34
-			       (lquery:$ (initialize (alimenta:content document))
35
-					 (children)
36
-					 (text)))))
34
+                               (lquery:$ (initialize (alimenta:content document))
35
+                                 (children)
36
+                                 (text)))))
37 37
     (format stream "~&~{~a~%~}~2&"
38
-	    (map 'list (op (format-paragraph formatter _))
39
-		 paragraphs))))
38
+            (map 'list (op (format-paragraph formatter _))
39
+                 paragraphs))))
40 40
 
41 41
 
42 42
 ;;; Define some output formats
... ...
@@ -80,15 +80,15 @@
80 80
 (defmethod format-document ((formatter html-formatter) stream (document alimenta:feed))
81 81
   (let ((ostream (or stream (make-string-output-stream))))
82 82
     (unwind-protect
83
-	 (progn (format ostream "~&<html><head><style>main{max-width:40em;margin-left:20em}h1,h2{margin-left:-3em}</style></head><body><main>~%")
84
-		(call-next-method formatter ostream document)
85
-		(incf (level formatter))
86
-		(for:for ((item over document))
87
-		  (format ostream "~&<article>~%")
88
-		  (format-document formatter ostream item)
89
-		  (format ostream "~&</article>~%"))
90
-		(format ostream "~&</main></body></html>~%")
91
-		(finish-output ostream)
92
-		(get-output-stream-string ostream))
83
+         (progn (format ostream "~&<html><head><style>main{max-width:40em;margin-left:20em}h1,h2{margin-left:-3em}</style></head><body><main>~%")
84
+                (call-next-method formatter ostream document)
85
+                (incf (level formatter))
86
+                (for:for ((item over document))
87
+                  (format ostream "~&<article>~%")
88
+                  (format-document formatter ostream item)
89
+                  (format ostream "~&</article>~%"))
90
+		            (format ostream "~&</main></body></html>~%")
91
+		            (finish-output ostream)
92
+		            (get-output-stream-string ostream))
93 93
       (unless stream
94
-	(close ostream)))))
94
+	      (close ostream)))))
... ...
@@ -10,9 +10,9 @@
10 10
                        (:doc . doc))))
11 11
     (let* ((val-sym (gensym "VAL"))
12 12
            (binders (loop for (key binding) on args by #'cddr
13
-                       for accessor = (cdr (assoc key key->reader))
14
-                       when accessor append
15
-                         `((,binding (,accessor ,val-sym))))))
13
+                          for accessor = (cdr (assoc key key->reader))
14
+                          when accessor append
15
+                            `((,binding (,accessor ,val-sym))))))
16 16
       `((,val-sym ,form)
17 17
         ,@binders))))
18 18
 
... ...
@@ -43,4 +43,3 @@
43 43
                          `((,binding (,accessor ,val-sym))))))
44 44
       `((,val-sym ,form)
45 45
         ,@binders))))
46
-
... ...
@@ -87,23 +87,23 @@
87 87
 (defun get-date (str)
88 88
   (declare (optimize (debug 3)))
89 89
   (handler-case
90
-    (local-time:parse-timestring str)
90
+      (local-time:parse-timestring str)
91 91
     (local-time::invalid-timestring (c) (declare (ignore c))
92 92
       (multiple-value-bind (local-time:*default-timezone* timestamp-raw) (extract-date-timezone str)
93 93
         (multiple-value-bind (res groups) (cl-ppcre:scan-to-strings "(.*)\s*([+-][0-9]{2,4})\s?$" timestamp-raw)
94 94
           (let ((ts (if res (elt groups 0) timestamp-raw))
95 95
                 (tz-offset (if res (elt groups 1) "0000")))
96 96
             (let* ((timestamp (string-trim " " ts))
97
-                   ; Handle numeric timzones like -0430 or +0320
97
+                   ;; Handle numeric timzones like -0430 or +0320
98 98
                    (hour-offset (parse-integer tz-offset :end 3))
99 99
                    (minute-offset (if (> (length tz-offset) 3)
100
-                                    (* (signum hour-offset)
101
-                                       (parse-integer tz-offset :start 3))
102
-                                    0)))
100
+                                      (* (signum hour-offset)
101
+                                         (parse-integer tz-offset :start 3))
102
+                                      0)))
103 103
 
104 104
               (loop
105 105
                 (restart-case (return
106
-                                (let-each (:be *)
106
+                                (fw.lu:let-each (:be *)
107 107
                                   (chronicity:parse timestamp)
108 108
                                   (local-time:timestamp- * minute-offset :minute)
109 109
                                   (local-time:timestamp- * hour-offset   :hour)))