apluslms/a-plus-rst-tools

Chapter links (file paths) behave differently in Windows and Linux

Opened this issue · 2 comments

Juha says that chapter links behave differently in Windows and Linux. He uses Roman to compile the course materials, but Roman shouldn't affect this at all and the problem stems from a-plus-rst-tools.

The code in lib/html_tools.py particularly affects the links in the HTML output.

It has been typical that a-plus-rst-tools are tested in Linux machines and nobody really thinks about Windows. Windows file paths have some differences and there could be bugs in the code that assume that only Linux-style file paths are used. A-plus-rst-tools should use the platform-agnostic Python file path APIs so that the code is not dependent on any operating system.

Problem: when somebody tries to fix this, they should also have access to a Windows machine for testing, but that is harder to arrange. Is it feasible to use remote VDI Windows for this even though we don't have admin privileges there? VDI images should have some Python version installed, but we also need virtualenv for installing Sphinx.

UPDATE:
Juha has ideas what could be causing the issue:

It seems that the new-ish _rst_srcpath feature in a-plus-rst-tools produces different yaml output on different OSs because of different path separators. This creates a bit of a mess when using a combination of OSs for course development.
In practical terms, this is what I get on Windows: _rst_srcpath: w05\ch05_fi.rst
And this is what I get on Linux: _rst_srcpath: w05/ch05_fi.rst
N.B. I don't actually care about the _rst_srcpath myself at all, but it would be nice to have consistent output so that I have zero diffs between OSs. And so that I don't have to a multi-minute Sphinx rebuild on Windows (which I use mainly) every time I've built on Linux (which I need to use additionally in order to run a full Roman build).

Jaakko points out this line in lib/html_tools.py:
https://github.com/Aalto-LeTech/a-plus-rst-tools/blob/e797e8880ce0639da228d5a3960282897b660d2b/lib/html_tools.py#L132

nobody really thinks about Windows

It's not supported platform at the moment, but maybe we should find the resources to support it. Specially at it seems that WSL 2 has been released (May 27, 2020).

A side note: this PR #65 also changes lib/html_tools.py since it tries to fix chapter links when the chapter directories are nested.