diff --git a/cache.rkt b/cache.rkt index 4858a08..61115fd 100644 --- a/cache.rkt +++ b/cache.rkt @@ -90,7 +90,6 @@ key cache-dir (λ _ - (message (format "caching: ~a from ~a" subkey (find-relative-path (current-directory) path))) (write-to-file (path->hash path subkey) dest-file #:exists 'replace)) #:max-cache-size (world:current-compile-cache-max-size)) (file->value dest-file))) subkey)] diff --git a/test/data/quick-tour/downtown/downtown.html.pmd b/test/data/quick-tour/downtown/downtown.html.pmd new file mode 100644 index 0000000..5637c22 --- /dev/null +++ b/test/data/quick-tour/downtown/downtown.html.pmd @@ -0,0 +1,9 @@ +#lang pollen +◊define[metal]{Plutonium} + +Pollen + ◊metal +--------------- + ++ You **wanted** ◊metal — you _got_ it. + ++ [search for ◊metal](https://google.com/search?q=◊metal) diff --git a/test/data/quick-tour/downtown/template.html b/test/data/quick-tour/downtown/template.html new file mode 100644 index 0000000..39264ae --- /dev/null +++ b/test/data/quick-tour/downtown/template.html @@ -0,0 +1,8 @@ + + +
+This file is ◊here +
+◊->html{◊doc} +
\ No newline at end of file diff --git a/test/data/quick-tour/hello.txt.pp b/test/data/quick-tour/hello.txt.pp new file mode 100644 index 0000000..b30633c --- /dev/null +++ b/test/data/quick-tour/hello.txt.pp @@ -0,0 +1,4 @@ +#lang pollen +Mean Street +Panama +Hear About It Later diff --git a/test/data/quick-tour/margin.html.pp b/test/data/quick-tour/margin.html.pp new file mode 100644 index 0000000..71636fb --- /dev/null +++ b/test/data/quick-tour/margin.html.pp @@ -0,0 +1,5 @@ +#lang pollen +◊define[my-inset]{30%} + +◊my-inset is the inset. + \ No newline at end of file diff --git a/test/data/quick-tour/uptown/pollen.rkt b/test/data/quick-tour/uptown/pollen.rkt new file mode 100644 index 0000000..5e7a754 --- /dev/null +++ b/test/data/quick-tour/uptown/pollen.rkt @@ -0,0 +1,8 @@ +#lang racket/base + +(require pollen/tag) +(provide (all-defined-out)) +(define headline (make-default-tag-function 'h2)) +(define items (make-default-tag-function 'ul)) +(define item (make-default-tag-function 'li 'p)) +(define (link url text) `(a [[href ,url]] ,text)) diff --git a/test/data/quick-tour/uptown/template.html b/test/data/quick-tour/uptown/template.html new file mode 100644 index 0000000..39264ae --- /dev/null +++ b/test/data/quick-tour/uptown/template.html @@ -0,0 +1,8 @@ + + +
+This file is ◊here +
+◊->html{◊doc} +
\ No newline at end of file diff --git a/test/data/quick-tour/uptown/uptown.html.pm b/test/data/quick-tour/uptown/uptown.html.pm new file mode 100644 index 0000000..2324412 --- /dev/null +++ b/test/data/quick-tour/uptown/uptown.html.pm @@ -0,0 +1,8 @@ +#lang pollen + +◊headline{Pollen markup} + +◊items{ + ◊item{You ◊strong{wanted} it — you ◊em{got} it.} + ◊item{◊link["https://google.com/search?q=racket"]{search for Racket}} +} \ No newline at end of file diff --git a/test/test-quick-tour.rkt b/test/test-quick-tour.rkt new file mode 100644 index 0000000..bfb4b1d --- /dev/null +++ b/test/test-quick-tour.rkt @@ -0,0 +1,34 @@ +#lang at-exp racket/base +(require rackunit racket/runtime-path pollen/render racket/file pollen/world) + +;; define-runtime-path only allowed at top level +(define-runtime-path quick-tour-dir "data/quick-tour/") +(define-runtime-path hello.txt.pp "data/quick-tour/hello.txt.pp") +(define-runtime-path margin.html.pp "data/quick-tour/margin.html.pp") +(define-runtime-path downtown.html.pmd "data/quick-tour/downtown/downtown.html.pmd") +(define-runtime-path uptown.html.pm "data/quick-tour/uptown/uptown.html.pm") + +(define-runtime-path hello.txt "data/quick-tour/hello.txt") +(define-runtime-path margin.html "data/quick-tour/margin.html") +(define-runtime-path downtown.html "data/quick-tour/downtown/downtown.html") +(define-runtime-path uptown.html "data/quick-tour/uptown/uptown.html") + +(define-runtime-path pollen-cache "data/quick-tour/pollen-cache") +(define-runtime-path pollen-cache-uptown "data/quick-tour/uptown/pollen-cache") +(define-runtime-path pollen-cache-downtown "data/quick-tour/downtown/pollen-cache") + +;; test makes sure that quick tour files work +(parameterize ([current-output-port (open-output-string)] + [current-directory quick-tour-dir] + [world:current-project-root quick-tour-dir]) + (check-not-exn (λ _ (render-to-file-if-needed hello.txt.pp))) + (check-not-exn (λ _ (render-to-file-if-needed margin.html.pp))) + (check-not-exn (λ _ (render-to-file-if-needed downtown.html.pmd))) + (check-not-exn (λ _ (render-to-file-if-needed uptown.html.pm))) + (check-true (file-exists? hello.txt)) + (check-true (file-exists? margin.html)) + (check-true (file-exists? downtown.html)) + (check-true (file-exists? uptown.html))) + +(for-each delete-file (list hello.txt margin.html downtown.html uptown.html)) +(for-each delete-directory/files (list pollen-cache pollen-cache-uptown pollen-cache-downtown)) \ No newline at end of file