commit bfd881ce7fd319fe2ca41c130661f07ae9a86aa1
parent e8dc197a92cd10969c67a68eafbf590b0f742ccb
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Sun, 19 Aug 2007 02:43:51 +0000
in GUI docs, show inherited methods
svn: r7119
original commit: 44d1c03d685aefced364362cc0fe28ca6cf34148
Diffstat:
5 files changed, 79 insertions(+), 3 deletions(-)
diff --git a/collects/scribble/base-render.ss b/collects/scribble/base-render.ss
@@ -203,7 +203,9 @@
(define/public (render-flow-element p part ht)
(cond
- [(table? p) (render-table p part ht)]
+ [(table? p) (if (auxiliary-table? p)
+ (render-auxiliary-table p part ht)
+ (render-table p part ht))]
[(itemization? p) (render-itemization p part ht)]
[(blockquote? p) (render-blockquote p part ht)]
[(delayed-flow-element? p) (render-flow-element
@@ -211,6 +213,9 @@
part ht)]
[else (render-paragraph p part ht)]))
+ (define/public (render-auxiliary-table i part ht)
+ null)
+
(define/public (render-table i part ht)
(map (lambda (d) (if (flow? i)
(render-flow d part ht)
diff --git a/collects/scribble/html-render.ss b/collects/scribble/html-render.ss
@@ -212,7 +212,11 @@
,@(if (part? p)
(render-content (part-title-content p) d ht)
(render-content (element-content p) d ht)))))))
- ps)))))))))))
+ ps)))))))
+ ,@(apply append
+ (map (lambda (t)
+ (render-table t d ht))
+ (filter auxiliary-table? (flow-paragraphs (part-flow d)))))))))
(define/public (render-one-part d ht fn number)
(parameterize ([current-output-file fn])
diff --git a/collects/scribble/manual.ss b/collects/scribble/manual.ss
@@ -1265,6 +1265,49 @@
[(_ object%) #'#f]
[(_ id) (class-id->class-doc-info-id #'id)]))
+ (define (collect-inherited supers ht)
+ (let* ([supers (let loop ([supers supers][accum null])
+ (cond
+ [(null? supers) (reverse accum)]
+ [(memq (car supers) accum)
+ (loop (cdr supers) accum)]
+ [else
+ (let ([super (car supers)])
+ (loop (append (reverse (decl-intfs super))
+ (if (decl-super super)
+ (list (decl-super super))
+ null)
+ (cdr supers))
+ (cons super accum)))]))]
+ [inh (apply
+ append
+ (map (lambda (super)
+ (let ([inh (filter
+ values
+ (hash-table-map
+ (decl-methods super)
+ (lambda (k v)
+ (let ([v (hash-table-get ht k)])
+ (and (eq? (car v) (decl-name super))
+ (cons (symbol->string k)
+ (*method k (car v))))))))])
+ (if (null? inh)
+ null
+ (cons
+ (make-element #f (list (make-element "inheritedlbl" '("from "))
+ (to-element (decl-name super))))
+ (map cdr (sort inh
+ (lambda (a b)
+ (string<? (car a) (car b)))))))))
+ supers))])
+ (if (null? inh)
+ null
+ (list (make-auxiliary-table
+ "inherited"
+ (map (lambda (i)
+ (list (make-flow (list (make-paragraph (list i))))))
+ (cons (make-element "inheritedlbl" '("Inherited methods:")) inh)))))))
+
(define (register-class name super intfs mk-head body)
(let ([ht (make-hash-table)])
(when super
@@ -1280,7 +1323,13 @@
(when (meth? i)
(hash-table-put! ht (meth-name i) (cons name i))))
body)
- (make-decl name super intfs mk-head body ht)))
+ (make-decl name super intfs mk-head
+ (append body
+ (collect-inherited (append
+ (if super (list super) null)
+ intfs)
+ ht))
+ ht)))
(define (*include-class decl)
(make-splice
diff --git a/collects/scribble/scribble.css b/collects/scribble/scribble.css
@@ -118,6 +118,23 @@
font-weight: bold;
}
+ .inherited {
+ margin-top: 1em;
+ text-align: left;
+ background-color: #ECF5F5;
+ }
+
+ .inherited td {
+ padding-left: 1em;
+ text-indent: -0.8em;
+ padding-right: 0.2em;
+ }
+
+ .inheritedlbl {
+ font-style: italic;
+ font-size: 85%;
+ }
+
.indexlink {
text-decoration: none;
}
diff --git a/collects/scribble/struct.ss b/collects/scribble/struct.ss
@@ -65,6 +65,7 @@
[(styled-paragraph paragraph) ([style any/c])]
[table ([style any/c]
[flowss (listof (listof (or/c flow? (one-of/c 'cont))))])]
+ [(auxiliary-table table) ()]
[delayed-flow-element ([render (any/c part? any/c . -> . flow-element?)])]
[itemization ([flows (listof flow?)])]
[blockquote ([style any/c]