zola icon indicating copy to clipboard operation
zola copied to clipboard

Windows site root

Open warsus opened this issue 3 years ago • 17 comments

#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.

warsus avatar Sep 22 '21 15:09 warsus

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/),

s1

ralfbiedert avatar Dec 10 '21 11:12 ralfbiedert

Does the last issue happen on the next branch by itself?

Keats avatar Dec 10 '21 11:12 Keats

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.

ralfbiedert avatar Dec 10 '21 11:12 ralfbiedert

Looking at the output, the shortcode just needs to be a .md instead of .html?

Keats avatar Dec 10 '21 13:12 Keats

Ah, thanks. I wasn't aware that changed. Renaming my shortcodes to .md fixes it on next and this PR.

ralfbiedert avatar Dec 10 '21 14:12 ralfbiedert

Has anyone got an idea on how to test that with a unit test?

Keats avatar Jan 26 '22 19:01 Keats

@ralfbiedert do you know if the issue still happens on the next branch?

Keats avatar Jun 13 '22 21:06 Keats

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.

ralfbiedert avatar Jun 14 '22 07:06 ralfbiedert

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.

ralfbiedert avatar Jun 14 '22 08:06 ralfbiedert

Ok, I'll try to put this PR in then

Keats avatar Jun 14 '22 08:06 Keats

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 :/

Keats avatar Jun 14 '22 20:06 Keats

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

ralfbiedert avatar Jun 15 '22 08:06 ralfbiedert

Argh :(

Keats avatar Jun 15 '22 08:06 Keats

Will this PR possibly be in the next version (0.17.0)?

magikstm avatar Nov 05 '22 07:11 magikstm

It needs to ideally have tests

Keats avatar Nov 05 '22 19:11 Keats

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.

magikstm avatar Nov 05 '22 20:11 magikstm

Can someone on Windows revive this with some tests?

Keats avatar Jan 09 '23 21:01 Keats