diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2023-10-04 14:25:15 +0200 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2023-10-04 14:25:15 +0200 |
commit | 94a68dffff741be5ed45adcb37d453773f13c6fe (patch) | |
tree | 24e43964e86fc56220c8fe2bd964dcbda20d7bb2 /src | |
parent | 20f86d289bdb8cbdc622a500f4b96aff9e87ec45 (diff) |
Make project structure and builder script
Diffstat (limited to 'src')
-rw-r--r-- | src/as.scm | 16 | ||||
-rw-r--r-- | src/as/atom.scm | 12 | ||||
-rw-r--r-- | src/as/html.scm | 11 | ||||
-rw-r--r-- | src/atom.scm | 12 | ||||
-rw-r--r-- | src/dates.scm | 1 | ||||
-rw-r--r-- | src/html.scm | 2 |
6 files changed, 49 insertions, 5 deletions
diff --git a/src/as.scm b/src/as.scm new file mode 100644 index 0000000..b95c096 --- /dev/null +++ b/src/as.scm @@ -0,0 +1,16 @@ +(define-module (src as) + #:export (as) + #:declarative? #f) + +(define (call-in-module thunk module) + (let* ((curmod (current-module)) + (_ (set-current-module (resolve-interface module))) + (v (thunk)) + (_ (set-current-module curmod))) + v)) + +(define (load-with-interface path module-name) + (call-in-module (lambda () (load path)) module-name)) + +(define (as what file) + (load-with-interface file `(src as ,what))) diff --git a/src/as/atom.scm b/src/as/atom.scm new file mode 100644 index 0000000..c1a8424 --- /dev/null +++ b/src/as/atom.scm @@ -0,0 +1,12 @@ +(define-module (src as atom) + #:use-module ((src atom) #:prefix atom:) + #:export (main + post + person + media)) + +(define main atom:feed) +(define post atom:entry) +(define person atom:person) +(define media atom:media) + diff --git a/src/as/html.scm b/src/as/html.scm new file mode 100644 index 0000000..7ea3095 --- /dev/null +++ b/src/as/html.scm @@ -0,0 +1,11 @@ +(define-module (src as html) + #:use-module ((src html) #:prefix html:) + #:export (main + post + person + media)) + +(define main html:index) +(define post html:post) +(define person html:person) +(define media html:media) diff --git a/src/atom.scm b/src/atom.scm index 9f71f00..229c032 100644 --- a/src/atom.scm +++ b/src/atom.scm @@ -74,7 +74,8 @@ (define* (feed #:key (title "") (subtitle "") (uri "") - (entries '())) + (entries '()) + #:allow-other-keys) (let* ((f (make-feed uri title subtitle @@ -95,7 +96,8 @@ (content-html '()) (categories '()) (contributors '()) - (media '())) + (media '()) + #:allow-other-keys) (define (id-from-title title) (string-map (lambda (c) (if (char-set-contains? char-set:letter c) c #\-)) @@ -113,12 +115,14 @@ media)) (define* (person name #:key (email "") - (uri "")) + (uri "") + #:allow-other-keys) (make-person name email uri)) (define* (media path #:key (title "") - (uri "")) + (uri "") + #:allow-other-keys) (define (type path) (let* ((extension (car (last-pair (string-split path #\.)))) (type (assoc-ref mime-types extension))) diff --git a/src/dates.scm b/src/dates.scm index 0e9a075..edbac1c 100644 --- a/src/dates.scm +++ b/src/dates.scm @@ -8,4 +8,3 @@ (define (date->string/RFC3339 date) (date->string date "~4")) - diff --git a/src/html.scm b/src/html.scm new file mode 100644 index 0000000..7d37fbd --- /dev/null +++ b/src/html.scm @@ -0,0 +1,2 @@ +(define-module (src html) + #:use-module (src mime-types)) |