Writetheman
Create, show and list the middleman blog articles.
It's used by my middleman editor RailsTheMan to manage articles in the browser.
Installation
gem install writetheman
Usage
Init
Config the path of your local middleman :
article = Writetheman::Article::Base.new(yourpath)
blog = Writetheman::Blog.new(yourpath)
Init the article :
article.title = title
article.date = date
article.body = body
article.header = header # string
OR article.header_params = {'tags'=>tags}
Operations
Create a new article :
article.create
Update an article :
article.update(oldfilename)
Read an article file
article.load_from_file(filename)
OR article.load_from_title(title, date)
After loading it you have access to the article attributes
puts(article.title)
puts(article.tags)
puts(article.str_date)
puts(article.body)
List articles :
articles = blog.list_articles
To improve
I writed it to use with a html text editor (see my rails admin).
But more often, the html generated by editors is ugly.
I tried to deal with it, but I'm not happy with this code.
Also it should be better separated, or moved in another gem.
License
MIT, have fun