commit bb408a644f7257ca6db1be3d7ff751ff68a6f1e0
parent fd4de66c02baeef18a04017cc8e98674bfe03ed0
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Mon, 17 Dec 2007 18:39:07 +0000
added xref-tag->index-entry
svn: r8038
original commit: 233416bf27603adceef9c1baa884dd5c83056173
Diffstat:
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/collects/scribble/xref.ss b/collects/scribble/xref.ss
@@ -16,6 +16,7 @@
xref-index
xref-binding->definition-tag
xref-tag->path+anchor
+ xref-tag->index-entry
(struct-out entry))
(define-struct entry (words ; list of strings: main term, sub-term, etc.
@@ -117,3 +118,18 @@
(let ([renderer (new render%
[dest-dir (find-system-path 'temp-dir)])])
(send renderer tag->path+anchor (xrefs-ri xrefs) tag)))
+
+(define (xref-tag->index-entry xrefs tag)
+ (let ([v (hash-table-get (collect-info-ext-ht (resolve-info-ci (xrefs-ri xrefs)))
+ `(index-entry ,tag)
+ #f)])
+ (cond
+ [v (make-entry (car v)
+ (cadr v)
+ (cadr tag)
+ (caddr v))]
+ [(and (pair? tag) (eq? 'form (car tag)))
+ ;; Try again with 'def:
+ (xref-tag->index-entry xrefs (cons 'def (cdr tag)))]
+ [else #f])))
+
diff --git a/collects/scribblings/scribble/xref.scrbl b/collects/scribblings/scribble/xref.scrbl
@@ -70,6 +70,16 @@ The optional @scheme[using-render%] argument is as for
@scheme[load-xref].}
+@defproc[(xref-tag->index-entry [xref xref?]
+ [tag tag?])
+ (or/c false/c entry?)]{
+
+Extract an @scheme[entry] structure that provides addition information
+about the definition (of any) referenced by @scheme[tag]. This
+function can be composed with @scheme[xref-binding->definition-tag] to
+obtain information about a binding, such as the library that exports
+the binding and its original name.}
+
@defproc[(xref-render [xref xref?]
[doc part?]