From 34f12bcd597afcc3d3fb8cd646bf7a8537f17e05 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 18 Feb 2013 11:12:33 -0700 Subject: [PATCH] scribble: preserve order of ".js", ".css", and ".tex" additions original commit: 08604b027740e515d69b677d8542eb45fc8791b2 --- collects/scribble/base-render.rkt | 17 +++++++++++------ collects/scribble/html-render.rkt | 2 -- collects/scribble/latex-render.rkt | 1 - 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/collects/scribble/base-render.rkt b/collects/scribble/base-render.rkt index ed76353a..537250ae 100644 --- a/collects/scribble/base-render.rkt +++ b/collects/scribble/base-render.rkt @@ -118,9 +118,9 @@ ;; ---------------------------------------- - (define/public (extract-part-style-files d ri tag stop-at-part? pred extract) + (define/public (extract-part-style-files d ri stop-at-part? pred extract) (let ([ht (make-hash)]) - (let loop ([p d][up? #t][only-up? #f]) + (let loop ([p d] [up? #t] [only-up? #f]) (let ([s (part-style p)]) (when up? (let ([p (collected-info-parent (part-collected-info p ri))]) @@ -137,14 +137,19 @@ (unless (stop-at-part? p) (loop p #f #f))) (part-parts p))))) - (for/list ([k (in-hash-keys ht)]) (if (or (bytes? k) (url? k)) - k - (main-collects-relative->path k))))) + (map cdr + (sort + (for/list ([(k v) (in-hash ht)]) + (cons v (if (or (bytes? k) (url? k)) + k + (main-collects-relative->path k)))) + < + #:key car)))) (define/private (extract-style-style-files s ht pred extract) (for ([v (in-list (style-properties s))]) (when (pred v) - (hash-set! ht (extract v) #t)))) + (hash-update! ht (extract v) values (hash-count ht))))) (define/private (extract-flow-style-files blocks d ri ht pred extract) (for ([b (in-list blocks)]) diff --git a/collects/scribble/html-render.rkt b/collects/scribble/html-render.rkt index 6d89789c..c3c7177d 100644 --- a/collects/scribble/html-render.rkt +++ b/collects/scribble/html-render.rkt @@ -704,7 +704,6 @@ (append (extract-part-style-files d ri - 'css (lambda (p) (part-whole-page? p ri)) css-addition? css-addition-path) @@ -720,7 +719,6 @@ (extract-part-style-files d ri - 'css (lambda (p) (part-whole-page? p ri)) js-addition? js-addition-path)) diff --git a/collects/scribble/latex-render.rkt b/collects/scribble/latex-render.rkt index 90662d25..511197e1 100644 --- a/collects/scribble/latex-render.rkt +++ b/collects/scribble/latex-render.rkt @@ -89,7 +89,6 @@ (append (extract-part-style-files d ri - 'tex (lambda (p) #f) tex-addition? tex-addition-path)