From 7b13f228359353f0c441f8267c99bb87ea49bedc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org> Date: Mon, 12 Jun 2017 11:12:27 +0200 Subject: [PATCH] Move URL helpers to (guix-hpc). * haunt.scm (base-url, image-url, css-url, post-url): Move to... * guix-hpc.scm: ... here. --- guix-hpc.scm | 22 +++++++++++++++++++++- haunt.scm | 13 ------------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/guix-hpc.scm b/guix-hpc.scm index 7d8ccaf..920373e 100644 --- a/guix-hpc.scm +++ b/guix-hpc.scm @@ -5,11 +5,31 @@ (define-module (guix-hpc) #:use-module (haunt page) + #:use-module (haunt site) #:use-module (sxml simple) #:use-module (haunt reader) #:use-module (haunt reader commonmark) - #:export (static-pages)) + #:export (base-url + image-url + css-url + post-url + static-pages)) + +(define (base-url . location) + (string-concatenate (cons "" location))) + +(define (image-url location) + (base-url "static/images" location)) + +(define (css-url location) + (base-url "static/css" location)) + +(define (post-url post site) + "Return the URL of POST, a Haunt blog post, for SITE." + (base-url (site-post-slug site post) ".html")) + + (define %cwd (and=> (assq-ref (current-source-location) 'filename) dirname)) diff --git a/haunt.scm b/haunt.scm index 26f3169..7ba578e 100644 --- a/haunt.scm +++ b/haunt.scm @@ -21,19 +21,6 @@ (srfi srfi-19) (guix-hpc)) -(define (base-url . location) - (string-concatenate (cons "" location))) - -(define (image-url location) - (base-url "static/images" location)) - -(define (css-url location) - (base-url "static/css" location)) - -(define (post-url post site) - "Return the URL of POST, a Haunt blog post, for SITE." - (base-url (site-post-slug site post) ".html")) - (define (base-layout body) `((doctype "html") (html (@ (lang "en")) -- GitLab