Introduction
A content parser and renderer with embedded metadata support.
http://sw.cow.tc/mbrao
http://rdoc.info/gems/mbrao
Usage
mbrao is a content parser and renderer framework for managing posts which have both metadata and content.
First of all a big thanks to the metadown project which gave me the final idea.
Using mbrao is pretty simple. First of all you have to parse a file with a parsing engine:
ruby
content = Mbrao::Parser.parse(File.read("/your/content.txt")
The default is a plain text reader. This engine reads a text file and parse metadata embedded between {{metadata}}
and {{/metadata}}
tag in YAML format.
The method above will return a Content
object which you can use in your code. This object has builtin support for title, body and tags metadata; all with locale support.
There is also locale filtering. See documentation for more information.
At the end, you can render the content using any engine of your choice:
ruby
Mbrao::Parser.render(content)
The default is a html-pipeline renderer with kramdown support.
Ruby on Rails support
mbrao has support for integrations with other frameworks. Builtin there is support for Ruby on Rails integration.
By including gem mbrao
in your Gemfile
you’ll get automatic rendering of emt
file.
You can customize the rendering engine used by including the engine
metadata. Also, your controller will get a new mbrao_content
helper method with the parsed content.
Contributing to mbrao
- Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.
- Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.
- Fork the project.
- Start a feature/bugfix branch.
- Commit and push until you are happy with your contribution.
- Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright
Copyright (C) 2013 and above Shogun (shogun@cowtech.it).
Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.