Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated Resyntax fixes #456

Merged
merged 1 commit into from
Oct 30, 2024
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
6 changes: 3 additions & 3 deletions scribble-lib/scribble/comment-reader.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
[(char port)
(do-comment port (lambda () (read/recursive port #\@)))]
[(char port src line col pos)
(let ([v (do-comment port (lambda () (read-syntax/recursive src port #\@)))])
(define-values (eline ecol epos) (port-next-location port))
(datum->syntax #f v (list src line col pos (and pos epos (- epos pos)))))])))
(define v (do-comment port (lambda () (read-syntax/recursive src port #\@))))
(define-values (eline ecol epos) (port-next-location port))
(datum->syntax #f v (list src line col pos (and pos epos (- epos pos))))])))

(define (do-comment port recur)
(let loop ()
Expand Down
4 changes: 2 additions & 2 deletions scribble-lib/scribble/doclang.rkt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#lang racket/base
(require "private/doc-begin.rkt"
(for-syntax racket/base))
(require (for-syntax racket/base)
"private/doc-begin.rkt")

(provide (except-out (all-from-out racket/base) #%module-begin)
(rename-out [*module-begin #%module-begin]))
Expand Down
6 changes: 3 additions & 3 deletions scribble-lib/scribble/doclang2.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
;; A slightly nicer version of doclang where the parameters are keyword-based
;; rather than positional.

(require "private/doc-begin.rkt"
(for-syntax racket/base
syntax/parse))
(require (for-syntax racket/base
syntax/parse)
"private/doc-begin.rkt")

(provide (except-out (all-from-out racket/base) #%module-begin)
(rename-out [*module-begin #%module-begin]))
Expand Down
4 changes: 2 additions & 2 deletions scribble-lib/scribble/latex-properties.rkt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#lang racket/base
(require "private/provide-structs.rkt"
(require racket/contract/base
racket/serialize
racket/contract/base)
"private/provide-structs.rkt")

(provide-structs
[tex-addition ([path (or/c path-string? (cons/c 'collects (listof bytes?)) bytes?)])]
Expand Down
5 changes: 3 additions & 2 deletions scribble-lib/scribble/pdf-render.rkt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#lang racket/base

(require "private/indirect-renderer.rkt" "private/run-pdflatex.rkt"
(prefix-in latex: "latex-render.rkt"))
(require (prefix-in latex: "latex-render.rkt")
"private/indirect-renderer.rkt"
"private/run-pdflatex.rkt")

(provide render-mixin
dvi-render-mixin
Expand Down
42 changes: 21 additions & 21 deletions scribble-lib/scribble/racket.rkt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#lang racket/base

(require "core.rkt"
(require (for-syntax racket/base)
file/convertible
racket/extflonum
"basic.rkt"
"search.rkt"
"core.rkt"
"html-properties.rkt"
"private/manual-sprop.rkt"
"private/on-demand.rkt"
"html-properties.rkt"
file/convertible
racket/extflonum
(for-syntax racket/base))
"search.rkt")

(provide define-code
to-element
Expand Down Expand Up @@ -474,7 +474,7 @@
a
(let ([val? (positive? quote-depth)])
(make-sized-element
(if val? value-color #f)
(and val? value-color)
(list
(make-element/cache (if val? value-color paren-color) '". ")
(typeset a #f "" "" "" (not val?) expr? escapes? defn? elem-wrap)
Expand Down Expand Up @@ -504,12 +504,11 @@
(out 'nbsp comment-color)
(define v (syntax->datum (cadr (syntax->list c))))
(if (paragraph? v)
(map (lambda (v)
(let ([v (no-fancy-chars v)])
(if (or (string? v) (symbol? v))
(out v comment-color)
(out v #f))))
(paragraph-content v))
(for/list ([v (in-list (paragraph-content v))])
(let ([v (no-fancy-chars v)])
(if (or (string? v) (symbol? v))
(out v comment-color)
(out v #f))))
(out (no-fancy-chars v) comment-color))]

#; {Syntax Init-line! Srcless-step String String -> Contract}
Expand Down Expand Up @@ -737,14 +736,15 @@
(syntax-column (cadr l)))
(and (syntax-column c)
(+ (syntax-column c) (syntax-span c))))])
(if end
(datum->syntax #f
(syntax-e key)
(vector #f (syntax-line key)
(syntax-column key)
(syntax-position key)
(max 1 (- end 1 (syntax-column key)))))
end))
(and end
(datum->syntax
#f
(syntax-e key)
(vector #f
(syntax-line key)
(syntax-column key)
(syntax-position key)
(max 1 (- end 1 (syntax-column key)))))))
(cdr l)))]
[(struct-proxy? (syntax-e c))
(struct-proxy-content (syntax-e c))]
Expand Down
144 changes: 71 additions & 73 deletions scribble-lib/scribble/render.rkt
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
#lang racket/base

(require "core.rkt"
"base-render.rkt"
"xref.rkt"
racket/file
racket/class
(require racket/class
racket/contract/base
(prefix-in html: "html-render.rkt"))
racket/file
(prefix-in html: "html-render.rkt")
"base-render.rkt"
"core.rkt"
"xref.rkt")

(provide/contract
[render (((listof part?)
(listof path-string?))
(#:render-mixin
(class? . -> . class?)
#:dest-dir (or/c #f path-string?)
#:helper-file-prefix (or/c #f string?)
#:keep-existing-helper-files? any/c
#:prefix-file (or/c #f path-string?)
#:style-file (or/c #f path-string?)
#:style-extra-files (listof path-string?)
#:extra-files (listof path-string?)
#:image-preferences (listof (or/c 'ps 'pdf 'png 'svg 'gif))
#:redirect (or/c #f string?)
#:redirect-main (or/c #f string?)
#:directory-depth exact-nonnegative-integer?
#:xrefs (listof xref?)
#:info-in-files (listof path-string?)
#:info-out-file (or/c #f path-string?)
#:quiet? any/c
#:warn-undefined? any/c)
. ->* . void?)])
(provide (contract-out [render
(((listof part?) (listof path-string?))
(#:render-mixin (class? . -> . class?)
#:dest-dir (or/c #f path-string?)
#:helper-file-prefix (or/c #f string?)
#:keep-existing-helper-files? any/c
#:prefix-file (or/c #f path-string?)
#:style-file (or/c #f path-string?)
#:style-extra-files (listof path-string?)
#:extra-files (listof path-string?)
#:image-preferences (listof (or/c 'ps 'pdf 'png 'svg 'gif))
#:redirect (or/c #f string?)
#:redirect-main (or/c #f string?)
#:directory-depth exact-nonnegative-integer?
#:xrefs (listof xref?)
#:info-in-files (listof path-string?)
#:info-out-file (or/c #f path-string?)
#:quiet? any/c
#:warn-undefined? any/c)
. ->* .
void?)]))

(define (render docs
names
Expand All @@ -51,48 +50,47 @@
#:quiet? [quiet? #t]
#:warn-undefined? [warn-undefined? (not quiet?)])
(when dest-dir (make-directory* dest-dir))
(let ([renderer (new (render-mixin render%)
[dest-dir dest-dir]
[prefix-file prefix-file]
[style-file style-file]
[style-extra-files style-extra-files]
[extra-files extra-files]
[image-preferences image-preferences]
[helper-file-prefix helper-file-prefix]
[keep-existing-helper-files? keep-existing-helper-files?])])
(when redirect
(send renderer set-external-tag-path redirect))
(when redirect-main
(send renderer set-external-root-url redirect-main))
(unless (zero? directory-depth)
(send renderer set-directory-depth directory-depth))
(unless quiet?
(send renderer report-output!))
(let* ([fns (map (lambda (fn)
(let-values ([(base name dir?) (split-path fn)])
(let ([fn (path-replace-suffix
name
(send renderer get-suffix))])
(if dest-dir (build-path dest-dir fn) fn))))
names)]
[fp (send renderer traverse docs fns)]
[info (send renderer collect docs fns fp)])
(for ([file (in-list info-input-files)])
(let ([s (with-input-from-file file read)])
(send renderer deserialize-info s info)))
(for ([xr (in-list xrefs)])
(xref-transfer-info renderer info xr))
(let ([r-info (send renderer resolve docs fns info)])
(send renderer render docs fns r-info)
(when info-output-file
(let ([s (send renderer serialize-info r-info)])
(with-output-to-file info-output-file
#:exists 'truncate/replace
(lambda () (write s)))))
(when warn-undefined?
(let ([undef (send renderer get-undefined r-info)])
(unless (null? undef)
(eprintf "Warning: some cross references may be broken due to undefined tags:\n")
(for ([t (in-list undef)])
(eprintf " ~s\n" t))))))
(void))))
(define renderer
(new (render-mixin render%)
[dest-dir dest-dir]
[prefix-file prefix-file]
[style-file style-file]
[style-extra-files style-extra-files]
[extra-files extra-files]
[image-preferences image-preferences]
[helper-file-prefix helper-file-prefix]
[keep-existing-helper-files? keep-existing-helper-files?]))
(when redirect
(send renderer set-external-tag-path redirect))
(when redirect-main
(send renderer set-external-root-url redirect-main))
(unless (zero? directory-depth)
(send renderer set-directory-depth directory-depth))
(unless quiet?
(send renderer report-output!))
(define fns
(map (lambda (fn)
(let-values ([(base name dir?) (split-path fn)])
(let ([fn (path-replace-suffix name (send renderer get-suffix))])
(if dest-dir
(build-path dest-dir fn)
fn))))
names))
(define fp (send renderer traverse docs fns))
(define info (send renderer collect docs fns fp))
(for ([file (in-list info-input-files)])
(let ([s (with-input-from-file file read)]) (send renderer deserialize-info s info)))
(for ([xr (in-list xrefs)])
(xref-transfer-info renderer info xr))
(let ([r-info (send renderer resolve docs fns info)])
(send renderer render docs fns r-info)
(when info-output-file
(let ([s (send renderer serialize-info r-info)])
(with-output-to-file info-output-file #:exists 'truncate/replace (lambda () (write s)))))
(when warn-undefined?
(let ([undef (send renderer get-undefined r-info)])
(unless (null? undef)
(eprintf "Warning: some cross references may be broken due to undefined tags:\n")
(for ([t (in-list undef)])
(eprintf " ~s\n" t))))))
(void))
Loading