summaryrefslogtreecommitdiff
path: root/skribe-utils.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2016-03-27 11:59:14 -0400
committerDavid Thompson <dthompson2@worcester.edu>2016-03-27 11:59:14 -0400
commit9934cc80b087ce9b71a87baaa77068fbd23445ce (patch)
tree0ad991cec55a7fe492f07e22c03d411fd7229a18 /skribe-utils.scm
First commit!
The wonderful beginnings of a new blog powered by Haunt!
Diffstat (limited to 'skribe-utils.scm')
-rw-r--r--skribe-utils.scm40
1 files changed, 40 insertions, 0 deletions
diff --git a/skribe-utils.scm b/skribe-utils.scm
new file mode 100644
index 0000000..8120853
--- /dev/null
+++ b/skribe-utils.scm
@@ -0,0 +1,40 @@
+(define-module (skribe-utils)
+ #:use-module (ice-9 match)
+ #:use-module (syntax-highlight)
+ #:use-module (syntax-highlight scheme)
+ #:use-module (syntax-highlight xml)
+ #:use-module (syntax-highlight c)
+ #:export (image/caption
+ scheme-source
+ xml-source
+ c-source))
+
+(define (image/caption uri caption)
+ `((img (@ (class "centered rounded")
+ (src ,uri)
+ (alt ,caption)))
+ (div (@ (class "caption")) ,caption)))
+
+(define (scheme-source source)
+ (highlights->sxml
+ (highlight lex-scheme
+ (match source
+ ((source ...)
+ (string-concatenate source))
+ (_ source)))))
+
+(define (xml-source source)
+ (highlights->sxml
+ (highlight lex-xml
+ (match source
+ ((source ...)
+ (string-concatenate source))
+ (_ source)))))
+
+(define (c-source source)
+ (highlights->sxml
+ (highlight lex-c
+ (match source
+ ((source ...)
+ (string-concatenate source))
+ (_ source)))))