From 0bd9a0d070f0b714ac1a0f7ec61e40e2f854f43b Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 10 Dec 2015 09:24:34 -0700 Subject: [PATCH] examples: add "Examples:" label as compound para Instead of creating a table to combine "Examples:" with the exmaple content, use a compound paragraph (which didn't exist when `examples` was first implemented). A compound paragraph provides better and more consistent typesetting; for example, it doesn't make the word "Examples:" use a fixed-width font in HTML output. --- scribble-lib/scribble/eval.rkt | 22 ++++++++++++++----- .../scribble/private/manual-style.rkt | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/scribble-lib/scribble/eval.rkt b/scribble-lib/scribble/eval.rkt index a0ddc701..52270868 100644 --- a/scribble-lib/scribble/eval.rkt +++ b/scribble-lib/scribble/eval.rkt @@ -1,7 +1,7 @@ #lang racket/base (require "manual.rkt" "struct.rkt" "scheme.rkt" "decode.rkt" - (only-in "core.rkt" content?) + (only-in "core.rkt" content? compound-paragraph plain) racket/contract/base racket/file racket/list @@ -170,9 +170,18 @@ (if inset? (let ([p (code-inset (make-table block-color lines))]) (if title - (make-table block-color (list (list.flow.list title) (list.flow.list p))) + (compound-paragraph + plain + (list + title + p)) p)) - (make-table block-color (if title (cons (list.flow.list title) lines) lines))))) + (if title + (compound-paragraph plain + (list + title + (make-table block-color lines))) + (make-table block-color lines))))) ;; extracts from a datum or syntax object --- while keeping the ;; syntax-objectness of the original intact, instead of always @@ -843,5 +852,8 @@ (case-lambda [(t) (as-examples examples-title t)] [(example-title t) - (make-table #f (list (list.flow.list example-title) - (list (make-flow (do-splice (list t))))))])) + (compound-paragraph + plain + (list + example-title + (make-table #f (list (list (make-flow (do-splice (list t))))))))])) diff --git a/scribble-lib/scribble/private/manual-style.rkt b/scribble-lib/scribble/private/manual-style.rkt index 15f756a0..2d64e11d 100644 --- a/scribble-lib/scribble/private/manual-style.rkt +++ b/scribble-lib/scribble/private/manual-style.rkt @@ -162,7 +162,7 @@ (make-blockquote "insetpara" (flow-paragraphs (decode-flow c)))) (define code-inset-style - (make-style 'code-inset null)) + (make-style 'code-inset '(never-indents))) (define (code-inset b) (make-blockquote code-inset-style (list b)))