From 54606422140136dbc8f0759f2d44e757a0193ac4 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 27 Feb 2019 14:53:49 -0700 Subject: [PATCH] make `verbatim` suppress line breaks in HTML output --- scribble-doc/scribblings/scribble/config.scrbl | 6 +++++- scribble-lib/scribble/base.rkt | 2 +- scribble-lib/scribble/scribble.css | 4 ++++ scribble-lib/scribble/scribble.tex | 3 +++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/scribble-doc/scribblings/scribble/config.scrbl b/scribble-doc/scribblings/scribble/config.scrbl index 479b7bc8..093fca40 100644 --- a/scribble-doc/scribblings/scribble/config.scrbl +++ b/scribble-doc/scribblings/scribble/config.scrbl @@ -369,6 +369,7 @@ The style classes: add space before and after suitable for code.}] [@css{SCentered} @elem{For a @racket[nested-flow] created by @racket[centered]: horizontally centered.}] + [@css{SVerbatim} @elem{For a @racket[table] created by @racket[verbatim]: disables line breaks.}] [@spacer @spacer] @@ -630,7 +631,10 @@ style: with the @racket['code-inset] style name.} @item{@ltxe{SVInsetFlow} environment --- for a @racket[nested-flow] - with the @racket['vertical-inset] style name.} + with the @racket['vertical-inset] style name.} + + @item{@ltxe{SVerbatim} environment --- for a @racket[table] created + by @racket[verbatim].} @item{@ltxd[1]{SCodeBox}, @ltxd[1]{SVInsetBox} --- for a @racket[nested-flow] with the @racket['code-inset] or diff --git a/scribble-lib/scribble/base.rkt b/scribble-lib/scribble/base.rkt index fd2f1ed5..ccfe8036 100644 --- a/scribble-lib/scribble/base.rkt +++ b/scribble-lib/scribble/base.rkt @@ -759,7 +759,7 @@ ;; and non-strings --- to a paragraph for the line: (let* ([line (indent (strs->elts line))]) (list (make-paragraph omitable-style (make-nonempty line))))) - (make-table plain (map make-line lines))) + (make-table (make-style "SVerbatim" null) (map make-line lines))) (define omitable-style (make-style 'omitable null)) diff --git a/scribble-lib/scribble/scribble.css b/scribble-lib/scribble/scribble.css index b1ff5b53..7da66740 100644 --- a/scribble-lib/scribble/scribble.css +++ b/scribble-lib/scribble/scribble.css @@ -452,6 +452,10 @@ ol ol ol ol { list-style-type: upper-alpha; } border: 0; } +.SVerbatim { + white-space: nowrap; +} + .SAuthorListBox { position: relative; float: right; diff --git a/scribble-lib/scribble/scribble.tex b/scribble-lib/scribble/scribble.tex index 30ae3d36..1905e892 100644 --- a/scribble-lib/scribble/scribble.tex +++ b/scribble-lib/scribble/scribble.tex @@ -387,6 +387,9 @@ % Helper for box-mode macros: \newcommand{\Svcenter}[1]{$\vcenter{#1}$} +% Verbatim +\newenvironment{SVerbatim}{}{} + % Helper to work around a problem with "#"s for URLs within \href % within other macros: \newcommand{\Shref}[3]{\href{#1\##2}{#3}}