Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle multiline and list properties correctly in album.yml #18

Merged
merged 2 commits into from Oct 12, 2017

Conversation

Projects
None yet
2 participants
@fazalmajid
Copy link

fazalmajid commented Jul 16, 2017

Thanks for your work on HugoPhotoSwipe. Migrating photo galleries was one of the main obstacles to my migration from Wordpress to Hugo, and your solution meets most of my needs. The main change I would do is to get photo captions from EXIF/IPTC metadata when first adding a photo to a gallery, but that's for another day.

I was trying to use properties in album.yml to provide additional text before/after the galleries, and put categories or tags on them, for example here would be the file for https://majid.info/blog/a-passel-of-miniature-tripods/

---
title: A passel of miniature tripods
album_date: "2014-07-19"
properties:
  before: >
    Miniature tripods are a handy thing to carry in a camera bag.
    While they cannot replace a full-size tripod, they can allow you to take a
    shot where otherwise impossible. Here are a few worth your consideration.
  after: |
    Tested but not shown:
    - Joby Gorillapod: total garbage, unfit for purpose.
    - Pedco Ultrapod: the tripod itself is reasonably decent, but its ballhead
      is poor
  categories: [Stuff, Photo]
copyright: Fazal Majid
coverimage: tripods_01.jpg
creation_time: "2017-07-15T00:14:33-07:00"
modification_time: "2017-07-15T02:28:22-07:00"

photos:
- file: tripods_01.jpg
  name: tripods_01.jpg
  alt:
  caption: 
...

Unfortunately, hps would just mangle these when it rewrites album.yml.

I don't know what the rationale was for using functions like utils.yaml_field_to_file and the hand-rolled TOML in album.create_markdown instead of just using the YAML parser that is already imported, and one of the several full-featured TOML parsers in PyPI, so I implemented a minimally invasive fix. It can handle this use-case properly, but not more complex nested ones or data types other than lists of strings.

Fazal Majid added some commits Jul 16, 2017

@GjjvdBurg

This comment has been minimized.

Copy link
Owner

GjjvdBurg commented Jul 19, 2017

@fazalmajid Thank you very much for contributing to HugoPhotoSwipe! I don't currently have much time to look at this closely and to merge it, but from a quick scan it looks very nice, thanks! I'll try to get back to you within a few weeks.

@GjjvdBurg

This comment has been minimized.

Copy link
Owner

GjjvdBurg commented Oct 12, 2017

@fazalmajid I just tried to merge this but it seems the test_gallery.md file is missing. Would you mind adding it to this pull request? Also, if you don't mind, could you give me commit access to this pull request branch? Then I can add some minor changes.

@fazalmajid

This comment has been minimized.

Copy link
Author

fazalmajid commented Oct 12, 2017

I added test_gallery.md and granted you access.

That said, I switched since to my own utility https://github.com/fazalmajid/hugopix, inspired by yours (notably the PhotoSwipe to Hugo template integration) but written in Go. It does not do round-trip sync of image metadata like yours does, but the smart cropping is way, way faster (the README.md docs are not complete yet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.