eyeseast / python-frontmatter

Parse and manage posts with YAML (or other) frontmatter
http://python-frontmatter.rtfd.io
MIT License
334 stars 42 forks source link

Forestry template file #66

Closed oldenboom closed 4 years ago

oldenboom commented 4 years ago

Reading a YAML file without closing boundary (---) does not work. Suggestion: when no closing boundary exists then the entire file needs to be regarded as frontmatter (not sure what the specs say here).

Note: Forestry.io writes templates to YAML-files without closing boundaries. python-frontmatter does read them perfectly when just adding --- at the end.

eyeseast commented 4 years ago

There's no real spec here. I guess we could test against Jekyll. Do you have an example of the file you're talking about that you can post?

oldenboom commented 4 years ago

That's pretty easy, any YAML file will do as long as the closing boundary is deleted. For instance:

---
label: Game
hide_body: false
display_field: title
fields:
- type: text
  name: title
  label: Game
  description: The name of the game
  config:
    required: true
- type: datetime
  name: date
  label: Date
  config:
    display_utc: false
    date_format: DD/MM/YYYY
    required: true
  description: Date of last significant change
  default: now
- type: list
  name: aka
  label: Also known as
  description: When the game is also known with another name, provide it here
  config:
    use_select: false
- type: list
  name: groups targeted
  label: targetgroups
  config:
    use_select: true
    source:
      type: simple
      section: running
      path: running
    options:
    - toddlers
    - children
    - adolescents
    - youngsters
    - adults
    - seniors
  description: Choose all groups which can play this game easily
eyeseast commented 4 years ago

Honestly, if it's a YAML file by itself, I wouldn't use this library. This is really for cases where you have content and need to add metadata to it. If you're dealing with the metadata alone, you can probably get by using PyYAML directly(and strip off the top --- if needed).

eyeseast commented 4 years ago

I'm going to close this. Happy to hear arguments to reopen, but I think we can set this aside for now.