Skip to content

Commit 3361e4a

Browse files
committed
improving (form) rendering and indexing
1 parent f4e1a12 commit 3361e4a

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

scribble-api.rkt

+15-4
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,9 @@
856856
(let ([processing-module (curr-module-name)])
857857
(define part-tag (list 'part (tag-name (curr-module-name) name)))
858858
(define pyret-text (seclink (xref processing-module name) (pyret text)))
859-
(define pyret-elt (toc-target-element code-style (list pyret-text) part-tag))
859+
(define pyret-elt (toc-target2-element code-style (list pyret-text) part-tag (list name)))
860+
(define part-tags (list 'part (curr-module-name) name))
861+
(define index-tags (cons (pyret name) (filter (lambda(e) (not (or (equal? e name) (equal? e "")))) (rest part-tags))))
860862
(interleave-parbreaks/all
861863
(list
862864
(traverse-block ; use this to build xrefs on an early pass through docs
@@ -867,11 +869,20 @@
867869
(apply para #:style (div-style "boxed pyret-header")
868870
(list pyret-elt)))
869871
(nested #:style (div-style "value")
870-
(cons
871-
header-part
872+
(append
873+
(list
874+
(let ((tag (make-generated-tag)))
875+
(make-index-element #f
876+
(list (make-target-element #f '() `(idx ,tag)))
877+
`(idx ,tag)
878+
(cons name (rest index-tags))
879+
index-tags
880+
#f))
881+
header-part)
872882
(interleave-parbreaks/all
873883
(append
874-
(list (nested #:style (div-style "description") contents))))))))))))
884+
(list
885+
(nested #:style (div-style "description") contents))))))))))))
875886

876887
(define (value name ann #:private (private #f) #:style (style "boxed pyret-header") . contents)
877888
(when (not private) (set-documented! (curr-module-name) name))

src/builtin/booleans.scrbl

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ end
3636
}
3737
@section{Boolean Operators}
3838

39-
@form["and" "<left> and <right>"]{
39+
@form["and" "left and right"]{
4040
@margin-note{
4141
The @pyret{and} operator “short-circuits”: if @pyret{left}
4242
evaluates to @pyret{false}, then @pyret{right} is not evaluated at all and the
@@ -59,7 +59,7 @@ end
5959
}
6060
}
6161

62-
@form["or" "<left> or <right>"]{
62+
@form["or" "left or right"]{
6363
@margin-note{
6464
The @pyret{or} operator “short-circuits”: if @pyret{left}
6565
evaluates to @pyret{true}, then @pyret{right} is not evaluated at all and the

src/builtin/numbers.scrbl

+9-8
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
@(append-gen-docs
1010
`(module "numbers"
1111
(path "src/js/base/runtime-anf.js")
12-
(form-spec (name "num+"))
13-
(form-spec (name "num-"))
14-
(form-spec (name "num*"))
15-
(form-spec (name "num/"))
12+
(form-spec (name "+ (addition operator)"))
13+
(form-spec (name "- (subtraction operator)"))
14+
(form-spec (name "* (multiplication operator)"))
15+
(form-spec (name "/ (division operator)"))
1616
(data-spec
1717
(name "Number")
1818
(variants)
@@ -433,7 +433,7 @@ The mathematical constant π, approximated as a @pyret-id["Roughnum"], or
433433

434434
@section{Number Operators}
435435

436-
@form["num+" "<left> + <right>"]{
436+
@form["+ (addition operator)" "left + right"]{
437437
@margin-note{If either of the values in an arithmetic operator is a
438438
@pyret{Roughnum}, the result is a @pyret{Roughnum}}
439439
When @pyret{left} and @pyret{right} evaluate to numbers, adds them and returns
@@ -448,7 +448,7 @@ end
448448
}
449449
}
450450

451-
@form["num-" "<left> - <right>"]{
451+
@form["- (subtraction operator)" "left - right"]{
452452
When @pyret{left} and @pyret{right} evaluate to numbers, subtracts
453453
@pyret{right} from @pyret{left} and returns the result.
454454

@@ -461,7 +461,7 @@ end
461461
}
462462
}
463463

464-
@form["num*" "<left> * <right>"]{
464+
@form["* (multiplication operator)" "left * right"]{
465465
When @pyret{left} and @pyret{right} evaluate to numbers, multiplies
466466
them and returns the result.
467467

@@ -474,7 +474,7 @@ end
474474
}
475475
}
476476

477-
@form["num/" "<left> / <right>"]{
477+
@form["/ (division operator)" "left / right"]{
478478
@margin-note{To be used as an operator, @pyret{/} has to have spaces around
479479
it. This means you need to write @pyret{a / 3} rather than @pyret{a/3} to
480480
divide the value stored in @pyret{a} by @pyret{3}. Things like @pyret{4/3} and
@@ -492,6 +492,7 @@ end
492492
}
493493
}
494494

495+
495496
@section{Number Functions}
496497

497498
@function["num-equal" #:contract (a-arrow N N B) #:return B]{

0 commit comments

Comments
 (0)