;;; Mudsync --- Live hackable MUD
-;;; Copyright © 2017 Christopher Allan Webber <cwebber@dustycloud.org>
+;;; Copyright © 2017 Christine Lemmer-Webber <cwebber@dustycloud.org>
;;;
;;; This file is part of Mudsync.
;;;
#:use-module (ice-9 vlist)
#:use-module (ice-9 vlist)
#:use-module (ice-9 hash-table)
+ #:use-module (web uri)
#:export (make-scrubl
scrubl? scrubl-extend-fields
scrubl-write
(lambda (p)
(sxml->xml
(scrubl-write-obj scrubl obj)
- ;; (list 'pre (scrubl-write-obj scrubl obj))
p))))
(scrubl-write-obj scrubl arg))
args))))
+(define (scrubl-sxml-pre scrubl args)
+ `(span (@ (class "pre-ish"))
+ ,args))
+
+;; @@: For a text-only interface, we could put links at end of rendered
+;; text, similar to how orgmode does.
+(define (scrubl-sxml-anchor scrubl args)
+ (define (maybe-uri->string obj)
+ (if (uri? obj)
+ (uri->string obj)
+ obj))
+ (match args
+ (((= maybe-uri->string href) body1 body ...)
+ `(a (@ (href ,href))
+ ,body1 ,@body))))
+
(define scrubl-sxml
(make-scrubl `((p . ,(scrubl-sxml-simple-field 'p))
(strong . ,(scrubl-sxml-simple-field 'strong))
(b . ,(scrubl-sxml-simple-field 'strong))
(em . ,(scrubl-sxml-simple-field 'em))
(i . ,(scrubl-sxml-simple-field 'em))
- (br . ,(scrubl-sxml-simple-field 'br)) ;; is this useful?
+ (br . ,(scrubl-sxml-simple-field 'br))
+ (anchor . ,scrubl-sxml-anchor)
+ (a . ,scrubl-sxml-anchor)
+ (pre . ,scrubl-sxml-pre) ;; "pre" style whitespace handling.
(ul . ,(scrubl-sxml-simple-field 'ul))
(li . ,(scrubl-sxml-simple-field 'li)))
scrubl-sxml-write))