GjjvdBurg/HugoPhotoSwipe

Path separator issue on Windows

Closed this issue · 1 comments

This is with reference to the wiki.

In Windows the generated output of content/galleries/cats.md files is:

+++
title = "Cats"
date = "2017-02-07T22:53:32-05:00"
animal = """cat"""
cover = "/pics/cats\coverimage.jpg"
+++

This causes a problem with hugo :

D:\projects\hps_example>hugo -w server
Started building sites ...
ERROR 2017/06/23 14:01:19 failed to parse page metadata for "galleries\\cats.md": Near line 4 (last key parsed 'cover'): invalid escape character 'c'; only the following escape characters are allowed: \b, \t, \n, \f, \r, \", \\, \uXXXX, and \UXXXXXXXX
Error: Error building site: Errors reading pages: Error: failed to parse page metadata for "galleries\\cats.md": Near line 4 (last key parsed 'cover'): invalid escape character 'c'; only the following escape characters are allowed: \b, \t, \n, \f, \r, \", \\, \
uXXXX, and \UXXXXXXXX for cats.md

The problem is the cover property, it should be be :

cover = "/pics/cats/coverimage.jpg"

Line 207/208 of cover.py

        album.cover_path = os.path.join(settings.output_dir, album.name, 
                settings.cover_filename)

Maybe:

        album.cover_path = os.path.join(settings.output_dir, album.name, 
            settings.cover_filename).replace("\\","/")

Regards, Paul.

Should be fixed in version 0.1.1. Sorry this took so long!