[[https://secure.travis-ci.org/wallyqs/org-ruby.png?branch=master]]
An [[http://orgmode.org][Org-mode]] parser written in Ruby.
/Originally by Brian Dewey/
** Installation
gem install org-ruby
** Usage
From Ruby:
require 'org-ruby'
Orgmode::Parser.new("* Hello world!").to_html
Orgmode::Parser.new("* Hello world!").to_textile
Orgmode::Parser.new("* Hello world!").to_markdown
Orgmode::Parser.new(" Custom* /Markup/", { markup_file: "html.tags.yml" }).to_html
Orgmode::Parser.new(" Custom* /Markup/", { markup_file: "md.tags.yml"}).to_markdown
The supported output exporters can be also called from the command line:
org-ruby --translate html sample.org
org-ruby --translate textile sample.org
org-ruby --translate markdown sample.org
org-ruby --markup html.tags.yml sample.org
org-ruby --markup md.tags.yml --translate markdown sample.org
** Current status
Not all of the [[http://orgmode.org/manual/][Org mode features]] are implemented yet. Currently, the development of the gem is mostly oriented towards giving support for exporting Org mode into other formats.
Brief list of features supported:
** Custom Markup
Org-ruby supports custom markups for HTML and Markdown. The custom markup needs to be in the form of a YAML file with the following keys and values:
*** HTML Blocktags
:HtmlBlockTag: :paragraph: p :ordered_list: ol :unordered_list: ul :list_item: li :definition_list: dl :definition_term: dt :definition_descr: dd :table: table :table_row: tr :quote: blockquote :example: pre :src: pre :inline_example: pre :center: div :heading1: h1 :heading2: h2 :heading3: h3 :heading4: h4 :heading5: h5 :heading6: h6 :title: h1
For example, you only want to change the blockquote HTML tag to be translated, your YAML file would look like this:
:HtmlBlockTag: :quote: pre
This will change the HTML markup to be translated in the blockquote element.
*** HTML Emphasis:
:Tags:
"*":
:open: b
:close: b
"/":
:open: i
:close: i
"_":
:open: span style=\"text-decoration:underline;\"
:close: span
"=":
:open: code
:close: code
"~":
:open: code
:close: code
"+":
:open: del
:close: del
Let's say that you prefer == over == in the Bold emphasis element of Org-mode, your YAML file should look like this:
:Tags: "*": :open: strong :close: strong "/": :open: em :close: em
*** Markdown:
:MarkdownMap:
"*": "*"
"/": ""
"_": "*"
"=": "" "~": "
"
"+": "~~"
Let's say that you prefer underscores for Bold and Italics elements in Markdown, your YAML file should look like this:
:MarkdownMap: "*": "_" "/": ""
** Contributing
** Projects using it
** License
(The MIT License)
Copyright (c) 2009 Brian Dewey
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.