Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor blueboxes name to signature-box #286

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 0 additions & 59 deletions scribble-doc/scribblings/scribble/blueboxes.scrbl

This file was deleted.

2 changes: 1 addition & 1 deletion scribble-doc/scribblings/scribble/how-to.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ generates:

@item{In the prose that documents @racket[my-helper], @racket[_lst]
is automatically typeset in italic, matching the typesetting in
the blue box. The @racket[racket] form essentially knows that
the signature box. The @racket[racket] form essentially knows that
it's used in the scope of a procedure with argument
@racket[_lst].}

Expand Down
2 changes: 1 addition & 1 deletion scribble-doc/scribblings/scribble/internals.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
@include-section["docreader.scrbl"]
@include-section["xref.scrbl"]
@include-section["tag.scrbl"]
@include-section["blueboxes.scrbl"]
@include-section["signature-box.scrbl"]
@include-section["config.scrbl"]

12 changes: 6 additions & 6 deletions scribble-doc/scribblings/scribble/renderer.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -722,15 +722,15 @@ Like @racket[render-mixin], but generates PDF output via @exec{xelatex}.

@; ----------------------------------------

@section{Contract (Blue boxes) Renderer}
@section{Contract (Signature boxes) Renderer}

@defmodule/local[scribble/contract-render]{

@defmixin[override-render-mixin-multi (render<%>) ()]{

Overrides the @method[render<%> render] method of
given renderer to record the content of the
blue boxes (generated by @racket[defproc], @racket[defform], etc)
signature boxes (generated by @racket[defproc], @racket[defform], etc)
that appear in the document.

@defmethod[#:mode override
Expand All @@ -739,12 +739,12 @@ that appear in the document.
[ri render-info?])
void?]{
In addition to doing whatever the @racket[super] method
does, also save the content of the blue boxes (rendered
does, also save the content of the signature boxes (rendered
via a @racketmodname[scribble/text-render] renderer).

It saves this information in three pieces in a file
inside the @racket[dests] directories called
@filepath{blueboxes.rktd}. The first piece is
@filepath{signature-box.rktd}. The first piece is
a single line containing a (decimal, ASCII) number. That number
is the number of bytes that the second piece of information
occupies in the file. The second piece of information
Expand All @@ -756,7 +756,7 @@ For example, if the @racket[hash] maps
for the @racket[abcdef] export from the @racket[x] collection
starts 10 bytes after the end of the hash table and continues for
@racket[3] lines. Multiple elements in the list mean that that
@racket[tag?] has multiple blue boxes and each shows where one
@racket[tag?] has multiple signature boxes and each shows where one
of the boxes appears in the file.
}}

Expand All @@ -771,7 +771,7 @@ it saves the resulting files in a different place.
[ri render-info?])
void?]{
Just like @method[override-render-mixin-multi render], except
that it saves the file @filepath{blueboxes.rktd} in
that it saves the file @filepath{signature-box.rktd} in
the same directory where each @racket[dests] element resides.
}}
}
59 changes: 59 additions & 0 deletions scribble-doc/scribblings/scribble/signature-box.scrbl
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#lang scribble/doc
@(require scribble/manual "utils.rkt"
(for-label scribble/core
scribble/signature-box
racket/contract
setup/xref))

@title[#:tag "signature-box"]{Signature Boxes Utilities}

@defmodule[scribble/signature-box]{
The @racketmodname[scribble/signature-box] provides access
to the content of the ``signature boxes'' that describe
some module's export (but without any styling).}

@defproc[(fetch-signature-box-strs [tag tag?]
[#:signature-box-cache signature-box-cache
signature-box-cache?
(make-signature-box-cache #t)])
(or/c #f (non-empty-listof string?))]{
Returns a list of strings that show the content of the signature box
(without any styling information) for the documentation referenced
by @racket[tag].

The first string in the list describes the export (e.g. @racket["procedure"]
when @racket[defproc] is used, or @racket["syntax"] when @racket[defform]
was used to document the export).
}

@defproc[(fetch-signature-box-method-tags [method-name symbol?]
[#:signature-box-cache signature-box-cache
signature-box-cache?
(make-signature-box-cache #t)])
(listof method-tag?)]{
Returns the list of tags for all methods that are documented in the documentation
in @racket[signature-box-cache].

@history[#:added "1.11"]
}

@defproc[(make-signature-box-cache
[populate? boolean?]
[#:signature-box-dirs signature-box-dirs (listof path?) (get-doc-search-dirs)])
signature-box-cache?]{
Constructs a new (mutable) signature-box cache.

If @racket[populate?] is @racket[#f], the cache is initially
unpopulated, in which case it is filled in the first time the cache
is passed to @racket[fetch-signature-box-strs]. Otherwise, the cache is
populated immediately.

The @racket[signature-box-dirs] argument is a list of directories that are
looked inside for @filepath{signature-box.rktd} files. The default value
is only an approximation for where those files usually reside. See
also @racket[get-rendered-doc-directories].
}

@defproc[(signature-box-cache? [v any/c]) boolean?]{
Determines if @racket[v] is a signature-box cache.
}
4 changes: 2 additions & 2 deletions scribble-lib/scribble/contract-render.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
(define cb.rktd
(cond
[multi?
(build-path dest "blueboxes.rktd")]
(build-path dest "signature-box.rktd")]
[else
(define-values (base name dir?) (split-path dest))
(build-path base "blueboxes.rktd")]))
(build-path base "signature-box.rktd")]))
(call-with-output-file cb.rktd
(λ (port)
(fprintf port "~a\n" (string-utf-8-length table-str))
Expand Down
Loading