Make a `resource' struct so it is identifiable.
(Also, change a `define-struct' to a `struct'.) original commit: 787f3151de5f803fa5b54e6a4d4d2219c72d0b4c
This commit is contained in:
parent
73784d91d9
commit
65e44be261
|
@ -164,7 +164,10 @@
|
|||
;; `#:exists' determines what happens when the render destination exists, it
|
||||
;; can be one of: #f (do nothing), 'delete-file (delete if a file exists, error
|
||||
;; if exists as a directory)
|
||||
(provide resource)
|
||||
(provide resource resource?)
|
||||
;; use a struct to make resources identifiable as such
|
||||
(struct resource (url) #:constructor-name make-resource
|
||||
#:property prop:procedure 0 #:omit-define-syntaxes)
|
||||
(define (resource path0 renderer #:exists [exists 'delete-file])
|
||||
(define (bad reason) (error 'resource "bad path, ~a: ~e" reason path0))
|
||||
(unless (string? path0) (bad "must be a string"))
|
||||
|
@ -208,7 +211,7 @@
|
|||
[(#f) (relativize filename dirpathlist (rendered-dirpath))]
|
||||
[(#t) (force absolute-url)]
|
||||
[else (error 'resource "bad absolute flag value: ~e" absolute?)]))
|
||||
url)
|
||||
(make-resource url))
|
||||
|
||||
;; a convenient utility to create renderers from some output function (like
|
||||
;; `output-xml' or `display') and some content
|
||||
|
|
|
@ -78,7 +78,8 @@
|
|||
;; Structs for xml data: elements, literals, entities
|
||||
|
||||
(provide make-element)
|
||||
(define-struct element (tag attrs body [cache #:auto #:mutable])
|
||||
(struct element (tag attrs body [cache #:auto #:mutable])
|
||||
#:constructor-name make-element
|
||||
#:transparent #:omit-define-syntaxes #:auto-value #f
|
||||
#:property prop:procedure
|
||||
(lambda (e)
|
||||
|
|
Loading…
Reference in New Issue
Block a user