Added configuration for diff2html
This commit is contained in:
+29
-1
@@ -1,4 +1,32 @@
|
||||
#lang racket/base
|
||||
|
||||
(provide config)
|
||||
(require net/url)
|
||||
|
||||
(provide input-prompt
|
||||
valid-http-or-file-url?
|
||||
)
|
||||
|
||||
(define (input-prompt p #:loop-until [until (λ (x) x)])
|
||||
(let loop ()
|
||||
(display p)
|
||||
(flush-output)
|
||||
(let ((inp (read-line)))
|
||||
(let ((i (until inp)))
|
||||
(if i
|
||||
i
|
||||
(loop)))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
(define (valid-http-or-file-url? value)
|
||||
(if (not (string? value))
|
||||
#f
|
||||
(with-handlers ([exn:fail? (λ (exn) #f)])
|
||||
(let ((url (string->url value)))
|
||||
(and
|
||||
(member (url-scheme url) '("http" "https" "file"))
|
||||
(string? (url-host url))
|
||||
(not (string=? (url-host url) "")))))))
|
||||
Reference in New Issue
Block a user