From 65e44be26113b48ed4ea01bb38a415eba6e30685 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Mon, 26 Dec 2011 13:29:37 -0500 Subject: [PATCH] Make a `resource' struct so it is identifiable. (Also, change a `define-struct' to a `struct'.) original commit: 787f3151de5f803fa5b54e6a4d4d2219c72d0b4c --- collects/scribble/html/resource.rkt | 7 +++++-- collects/scribble/html/xml.rkt | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/collects/scribble/html/resource.rkt b/collects/scribble/html/resource.rkt index 582fe607..9e6f54ed 100644 --- a/collects/scribble/html/resource.rkt +++ b/collects/scribble/html/resource.rkt @@ -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 diff --git a/collects/scribble/html/xml.rkt b/collects/scribble/html/xml.rkt index f9df7dc2..b41d93c5 100644 --- a/collects/scribble/html/xml.rkt +++ b/collects/scribble/html/xml.rkt @@ -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)