Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A generic interface (or API) for handle text files filtered by Markdown syntax. This API has been extracted from Postview project.
Ruby
branch: news

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
templates
test
.gitignore
.version
CHANGELOG
COPYING
README.rdoc
Rakefile
postage.gemspec

README.rdoc

Postage

Description

A generic interface (API) for handle text files filtered by Markdown or Textile syntax.

Synopsis

Postage is a generic interface (API) which load your text files and handle the contents in Markdown or Textile. It help you handle easily plain text files for parse to HTML.

Example:

require 'postage'

text = Postage::Entry.file("path/to/text_file.mkd")
# => #<Postage::Entry:0x7f4fbd9ad418
#      @file=#<Pathname:path/to/text_file.mkd>>
text.extract_attributes!
# => #<Postage::Entry:0x7f4fbd9ad418
# =>   @filter=:markdown,
# =>   @title="Entry *test*\n============\n",
# =>   @content=["\n",
# =>     "Entry *test*. This content uses [Markdown][] syntax.\n",
# =>     "\n", "[markdown]: http://daringfireball.net/projects/markdown/\n",
# =>     "\n"],
# =>   @file=#<Pathname:path/to/text_file.mkd>>
page = text.to_html
# => "<h1 id='entry_test'>Entry <em>test</em></h1>\n
# =>  \n<p>Entry <em>test</em>. This content uses
# =>  <a href='http://daringfireball.net/projects/markdown/'>Markdown</a>
# =>  syntax.</p>"

For use files as posts in a blog, use Post class.

post = Postage::Post.file("path/to/2009-11-20.post-file-for-a-blog.tagged.tag.mkd")

Requirements

Postage work with following Gems:

That is, you choose your favorite filter for both formats.

Install

Install via RubyGems.

gem install postage

Information

For more information about the project, please visit the following Web sites:

About the lightweight markup languages, please, visit the following Web sites:

Copyright

Copyright © 2009 Hallison Batista

Distributed under the MIT license. See the COPYING file for more info.

Something went wrong with that request. Please try again.