From a05ce99d9b1cb176eb648753e84bebf4aa1521c9 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 29 Jul 2014 16:51:19 +0100 Subject: [PATCH] scribble: recognize 'exact-chars even when a style name is #f Patch from Tero Hasu. original commit: 30a354c820160d8816746567403ee1a0f34f192a --- .../scribble-doc/scribblings/scribble/core.scrbl | 7 +++++-- pkgs/scribble-pkgs/scribble-lib/scribble/latex-render.rkt | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pkgs/scribble-pkgs/scribble-doc/scribblings/scribble/core.scrbl b/pkgs/scribble-pkgs/scribble-doc/scribblings/scribble/core.scrbl index f01e5800..e0fb94d5 100644 --- a/pkgs/scribble-pkgs/scribble-doc/scribblings/scribble/core.scrbl +++ b/pkgs/scribble-pkgs/scribble-doc/scribblings/scribble/core.scrbl @@ -876,13 +876,16 @@ The following @tech{style properties} are currently recognized: suitable for Latex @tt{tt} mode.} @item{@racket['exact-chars] --- For Latex output, when the @tech{style - name} is a string, render the elements content exactly + name} is a string or @racket[#f], render the elements content exactly (without escapes).} @item{@racket[command-extras] structure --- For Latex output, adds strings as arguments to the Latex command.} -]} +] + +@history[#:changed "1.6" @elem{Changed @racket['exact-chars] handling to + take effect when the style name is @racket[#f].}]} @defstruct[(image-element element) ([path (or/c path-string? diff --git a/pkgs/scribble-pkgs/scribble-lib/scribble/latex-render.rkt b/pkgs/scribble-pkgs/scribble-lib/scribble/latex-render.rkt index 88a2fe47..cb889e4b 100644 --- a/pkgs/scribble-pkgs/scribble-lib/scribble/latex-render.rkt +++ b/pkgs/scribble-pkgs/scribble-lib/scribble/latex-render.rkt @@ -414,9 +414,9 @@ (parameterize ([rendering-tt (or tt? (rendering-tt))]) (super render-content e part ri))]))] [wrap (lambda (e s tt?) - (printf "\\~a{" s) + (when s (printf "\\~a{" s)) (core-render e tt?) - (printf "}"))]) + (when s (printf "}")))]) (define (finish tt?) (cond [(symbol? style-name) @@ -465,6 +465,10 @@ (printf "}")))] [else (wrap e style-name tt?)]))] + [(and (not style-name) + style + (memq 'exact-chars (style-properties style))) + (wrap e style-name 'exact)] [else (core-render e tt?)])) (let loop ([l (if style (style-properties style) null)] [tt? #f])