(define (linkify str) (irregex-fold '(seq "http://" (+ (~ space))) (lambda (i m sxml) (let ((text (substring str i (irregex-match-start-index m 0))) (link (irregex-match-substring m 0))) (cons (list text `(a (@ (href ,link)) ,link)) sxml))) '() str (lambda (i sxml) (let ((tail (substring str i (string-length str)))) (reverse (cons tail sxml)))))) ;; (output-xml (linkify "Some text with http://example.com/ embedded http://call-cc.org/ URIs.") ;; (list universal-conversion-rules)) ;; Some <em>text</em> with http://example.com/ embedded http://call-cc.org/ URIs.