waiting-for-dev / front_matter_parser

Ruby library to parse files or strings with a front matter. It has automatic syntax detection.
MIT License
105 stars 12 forks source link

Bring back .parse #1

Closed icco closed 7 years ago

icco commented 7 years ago

I would love if I could call parse on a string, which doesn't seem to work with the new rewrite. I tried the following three, and all throw exceptions.

FrontMatterParser.parse(body)
prsr = FrontMatterParser::Parser.new(:slim)
fmp = prsr.parse(body)
FrontMatterParser::Parser.parse(body)
icco commented 7 years ago

Thoughts @waiting-for-dev?

waiting-for-dev commented 7 years ago

Hi @icco ,

I now see that I made a mistake in the README. The method to parse a string has been renamed to call (as instance method):

prsr = FrontMatterParser::Parser.new(:slim)
fmp = prsr.call(body)

This has been a major rewrite of the library. From now on you can expect the API to be more stable.

The README is now fixed.

icco commented 7 years ago

That works, thanks!