wf-validate: begin url rebasing work
This commit is contained in:
parent
76257114b7
commit
6fe6297b5c
|
@ -3,9 +3,13 @@
|
||||||
|
|
||||||
(require json
|
(require json
|
||||||
racket/list
|
racket/list
|
||||||
|
racket/match
|
||||||
racket/port
|
racket/port
|
||||||
racket/pretty)
|
racket/pretty)
|
||||||
|
|
||||||
|
(define link-base (make-parameter #f))
|
||||||
|
(define embed-base (make-parameter #f))
|
||||||
|
|
||||||
(define current-header (make-parameter #f))
|
(define current-header (make-parameter #f))
|
||||||
|
|
||||||
(define (check-block blk)
|
(define (check-block blk)
|
||||||
|
@ -29,11 +33,27 @@
|
||||||
(check-block thing))
|
(check-block thing))
|
||||||
(for-each check-any (hash-values thing))))
|
(for-each check-any (hash-values thing))))
|
||||||
|
|
||||||
|
(define (hash-ref* table keys)
|
||||||
|
(match keys
|
||||||
|
['() table]
|
||||||
|
[(cons key rst) (hash-ref* (hash-ref table key #f) rst)]))
|
||||||
|
|
||||||
(define (check-ast doc-ast)
|
(define (check-ast doc-ast)
|
||||||
|
(link-base (hash-ref* doc-ast '(meta wf-link-base c)))
|
||||||
|
(embed-base (hash-ref* doc-ast '(meta wf-embed-base c)))
|
||||||
(check-any (hash-ref doc-ast 'blocks)))
|
(check-any (hash-ref doc-ast 'blocks)))
|
||||||
|
|
||||||
|
(define (transform-ast doc-ast)
|
||||||
|
;; todo
|
||||||
|
doc-ast)
|
||||||
|
|
||||||
(module+ main
|
(module+ main
|
||||||
(define doc-ast (read-json))
|
(require racket/cmdline)
|
||||||
(current-header "<top level>")
|
|
||||||
(check-ast doc-ast)
|
(command-line
|
||||||
(write-json doc-ast))
|
#:program "writefreely-validate"
|
||||||
|
#:args (doctype)
|
||||||
|
(define doc-ast (read-json))
|
||||||
|
(current-header "<top level>")
|
||||||
|
(check-ast doc-ast)
|
||||||
|
(write-json (transform-ast doc-ast))))
|
||||||
|
|
Loading…
Reference in New Issue