Using soupault on Windows

Estimated reading time: less than a minute.

I don't use Windows myself. There are, however, many people who do, and I want to make my programs available to them. I tried to make soupault work on Windows exactly like it works on UNIX, and all functionality is available there, with only a few minor differences you should be aware of. If you are not using any preprocessors or external scripts, same configs should work on all systems without adjustments.

First, a video demonstration that it indeed does work. It's a Windows 7 test VM, with Python installed, for the blog index generator script, and for the web server module that I use for testing.

Of course, it's a rather basic support and soupault hardly feels like a native Windows program. If you have ideas for improving its usability, please share (Shell integrations? Editor integrations? An actual installer? Something else?).

Now to the point. One notable difference is that Windows uses the back slash as a filesystem path separator. The good thing is that most of the time you can use the UNIX convention. The only places where you can't are the index_processor option, preprocessor options, and the command of the exec widget.

Wherever the path is only interpreted by soupault itself, you can just copy examples from this blog or the documentation unchanged. This will work on all systems:

  default_template = 'templates/main.html'

  widget = 'include'
  file = 'templates/footer.html'
  selector = 'body'

Paths to executables, however, are passed to the system shell (cmd.exe /s on Windows), so they must follow the right convention for the OS. This is why you need to write them like this:

  index_processor = 'scripts\'

  md = 'C:\cmark\cmark.exe'

  widget = 'exec'
  command = 'scripts\myscript.bat'
  selector = 'body'

You should also note that inside double quotes, the back slash is an escape character1, so you need to either use single quotes (command = 'scripts\myscript.bat'), or use a double back slash (command = "scripts\\myscript.bat").

1It allows you to insert special characters inside strings, e.g. \n is newline.