Subject: [PATCH] website: Switch deprecated Haunt page objects to Haunt artifacts.
From: [email-masked]
To: [email-masked]
Cc: Luis Felipe <[email-masked]>
Date: Mon, 1 Jan 2024 16:39:37 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

From: Luis Felipe <[email-masked]>

* website/apps/base/builder.scm (builder): Return a list of <artifact>s.
* website/apps/base/utils.scm (paginate): Likewise.
* website/apps/blog/builder.scm (builder): Likewise.
* website/apps/download/builder.scm (builder): Likewise.
* website/apps/media/builder.scm (builder): Likewise.
---
 website/apps/base/builder.scm     | 31 +++++++++++++++----------------
 website/apps/base/utils.scm       | 10 +++++-----
 website/apps/blog/builder.scm     | 27 ++++++++++++++-------------
 website/apps/download/builder.scm | 16 ++++++++++------
 website/apps/media/builder.scm    | 24 +++++++++++-------------
 5 files changed, 55 insertions(+), 53 deletions(-)

diff --git a/website/apps/base/builder.scm b/website/apps/base/builder.scm
index 492dc6b..8dd2108 100644
--- a/website/apps/base/builder.scm
+++ b/website/apps/base/builder.scm
@@ -18,9 +18,8 @@
   #:use-module (apps base types)
   #:use-module (apps blog utils)
   #:use-module (apps media data)
+  #:use-module (haunt artifact)
   #:use-module (haunt html)
-  #:use-module (haunt page)
-  #:use-module (haunt post)
   #:use-module (haunt utils)
   #:use-module (srfi srfi-1)
   #:export (builder))
@@ -43,9 +42,9 @@
      A list of post objects that represent articles from the blog. See
      Haunt <post> objects for more information.
 
-   RETURN (list of <page>)
-     A list of page objects that represent the web resources of the
-     application. See Haunt <page> objects for more information."
+   RETURN (list of <artifact>)
+     A list of artifacts that represent the web resources of the
+     application. See Haunt <artifact> type for more information."
   (flatten
    (list (menu-builder)
          (home-builder site posts)
@@ -67,40 +66,40 @@
 
 (define (about-builder)
   "Return a Haunt page representing the About page of the website."
-  (make-page "about/index.html" (about-t) sxml->html))
+  (serialized-artifact "about/index.html" (about-t) sxml->html))

 (define (contact-builder)
   "Return a Haunt page representing the Contact page of the website."
   (let ((context (list (cons "contact-media" contact-media))))
-    (make-page "contact/index.html" (contact-t context) sxml->html)))
+    (serialized-artifact "contact/index.html" (contact-t context) sxml->html)))

 (define (irc-builder)
   "Return a Haunt page with an embedded Kiwi IRC widget."
-  (make-page "contact/irc/index.html" (irc-t) sxml->html))
+  (serialized-artifact "contact/irc/index.html" (irc-t) sxml->html))

 (define (contribute-builder)
   "Return a Haunt page representing the Contribute page of the website."
-  (make-page "contribute/index.html" (contribute-t) sxml->html))
+  (serialized-artifact "contribute/index.html" (contribute-t) sxml->html))
 
 (define (cuirass-builder)
   "Return a Haunt page representing the Cuirass page of the website."
-  (make-page "cuirass/index.html" (cuirass-t) sxml->html))
+  (serialized-artifact "cuirass/index.html" (cuirass-t) sxml->html))
 
 (define (donate-builder)
   "Return a Haunt page representing the Donate page of the website."
-  (make-page "donate/index.html" (donate-t) sxml->html))
+  (serialized-artifact "donate/index.html" (donate-t) sxml->html))
 
 (define (graphics-builder)
   "Return a Haunt page representing the Graphics page of the website."
-  (make-page "graphics/index.html" (graphics-t) sxml->html))
+  (serialized-artifact "graphics/index.html" (graphics-t) sxml->html))

 (define (help-builder)
   "Return a Haunt page representing the Help page of the website."
-  (make-page "help/index.html" (help-t) sxml->html))
+  (serialized-artifact "help/index.html" (help-t) sxml->html))

 (define (home-builder site posts)
@@ -111,14 +110,14 @@
 	  (cons "posts" (posts/latest posts 3))
           (cons "contact-media" (list-head contact-media 3))
           (cons "videos" (take (reverse videos) 4)))))
-    (make-page "guix.html" (home-t context) sxml->html)))
+    (serialized-artifact "guix.html" (home-t context) sxml->html)))

 (define (menu-builder)
   "Return a Haunt page representing the website menu."
-  (make-page "menu/index.html" (menu-t) sxml->html))
+  (serialized-artifact "menu/index.html" (menu-t) sxml->html))

 (define (security-builder)
   "Return a Haunt page representing the Security page of the website."
-  (make-page "security/index.html" (security-t) sxml->html))
+  (serialized-artifact "security/index.html" (security-t) sxml->html))
diff --git a/website/apps/base/utils.scm b/website/apps/base/utils.scm
index 2762a8d..a45fad1 100644
--- a/website/apps/base/utils.scm
+++ b/website/apps/base/utils.scm
@@ -27,7 +27,7 @@
   #:use-module (apps aux system)
   #:use-module (apps base types)
   #:use-module (apps i18n)
-  #:use-module (haunt page)
+  #:use-module (haunt artifact)
   #:use-module (ice-9 i18n)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
@@ -239,8 +239,8 @@ manual.
      A procedure that writes the page into a given format. See Haunt's
      'sxml->html' writer in the (haunt html) module, for example.
 
-   RETURN VALUE (list)
-     A list of <page> objects as defined in (haunt page) module."
+   RETURN VALUE (list of <artifact>)
+     A list of artifacts as defined in (haunt artifact) module."
   (let* ((grouped-data (list-group dataset limit))
 	 (total-pages (cons "total-pages" (length grouped-data))))
     ;; Read the following like (cons Page ListOfPages):
@@ -261,7 +261,7 @@ manual.
 	     (append context
 		     (list items page-number total-pages))))
 
-       (make-page path (template new-context) writer))
+       (serialized-artifact path (template new-context) writer))
      ;; ListOfPages
      ;; This is a list of pages that are the actual ordered pages
      ;; located in paths such as /blog/page/NUMBER/.
@@ -275,6 +275,6 @@ manual.
 	       (items (cons "items" (list-ref grouped-data index)))
 	       (new-context
 		(append context (list items page-number total-pages))))
-	  (make-page path (template new-context) writer)))
+	  (serialized-artifact path (template new-context) writer)))
 
       (iota (length grouped-data))))))
diff --git a/website/apps/blog/builder.scm b/website/apps/blog/builder.scm
index 7293401..eba92e6 100644
--- a/website/apps/blog/builder.scm
+++ b/website/apps/blog/builder.scm
@@ -12,7 +12,7 @@
   #:use-module (apps blog templates tag)
   #:use-module (apps blog utils)
   #:use-module (haunt html)
-  #:use-module (haunt page)
+  #:use-module (haunt artifact)
   #:use-module (haunt post)
   #:use-module (haunt site)
   #:use-module (haunt utils)
@@ -37,9 +37,9 @@
      A list of post objects that represent articles from the blog. See
      Haunt <post> objects for more information.
 
-   RETURN (list of <page>)
-     A list of page objects that represent the web resources of the
-     application. See Haunt <page> objects for more information."
+   RETURN (list of <artifact>)
+     A list of artifacts that represent the web resources of the
+     application. See Haunt <artifact> type for more information."
   (flatten
    (list
     (blog-feed-builder site posts)
@@ -75,9 +75,9 @@
 		 (if (> (length sorted-posts) max-posts)
 		     (list-head sorted-posts max-posts)
 		     sorted-posts)))))
-    (make-page (path-join "feeds" "blog.atom")
-	       (atom-feed-t context)
-	       sxml->xml*)))
+    (serialized-artifact (path-join "feeds" "blog.atom")
+	                 (atom-feed-t context)
+	                 sxml->xml*)))

 (define (post-list-builder posts)
@@ -98,9 +98,10 @@
   (map
    (lambda (post)
      (let ((context (list (cons "post" post))))
-       (make-page (path-join (post-url-path post) "index.html")
-		  (post-t context)
-		  sxml->html)))
+       (serialized-artifact
+        (path-join (post-url-path post) "index.html")
+	(post-t context)
+	sxml->html)))
    posts))

@@ -129,9 +130,9 @@
 						 ""))
 		(cons "posts"
 		      (posts/reverse-chronological (cdr tagged-posts))))))
-	 (make-page (path-join "feeds" "blog" file-name)
-		    (atom-feed-t context)
-		    sxml->xml)))
+	 (serialized-artifact (path-join "feeds" "blog" file-name)
+		              (atom-feed-t context)
+		              sxml->xml)))
      post-groups)))

diff --git a/website/apps/download/builder.scm b/website/apps/download/builder.scm
index cc983c5..986b6ef 100644
--- a/website/apps/download/builder.scm
+++ b/website/apps/download/builder.scm
@@ -7,7 +7,7 @@
   #:use-module (apps download templates download-latest)
   #:use-module (apps download data)
   #:use-module (haunt html)
-  #:use-module (haunt page)
+  #:use-module (haunt artifact)
   #:export (builder))

@@ -28,9 +28,9 @@
      A list of post objects that represent articles from the blog. See
      Haunt <post> objects for more information.
 
-   RETURN (list of <page>)
-     A list of page objects that represent the web resources of the
-     application. See Haunt <page> objects for more information."
+   RETURN (list of <artifact>)
+     A list of artifacts that represent the web resources of the
+     application. See Haunt <artifact> type for more information."
   (list (download-builder)
         (download-latest-builder)))
 
@@ -40,11 +40,15 @@
 ;;; Helper builders.
 ;;;
 (define (download-latest-builder)
-  (make-page "download/latest/index.html" (download-latest-t) sxml->html))
+  (serialized-artifact "download/latest/index.html"
+                       (download-latest-t)
+                       sxml->html))
 
 (define (download-builder)
   "Return a Haunt page representing the Download page of the website."
   (let ((context
 	 (list
 	  (cons "downloads" system-downloads))))
-    (make-page "download/index.html" (download-t context) sxml->html)))
+    (serialized-artifact "download/index.html"
+                         (download-t context)
+                         sxml->html)))
diff --git a/website/apps/media/builder.scm b/website/apps/media/builder.scm
index 7630713..9948c73 100644
--- a/website/apps/media/builder.scm
+++ b/website/apps/media/builder.scm
@@ -15,7 +15,6 @@
   #:use-module (apps media types)
   #:use-module (haunt artifact)
   #:use-module (haunt html)
-  #:use-module (haunt page)
   #:use-module (haunt utils)
   #:use-module (apps aux web)
   #:use-module (apps media utils)
@@ -40,10 +39,9 @@
      A list of post objects that represent articles from the blog. See
      Haunt <post> objects for more information.
 
-   RETURN (list of <artifact> and <page>)
-     A list of objects that represent the web resources of the
-     application. See Haunt <artifact> and <page> objects for more
-     information."
+   RETURN (list of <artifact>)
+     A list of artifacts that represent the web resources of the
+     application. See Haunt <artifact> type for more information."
   (flatten
    (list (publication-list-builder)
          (screenshots-overview-builder)
@@ -70,19 +68,19 @@
      (let ((context
             (list (cons "screenshot" shot)
                   (cons "screenshots" screenshots))))
-       (make-page (path-join "screenshots"
-                             (screenshot-slug shot)
-                             "index.html")
-                  (screenshot-t context)
-                  sxml->html)))
+       (serialized-artifact (path-join "screenshots"
+                                       (screenshot-slug shot)
+                                       "index.html")
+                            (screenshot-t context)
+                            sxml->html)))
    screenshots))

 (define (screenshots-overview-builder)
   "Return a Haunt page representing the screenshots overview page."
-  (make-page "screenshots/index.html"
-             (screenshots-overview-t screenshots)
-             sxml->html))
+  (serialized-artifact "screenshots/index.html"
+                       (screenshots-overview-t screenshots)
+                       sxml->html))
 
 (define (videos-builder)
   "Return a list whose elements can be single Haunt artifacts or lists

base-commit: b22555c98e2f2f911a61c1babdf883887c386065
-- 
2.41.0