Skip to content
Merged
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
11 changes: 11 additions & 0 deletions scribble-doc/scribblings/scribble/core.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,9 @@ The recognized @tech{style properties} are as follows:
multiple @litchar{,}-separated labels and generate a suitable set of
references. See also @racketmodname[scriblib/book-index].}

@item{@racket[initial-scale] structure --- For HTML, adjusts the initial
scale for responsive views, such as on mobile devices.}

]

The @racket[to-collect] field contains @techlink{content} that is
Expand Down Expand Up @@ -1984,6 +1987,14 @@ via @racket[head-addition] appear before additions via @racket[head-extra].
@history[#:added "1.38"]}


@defstruct[initial-scale ([value (real-in 0.0 10.0)])]{

Adjusts @litchar{initial-scale} in a @litchar{meta} tag with name
@litchar{viewport}. The default is @racket[1.0].

@history[#:added "1.61"]}


@defstruct[render-convertible-as ([types (listof (or/c 'png-bytes 'svg-bytes 'gif-bytes))])]{
For a @racket[part] that corresponds to an HTML page,
controls how objects that subscribe to the @racketmodname[file/convertible]
Expand Down
7 changes: 6 additions & 1 deletion scribble-doc/scribblings/scribble/manual.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
(for-label scribble/manual-struct
racket/list
version/utils
syntax/quote))
syntax/quote
(only-in scribble/html-properties
initial-scale)))

@(define lit-ellipses (racket ...))
@(define lit-ellipses+ (racket ...+))
Expand Down Expand Up @@ -2500,6 +2502,9 @@ For HTML rendering:
@filepath{scribble} collection is added as a
@racket[css-style-addition].}

@item{The document's initial scale (for responsive modes such as mobile
devices) via a @racket[(initial-scale "0.8")] style property.}

]

To obtain this configuration without using @racket[@#,hash-lang[]
Expand Down
1 change: 1 addition & 0 deletions scribble-lib/scribble/html-properties.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@

[head-extra ([xexpr xexpr/c])]
[head-addition ([xexpr xexpr/c])]
[initial-scale ([value (real-in 0.0 10.0)])]
[render-convertible-as ([types (listof (or/c 'png-bytes 'svg-bytes 'gif-bytes))])])
10 changes: 9 additions & 1 deletion scribble-lib/scribble/html-render.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,9 @@
(define/public (extract-show-language-family d ri)
(extract-inherited d ri (lambda (v) (eq? v 'show-language-family)) values))

(define/public (extract-part-initial-scale d ri)
(extract-inherited d ri initial-scale? initial-scale-value))

(define/public (part-nesting-depth d ri)
0)

Expand Down Expand Up @@ -883,12 +886,17 @@
(copy-port in (current-output-port)))))
(parameterize ([xml:empty-tag-shorthand xml:html-empty-tags])
(xml:write-xexpr
;; Adding newlines before `>` closers can make editing
;; the generated HTML (for experiments) nicer:
;; #:insert-newlines? #t
`(html ,(style->attribs (part-style d))
(head ()
(meta ([http-equiv "content-type"]
[content "text/html; charset=utf-8"]))
(meta ([name "viewport"]
[content "width=device-width, initial-scale=0.8"]))
[content ,(format "width=device-width, initial-scale=~a"
(or (extract-part-initial-scale d ri)
"1.0"))]))
,title
,(scribble-css-contents scribble-css
scribble-css-path
Expand Down
1 change: 1 addition & 0 deletions scribble-lib/scribble/manual-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ a:hover {
position: sticky;
top: 0;
left: 100%;
width: 13em;
margin-top: -4.75em;
margin-right: -15em;
font-size: 70%;
Expand Down
3 changes: 2 additions & 1 deletion scribble-lib/scribble/private/manual-defaults.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
(css-style-addition
(scribble-file "manual-racket.css"))
(js-style-addition
(scribble-file "manual-racket.js")))
(scribble-file "manual-racket.js"))
(initial-scale 0.8))
#t))

(define-on-demand manual-doc-style
Expand Down
13 changes: 11 additions & 2 deletions scribble-lib/scribble/scribble.css
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ table td {
white-space: nowrap;
left: 2em;
height: 0em;
width: 13em;
margin: 0em -13em 0em 0em;
width: 10.5em;
margin: 1.5em -13em 0em 0em;
font-size: small;
}

Expand Down Expand Up @@ -282,6 +282,15 @@ table td {
margin: 0 0 0 0;
}

/* narrow display => inline right-hand margin notes */
@media screen and (max-width: 55em) {
.refpara, .refelem, .reffootnote {
all: unset !important;
display: block !important;
margin: 1em 0 !important;
padding: 0.75em !important;
}
}

/* ---------------------------------------- */
/* Table of contents, inline */
Expand Down