From 9934cc80b087ce9b71a87baaa77068fbd23445ce Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 27 Mar 2016 11:59:14 -0400 Subject: First commit! The wonderful beginnings of a new blog powered by Haunt! --- skribe-utils.scm | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 skribe-utils.scm (limited to 'skribe-utils.scm') 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))))) -- cgit v1.2.3