Checking for pagetree parent
fails on Windows.
#254
Closed
opened 4 years ago by leemeichin
·
3 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Given a pagetree with nesting (i.e.
index.ptree
):And a template,
template.html.p
:And the file
posts/some-post.poly.pm
:When running
raco pollen start
on Windows and visitingposts/some-post.html
,<h1>It works</h1>
won't render.When running
raco pollen start
on Linux and visitingposts/some-post.html
,<h1>It works</h1>
will render.Upon further inspection, there is some confusion with path separators, as the rendered ptree looks like this:
I suspect there's something within pagetrees that misses out a normalised path when creating a nested pagetree.
here-path
is the absolute path according to local platform conventions (on the idea that this is the least astonishing way to present a local path).here
is the same path, converted to an output path that is relative to the current project root. You are running Windows, so bothhere-path
andhere
adhere to Windows path conventions. Whereas your pagetree seems to assume Linux path conventions.See also previous discussion on this issue: https://github.com/mbutterick/pollen-users/issues/71
That's an enlightening discussion! @otherjoel I'd actually borrowed something from one of your repos, when looking for inspiration. Namely,
include-files
, here: https://github.com/otherjoel/thenotepad/blob/master/index.ptree#L3-L6.This wasn't an issue with Pollen after all, it was just the hard-coded
"~a/~a"
format string. I'm still pretty new to Racket so I hodge-podged a tweak into it so it callssimplify-path
and ensures the string is normalised.Apologies for the mis-filed issue here :) I'll close it as there's nothing to fix.
Thank you also @mbutterick for the fantastic library and extensive documentation and tutorials. I came here from Beautiful Racket and thought I'd give it a shot; it's fascinating!