zola
zola copied to clipboard
Windows site root
#1361
Next attempt 😄 Dont canonicalize paths because windows "\\?" prefix seems to break globbing. If we have a relative path we turn it into an absolute one using the current_dir. Maybe those are just workarounds for problems further down. In that case the make_abs_path calls could be removed later.
I just tested this on Windows:
PR as-is
-
zola --root ..\..\cheats.rs build
ok -
zola --root ..\..\cheats.rs serve
ok -
zola --root d:\development\source\cheats.rs serve
ok -
cargo test
ok
Ok here means it runs on Windows without visible errors and fixes #1692.
PR rebased on next
-
zola --root ..\..\cheats.rs build
issue -
zola --root ..\..\cheats.rs serve
issue -
zola --root d:\development\source\cheats.rs serve
issue -
cargo test
ok
Rebasing this PR on top of 3155662db22a6a3a9ff8183d9228df10d57b2d65 also seems to fix #1692 but does not fully expand shortcodes / markdown, producing HTML output like this:
<strong>The Book</strong> [<sup class="entry">BK</sup>](https://doc.rust-lang.org/book/),
Does the last issue happen on the next
branch by itself?
Does the last issue happen on the next branch by itself?
Whops. I originally didn't bother testing since without this patch I got the error. But now that you mention it, this does happen on vanilla next
3155662. I thought I looked at the site after the byte panic patch, but apparently I haven't.
Looking at the output, the shortcode just needs to be a .md
instead of .html
?
Ah, thanks. I wasn't aware that changed. Renaming my shortcodes to .md
fixes it on next
and this PR.
Has anyone got an idea on how to test that with a unit test?
@ralfbiedert do you know if the issue still happens on the next
branch?
Hm, for whatever reason I can't pull / switch to next
anymore, I keep getting from the sublime-jinja2
submodule:
error: invalid path 'Preferences/Symbol List: Blocks.tmPreferences'
fatal: Could not reset index file to revision 'HEAD'.
~Tried in my old clone and a fresh checkout.~ Nm, when I actually checkout with --branch
instead of switching it works.
Test results: Using the latest next
(5873e03)
-
zola --root ..\..\cheats.rs build
issue -
zola --root ..\..\cheats.rs serve
issue -
zola --root d:\development\source\cheats.rs serve
issue -
cargo test
ok
The issue reported this time is a console error:
Building site...
Failed to build the site
Error: Failed to render content of //?/D:/Development/Source/cheats.rs/content/_index.md
Reason: Failed to render date shortcode
Reason: Tried to render `shortcodes/date.html` but the template wasn't found
That said, the reverse test (from cheats.rs
directory) unfortunately fails too:
-
..\_thirdparty\zola\target\release\zola.exe build
issue
Building site...
Error: Failed to build the site
Error: Found path collisions:
- `/` from files ["\\\\?\\D:\\Development\\Source\\cheats.rs\\content\\_index.md", "//?/D:/Development/Source/cheats.rs/content/_index.md"]
Running that reverse test with 0.14.1
works just fine:
Building site...
Checking all internal links with anchors.
> Successfully checked 0 internal link(s) with anchors.
-> Creating 1 pages (0 orphan), 0 sections, and processing 0 images
Done in 208ms.
Ok, I'll try to put this PR in then
Ok I've fixed the conflicts on this branch, can you give it a try when you have time? I've tried it on mac but it was already working there :/
Sure. Note that right now the merged branch (968ba7092c28ef55e99d56ec1e6359644b3df208) doesn't compile anymore (a use std::env;
is missing in main.rs
).
With that I still get the same error though:
❯ zola --root ..\..\cheats.rs build
Building site...
Failed to build the site
Error: Failed to render content of //?/D:/Development/Source/cheats.rs/content/_index.md
Reason: Failed to render date shortcode
Reason: Tried to render `shortcodes/date.html` but the template wasn't found
Argh :(
Will this PR possibly be in the next version (0.17.0)?
It needs to ideally have tests
I'm not really familiar with Rust at the moment.
But, why isn't "get_config_file_path" split into two functions. such as: get_root_dir get_config_file
I think it would be easier to create tests for both of them separately. They seem pretty critical to the rest of Zola's process.
Can someone on Windows revive this with some tests?