X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=mudsync%2Fscrubl.scm;h=eca66056b408e591be7212f15af2c1791b84a7cf;hb=HEAD;hp=2fdd9227b71013309d264b532ee906524df46e19;hpb=bf6886fe1fb0d7128fd031c92ebeb3c8d4b9addd;p=mudsync.git diff --git a/mudsync/scrubl.scm b/mudsync/scrubl.scm index 2fdd922..eca6605 100644 --- a/mudsync/scrubl.scm +++ b/mudsync/scrubl.scm @@ -1,5 +1,5 @@ ;;; Mudsync --- Live hackable MUD -;;; Copyright © 2017 Christopher Allan Webber +;;; Copyright © 2017 Christine Lemmer-Webber ;;; ;;; This file is part of Mudsync. ;;; @@ -33,6 +33,7 @@ #: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 @@ -130,10 +131,22 @@ Pass in optional extra ARGS to the main META-WRITE" (scrubl-write-obj scrubl arg)) args)))) -(define (scrubl-pre scrubl 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)) @@ -142,7 +155,9 @@ Pass in optional extra ARGS to the main META-WRITE" (em . ,(scrubl-sxml-simple-field 'em)) (i . ,(scrubl-sxml-simple-field 'em)) (br . ,(scrubl-sxml-simple-field 'br)) - (pre . ,scrubl-pre) ;; "pre" style whitespace handling. + (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))