jaspervdj / hakyll

A static website compiler library in Haskell
jaspervdj.be/hakyll
Other
2.7k stars 411 forks source link

YAML metadata? #225

Closed thejohnfreeman closed 8 years ago

thejohnfreeman commented 10 years ago

The metadata supported is not complete YAML. It does not handle lists spanning multiple lines:

entries:
- one
- two
- three

The error:

unexpected "\n"
expecting space followed by metadata for: entries

I got the feeling the metadata parser is something custom written for Hakyll. Would it be possible to just use a general YAML parser?

In my particular case, I have about 7 entries, each with multiple fields, that I use to conveniently generate a portion of my page. It's going to look ugly and unmaintainable if consolidated to a single line.

dikmax commented 10 years ago

It is indeed. And I don't think this behavior will be updated at least until next major version.

BTW, we could use Front-matter parser included in new Pandoc.

jaspervdj commented 10 years ago

Makes sense. Pandoc will need to export the metadata parsing API though (I don't think it currently does).

dikmax commented 10 years ago

I think we could use whole document parsing API. readMarkdown returns Pandoc, which contains Meta field. This field contains all required information.

http://hackage.haskell.org/package/pandoc-types-1.12.3.2/docs/Text-Pandoc-Definition.html#t:Pandoc

nagisa commented 10 years ago

Not all documents that use metadata are parsed with pandoc now. If we parse all documents with pandoc just to get metadata, that's going to be wasteful.

We also must have a capability to retrieve source document body without the metadata. Not sure if pandoc allows that. On Feb 24, 2014 12:19 PM, "Maxim Dikun" notifications@github.com wrote:

I think we could use whole document parsing API. readMarkdown returns Pandoc, which contains Meta field. This field contains all required information.

— Reply to this email directly or view it on GitHubhttps://github.com/jaspervdj/hakyll/issues/225#issuecomment-35872951 .

dikmax commented 10 years ago

Ok. Pandoc uses yaml library for parsing. We could use it too.

thejohnfreeman commented 10 years ago

What's the schedule for the next major version? In the mean time, I could implement my own Hakyll.Core.Compiler to do this, correct?

co-dan commented 10 years ago

+1 for full Yaml support :)

jaspervdj commented 10 years ago

@thejohnfreeman I'll try to target it for next month. Yes, you should be able to do so!

co-dan commented 10 years ago

Do you think it would be possible to include the yaml-parsing feature in the next release? That is, do we have enough time?

On Tue, Feb 25, 2014 at 1:35 PM, Jasper Van der Jeugt < notifications@github.com> wrote:

@thejohnfreeman https://github.com/thejohnfreeman I'll try to target it for next month. Yes, you should be able to do so!

Reply to this email directly or view it on GitHubhttps://github.com/jaspervdj/hakyll/issues/225#issuecomment-35989974 .

Sincerely yours, -- Daniil

jaspervdj commented 10 years ago

I want to release a version this week and it's not going in there, it'll be in the one after that.

xiaohanyu commented 10 years ago

+1

LeviSchuck commented 10 years ago

It would be nice when this does get in.

FranklinChen commented 9 years ago

I just ran across this incompletely YAML support also, when attempting to start migrating an Octopress-based site to Hakyll.

jmatsushita commented 9 years ago

+1 for this. Trying to migrate from metalsmith with YAML frontmatters as well!

gpampara commented 9 years ago

+1 Just hit this issue as well. Would be great to get this corrected

vjeranc commented 9 years ago

Would fixing this enable easier references (without bib and csl files -- assuming we are fine with the defaults) using YAML metadata as described here?

hazybluedot commented 9 years ago

+1 just ran into this trying to port my blog over from nanoc!

justinmanley commented 8 years ago

+1 Full YAML front-matter support would be great!

jaspervdj commented 8 years ago

Hakyll 4.8.0.0 turns Metadata into a YAML object.

thejohnfreeman commented 8 years ago

Perfect timing! Just last week I returned to Hakyll after more studiously learning Haskell over the previous months, with the intention of addressing this issue.

beerendlauwers commented 8 years ago

Stellar. This was a long-standing issue that made Hakyll a hard sell to some clients and managers. Thank you so much for fixing it!