demo-manual.scrbl (7151B)
1 #lang scribble/base 2 @(require scribble/manual 3 scribble/eval 4 (for-syntax racket/base) 5 (for-label racket/base 6 racket/contract/base 7 scribble/manual)) 8 9 @(define css tt) 10 11 @title{Manual All-Styles Document} 12 13 @table-of-contents[] 14 15 @section{Code Styles} 16 17 @itemlist[ 18 19 @item{@css{RktSym} (identifier without @racket[for-label] binding): 20 @racket[unbound] or @racketidfont{example}} 21 22 @item{@css{RktValLink} (link to variable form): @racket[cons]} 23 24 @item{@css{RktValDef} (definition of variable, normally combined with @css{RktValLink}): 25 @racket[list] in 26 27 @defproc[#:link-target? #f (list) any/c] 28 @defthing[#:link-target? #f list any/c]} 29 30 @item{@css{RktStxLink} (link to syntactic form): @racket[lambda]} 31 32 @item{@css{RktStxDef} (definition of syntactic form, normally combined with @css{RktStxLink}): 33 @racket[lambda] in 34 35 @defform[#:link-target? #f (lambda ...)]} 36 37 @item{@css{RktSymDef} (definition without binding, normally a mistake, combined with @css{RktSym}): 38 @racket[unbound-identifier] in 39 40 @defform[#:link-target? #f (unbound-identifier)]} 41 42 @item{@css{RktVar} (local variable or meta-variable): @racket[_variable] or @racketvarfont{example}} 43 44 @item{@css{RktRes} (REPL result): @racketresult['(1 2 3)] or @racketresultfont{example}} 45 46 @item{@css{RktOut} (as written to the current output port): @racketoutput{example}} 47 48 @item{@css{RktErr} (errors): @racketerror{example} or the error message in 49 50 @interaction[(eval:error (+ 1 'a))]} 51 52 @item{@css{RktCmt} (comments): @racketcommentfont{example} or 53 54 @racketblock[(code:comment "comment")]} 55 56 @item{@css{RktVal} (values): @racket['(1 2 3)] or @racketvalfont{example}} 57 58 @item{@css{highlighted} (highlight via background): @racket[(not-this (code:hilite example) nor-this)]} 59 60 @item{@css{RktIn} on a @css{RktInBG}: @litchar{example}} 61 62 @item{@css{RktPn} (parentheses, etc.): @racket[([{}])] or @racketparenfont{example}} 63 64 @item{@css{RktRdr} (reader shorthands): non-parentheses in @racket[(#`() ,@())]} 65 66 @item{@css{RktMeta} (the @racket[unquote] comma): 67 @racket[,1] or @racketmetafont{example} or ``#reader'' below. 68 69 @defmodule[@schemeidfont{module} #:module-paths (racket/base) #:reader #:no-declare #:link-target? #f]} 70 71 @item{@css{RktMod} (module name; normally @css{RktModLink} instead): @racketmodfont{example}} 72 73 @item{@css{RktModLink} (a linked module reference): @racketmodname[racket/base]} 74 75 @item{@css{RktOpt} (option-argument brackets): brackets in 76 77 @defproc[#:link-target? #f (f [x any/c 1]) any]} 78 79 @item{@css{RktKw} (not normally used): @racketkeywordfont{example}} 80 81 ] 82 83 The @css{RktBlk} style class is used for a table of multiple lines (more 84 than 1) of Racket code: 85 86 @racketblock[ 87 (define x (+ 1 2)) 88 (+ x 3) 89 ] 90 91 @section{Definition Blocks} 92 93 @defmodule[racket/base #:link-target? #f] 94 95 The module-declaration box above is in a @css{defmodule} table. The 96 package-specification part is in an @css{RpackageSpec} wrapper. 97 98 The definitions below are marked so that they are not link targets. If 99 they were link targets, the table-of-contents panel on the left would 100 have entries for them. 101 102 @defproc[#:link-target? #f (cons [really-long-name-for-the-first-argument 103 any/c] 104 [really-long-name-for-the-second-argument 105 (or/c any/c 106 any/c)]) 107 pair?]{ 108 109 This definition box starts with a @css{SVInsetFlow} wrapper, which is a 110 @racketmodname[scribble/base] style class for the 111 @racket['vertical-inset] style name on a block; it should give the 112 block suitable vertical space before and after. 113 114 The next layer is a @css{boxed} plus @css{RBoxed} table. The @css{boxed} 115 style class is from @racketmodname[scribble/base] and the 116 @racket['boxed] style name on a table. The @css{RBoxed} style class is 117 from the @racket[scribble/manual] layer. Both @css{boxed} and @css{RBoxed} 118 are used for all definition boxes by @racket[scribble/manual] forms. 119 120 The initial content of the table includes a @css{SubFlow} (a 121 @racket[scribble/base] style class for non-indented flow) to combine 122 blocks for the background label with the first line of the table. The 123 background label ``procedure'' has an @css{RBackgroundLabel} outer 124 wrapper, which makes the label float right. (The wrapper also has the 125 @css{SIEHidden} style class, which built-in for all Scribble HTML output 126 and makes the label hidden on Internet Explorer 6 and earlier.) The 127 background label has an @css{RBackgroundLabelInner} inner wrapper, which 128 makes the label suitably faint. The content part of the first line is 129 wrapped in @css{RForeground}, which ensures that it is in front of the 130 background label. 131 132 In a procedure definition box: 133 134 @itemlist[ 135 136 @item{When the initial ``prototype'' call in the definition box spans 137 multiple lines, the table that contains the call has the 138 @css{prototype} style class in addition to @css{RForeground}.} 139 140 @item{When the contract or default value for an argument spans 141 multiple lines, then the contract, the ``='' for a value (if 142 any), and value (if any) are wrapped in an table with the 143 @css{argcontract} style class.} 144 145 ] 146 147 Finally, the definition box and all of the associated explanation text 148 are wrapped in @css{SIntrapara} blocks and grouped into a single 149 @tt{<p>}.} 150 151 @defform[#:link-target? #f 152 (lambda ...) 153 #:grammar ([example good 154 bad])] 155 156 When a syntactic-from specification has a grammar, the grammar is in a 157 table with the @css{specgrammar} style class. 158 159 Since no explanation flow is attached to the above @racket[defform] use, 160 there's no @css{SIntrapara} block around the table (just a @tt{<p>}). 161 162 @deftogether[( 163 @defproc[#:link-target? #f (cons [a any/c] [d any/c]) pair?] 164 @defform[#:link-target? #f (lambda ...)] 165 )]{ 166 167 Putting definitions together with @racket[deftogether] converts the 168 @css{RBoxed} and @css{boxed} tables that would be generated for the 169 individual definitions into tables with the @css{together} style 170 class. The tables are then combined as rows in a new table with the 171 @css{RBoxed} and @css{boxed} style classes.} 172 173 A @racket[defsubform], @racket[specsubform], etc., such as 174 175 @specsubform[(lambda ...)] 176 177 is indented though a wrapper with a @css{leftindent} style class. 178 179 @include-section["demo-class.scrbl"] 180 181 @section{Miscellaneous} 182 183 In @racket[filebox] rendering, 184 185 @(filebox "example.rkt" "This is a file box") 186 187 a @css{Rfilebox} wrapper surrounds the file name in a @css{Rfiletitle} 188 outer wrapper and an @css{Rfilename} inner wrapper, plus the file 189 content in an @css{Rfilecontent} wrapper. 190 191 @inset-flow{The @racket[inset-flow] form generates a 192 @racket[nested-flow] with style class @css{insetpara}.} 193 194 @history[#:changed "1.0" @elem{History paragraphs have the @css{SHistory} style class.}] 195 196 @section{Bibliography} 197 198 The bibliography table for the citation @cite["Example"] as the 199 @css{RBibliography} style class. 200 201 @bibliography[(bib-entry #:key "Example" #:title "Example bibliography entry")]