fix pagetree->path (closes #249)

Pagetree promises that its nodes will be resolved relative to the directory where the pagetree lives. For path-based pagetrees, make sure this directory is set correctly.
pull/253/head
Matthew Butterick 4 years ago
parent 7c348dde44
commit 63a92b2953

@ -220,11 +220,12 @@
(define+provide/contract (pagetree->paths pt-or-path) (define+provide/contract (pagetree->paths pt-or-path)
((or/c pagetree? pathish?) . -> . (listof complete-path?)) ((or/c pagetree? pathish?) . -> . (listof complete-path?))
(parameterize ([current-directory (current-project-root)]) (define-values (dir-for-resolving-paths pt)
(map ->complete-path (pagetree->list (match pt-or-path (match pt-or-path
[(? pagetree? pt) pt] [(? pagetree?) (values (current-project-root) pt-or-path)]
[_ (cached-doc pt-or-path)]))))) [_ (values (dirname (->path pt-or-path)) (cached-doc pt-or-path))]))
(parameterize ([current-directory dir-for-resolving-paths])
(map ->complete-path (pagetree->list pt))))
(module-test-external (module-test-external
(define test-pagetree `(pagetree-main foo bar (one (two three)))) (define test-pagetree `(pagetree-main foo bar (one (two three))))

@ -1 +1 @@
1614969950 1615271301

Loading…
Cancel
Save