mbrao

A content parser and renderer with embedded metadata support.

View on GitHub

Introduction

Gem Version Dependency Status Build Status Code Climate Coverage Status

A content parser and renderer with embedded metadata support.

https://sw.cowtech.it/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:

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:

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.

API Documentation

The API documentation can be found here.

Contributing to mbrao

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.

Your browser is obsolete. For the best browsing experience, update it for free by visiting BrowseHappy.
Made by a proud Italian!