changed htdp languages to allow identifier module paths; scribble improvements to latex back-end; added definterface

svn: r13681

original commit: 9927b0b576063d2ee99a2089825098aa9a7e7781
This commit is contained in:
Matthew Flatt 2009-02-16 22:04:51 +00:00
parent 0d96872a1a
commit 1617e8d8ae
7 changed files with 101 additions and 30 deletions

View File

@ -228,14 +228,6 @@
(define/override (render-table t part ri inline-table?)
(let* ([boxed? (eq? 'boxed (table-style t))]
[index? (eq? 'index (table-style t))]
[inline?
(and (not boxed?) (not index?)
(or (null? (table-flowss t))
(= 1 (length (car (table-flowss t)))))
(let ([m (current-table-mode)])
(and m
(equal? "bigtabular" (car m))
(= 1 (length (car (table-flowss (cadr m))))))))]
[tableform
(cond [index? "list"]
[(and (not (current-table-mode)) (not inline-table?))
@ -244,7 +236,21 @@
[opt (cond [(equal? tableform "bigtabular") "[l]"]
[(equal? tableform "tabular") "[t]"]
[else ""])]
[flowss (if index? (cddr (table-flowss t)) (table-flowss t))])
[flowss (if index? (cddr (table-flowss t)) (table-flowss t))]
[row-styles (cdr (or (and (list? (table-style t))
(assoc 'row-styles (table-style t)))
(cons #f (map (lambda (x) #f) flowss))))]
[inline?
(and (not boxed?)
(not index?)
(ormap (lambda (rs) (equal? rs "inferencetop")) row-styles)
(or (null? (table-flowss t))
(= 1 (length (car (table-flowss t)))))
(let ([m (current-table-mode)])
(and m
(equal? "bigtabular" (car m))
(= 1 (length (car (table-flowss (cadr m))))))))]
[boxline "{\\setlength{\\unitlength}{\\linewidth}\\begin{picture}(1,0)\\put(0,0){\\line(1,0){1}}\\end{picture}}"])
(unless (or (null? flowss) (null? (car flowss)))
(parameterize ([current-table-mode
(if inline? (current-table-mode) (list tableform t))]
@ -254,14 +260,7 @@
[index? (printf "\\begin{list}{}{\\parsep=0pt \\itemsep=1pt \\leftmargin=2ex \\itemindent=-2ex}\n")]
[inline? (void)]
[else
(printf "\n\n~a\\begin{~a}~a{@{}~a}\n"
(if boxed?
(format "{~a\\begin{picture}(1,0)\\put(0,0){\\line(1,0){1}}\\end{picture}}~a\n\\nopagebreak\n"
"\\setlength{\\unitlength}{\\linewidth}"
(if (equal? tableform "bigtabular")
"\\bigtabline"
"\n\n"))
"")
(printf "\n\n\\begin{~a}~a{@{}~a}\n~a"
tableform
opt
(string-append*
@ -276,12 +275,16 @@
(assoc 'alignment
(or (table-style t) null)))
(cons #f (map (lambda (x) #f)
(car flowss))))))))])
(car flowss)))))))
(if boxed?
(if (equal? tableform "bigtabular")
(format "~a \\endfirsthead\n" boxline)
(format "\\multicolumn{~a}{@{}l@{}}{~a} \\\\\n"
(length (car flowss))
boxline))
""))])
(let loop ([flowss flowss]
[row-styles
(cdr (or (and (list? (table-style t))
(assoc 'row-styles (table-style t)))
(cons #f (map (lambda (x) #f) flowss))))])
[row-styles row-styles])
(let ([flows (car flowss)]
[row-style (car row-styles)])
(let loop ([flows flows])

View File

@ -14,6 +14,7 @@
(provide unsyntax
make-binding-redirect-elements
defidentifier
(all-from-out "basic.ss"
"private/manual-style.ss"
"private/manual-scheme.ss"

View File

@ -26,6 +26,7 @@
with-exporting-libraries
id-to-target-maker
id-to-form-target-maker
defidentifier
*sig-elem
(struct-out sig)
;; public:
@ -170,6 +171,37 @@
(lambda () (car content))
(lambda () (car content))))))
(define (defidentifier id
#:form? [form? #f]
#:index? [index? #t]
#:show-libs? [show-libs? #t])
;; This function could have more optional argument to select
;; whether to index the id, include a toc link, etc.
(let ([dep? #t])
(let ([maker (if form?
(id-to-form-target-maker id dep?)
(id-to-target-maker id dep?))]
[elem (if show-libs?
(definition-site (syntax-e id) id form?)
(to-element id))])
(if maker
(maker (list elem)
(lambda (tag)
(let ([elem
(if index?
(make-index-element
#f (list elem) tag
(list (symbol->string (syntax-e id)))
(list elem)
(and show-libs?
(with-exporting-libraries
(lambda (libs)
(make-exported-index-desc (syntax-e id)
libs)))))
elem)])
(make-target-element #f (list elem) tag))))
elem))))
(define (make-binding-redirect-elements mod-path redirects)
(let ([taglet (module-path-index->taglet
(module-path-index-join mod-path #f))])

View File

@ -173,11 +173,20 @@
(make-decl-collect decl)
(append
((decl-mk-head decl) #f)
(list
(make-blockquote
"leftindent"
(flow-paragraphs
(decode-flow (build-body decl (decl-body decl))))))))))
(let-values ([(pre post)
(let loop ([l (decl-body decl)][accum null])
(cond
[(null? l) (values (reverse accum) null)]
[(or (constructor? (car l)) (meth? (car l)))
(values (reverse accum) l)]
[else (loop (cdr l) (cons (car l) accum))]))])
(append
(flow-paragraphs (decode-flow pre))
(list
(make-blockquote
"leftindent"
(flow-paragraphs
(decode-flow (build-body decl post)))))))))))
(define (*class-doc kind stx-id super intfs ranges whole-page? make-index-desc)
(make-table

View File

@ -15,6 +15,7 @@
\usepackage{hyperref}
\renewcommand{\rmdefault}{ptm}
\usepackage{longtable}
\usepackage{relsize}
\usepackage[htt]{hyphenat}
\usepackage[usenames,dvipsnames]{color}
\hypersetup{bookmarks=true,bookmarksopen=true,bookmarksnumbered=true}
@ -67,8 +68,8 @@
\newcommand{\indexlink}[1]{#1}
\newcommand{\noborder}[1]{#1}
\newcommand{\imageleft}[1]{} % drop it
\newcommand{\smaller}[1]{{\footnotesize #1}}
\newcommand{\refpara}[1]{\marginpar{\footnotesize #1}}
\renewcommand{\smaller}[1]{\textsmaller{#1}}
\newcommand{\refpara}[1]{\marginpar{\raggedright \footnotesize #1}}
\newcommand{\titleAndEmptyVersion}[2]{\title{#1}\maketitle}
\newcommand{\titleAndVersion}[2]{\title{#1\\{\normalsize Version #2}}\maketitle}

View File

@ -163,7 +163,9 @@ an element with style @scheme[#f].}
@def-style-proc[subscript]
@def-style-proc[superscript]
@def-elem-proc[smaller]{Like @scheme[elem], but with style @scheme["smaller"].}
@def-elem-proc[smaller]{Like @scheme[elem], but with style
@scheme["smaller"]. When uses of @scheme[smaller] are nested, text
gets progressively smaller.}
@defproc[(hspace [n exact-nonnegative-integer?]) element?]{

View File

@ -613,6 +613,29 @@ typeset as with @scheme[scheme].}
Like @scheme[schemegrammar], but for typesetting multiple productions
at once, aligned around the @litchar{=} and @litchar{|}.}
@defproc[(defidentifier [id identifier?]
[#:form? form? any/c #f]
[#:index? index? any/c #t]
[#:show-libs? show-libs? any/c #t])
element?]{
Typesets @scheme[id] as a Scheme identifier, and also establishes the
identifier as the definition of a binding in the same way as
@scheme[defproc], @scheme[defform], etc. As always, the library that
provides the identifier must be declared via @scheme[defmodule] or
@scheme[declare-exporting] for an enclosing section.
If @scheme[form?] is a true value, then the identifier is documented
as a syntactic form, so that uses of the identifier (normally
including @scheme[id] itself) are typeset as a syntactic form.
If @scheme[index?] is a true value, then the identifier is registered
in the index.
If @scheme[show-libs?] is a true value, then the identifier's defining
module may be exposed in the typeset form (e.g., when viewing HTML and
the mouse hovers over the identifier).}
@; ------------------------------------------------------------------------
@section[#:tag "doc-classes"]{Documenting Classes and Interfaces}