All Projects → xwmx → Rbst

xwmx / Rbst

Licence: mit
A Ruby gem for processing reStructuredText via Python's Docutils

Programming Languages

python
139335 projects - #7 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Rbst

Badges
📝 Markdown code for lots of small badges 🎀 📌 (shields.io, forthebadge.com etc) 😎. Contributions are welcome! Please add yours!
Stars: ✭ 2,987 (+16494.44%)
Mutual labels:  markup, restructuredtext
Python Creole
Creole markup tools written in Python.
Stars: ✭ 55 (+205.56%)
Mutual labels:  markup, restructuredtext
Pandoc Ruby
Ruby wrapper for Pandoc
Stars: ✭ 299 (+1561.11%)
Mutual labels:  markup, restructuredtext
Django Markupfield
📑 a MarkupField for Django
Stars: ✭ 184 (+922.22%)
Mutual labels:  markup, restructuredtext
Markup.rocks
Pandoc based document editor and converter in your browser.
Stars: ✭ 348 (+1833.33%)
Mutual labels:  markup
chaarts
Charts with HTML & CSS
Stars: ✭ 79 (+338.89%)
Mutual labels:  markup
yozuch
reStructuredText based static blog generator
Stars: ✭ 28 (+55.56%)
Mutual labels:  restructuredtext
codewriting
Source for Codewriting (book) and the Codewriting/Code the Docs (site/blog)
Stars: ✭ 49 (+172.22%)
Mutual labels:  markup
Pandoc
Universal markup converter
Stars: ✭ 24,250 (+134622.22%)
Mutual labels:  markup
Pytablewriter
pytablewriter is a Python library to write a table in various formats: CSV / Elasticsearch / HTML / JavaScript / JSON / LaTeX / LDJSON / LTSV / Markdown / MediaWiki / NumPy / Excel / Pandas / Python / reStructuredText / SQLite / TOML / TSV.
Stars: ✭ 422 (+2244.44%)
Mutual labels:  restructuredtext
Webmarkupmin
The Web Markup Minifier (abbreviated WebMarkupMin) - a .NET library that contains a set of markup minifiers. The objective of this project is to improve the performance of web applications by reducing the size of HTML, XHTML and XML code.
Stars: ✭ 312 (+1633.33%)
Mutual labels:  markup
Deck
Slide Decks
Stars: ✭ 261 (+1350%)
Mutual labels:  markup
Rinohtype
The Python document processor
Stars: ✭ 365 (+1927.78%)
Mutual labels:  restructuredtext
xast
Extensible Abstract Syntax Tree
Stars: ✭ 32 (+77.78%)
Mutual labels:  markup
Redpen
RedPen is an open source proofreading tool to check if your technical documents meet the writing standard. RedPen supports various markup text formats (Markdown, Textile, AsciiDoc, Re:VIEW, reStructuredText and LaTeX).
Stars: ✭ 466 (+2488.89%)
Mutual labels:  restructuredtext
inkling
Limited Rust implementation of the Ink markup/scripting language for game narratives
Stars: ✭ 22 (+22.22%)
Mutual labels:  markup
Breakdance
It's time for your markup to get down! HTML to markdown converter. Breakdance is a highly pluggable, flexible and easy to use.
Stars: ✭ 418 (+2222.22%)
Mutual labels:  markup
Waliki
A wiki engine powered by Django and Git
Stars: ✭ 300 (+1566.67%)
Mutual labels:  restructuredtext
M.css
A no-nonsense, no-JavaScript CSS framework and Pelican theme for content-oriented websites
Stars: ✭ 296 (+1544.44%)
Mutual labels:  restructuredtext
Slime
Minimalistic HTML templates for Elixir, inspired by Slim.
Stars: ✭ 315 (+1650%)
Mutual labels:  markup

RbST

Build Status

A Ruby gem for processing reStructuredText via Python's Docutils.

Installation

Python 2.3+ (or 3.3+) is required.

RbST is available on RubyGems:

gem install RbST

To install with Bundler, add the following to your Gemfile:

gem 'RbST'

Then run bundle install

Usage

require 'rbst'
@latex = RbST.new('*hello*').to_latex

This takes the reStructuredText formatted string and converts it to LaTeX.

The first argument can be either a string or an array of one or more file paths. The files will be concatenated together with a blank line between each and used as input.

# One file path as a single-element array.
RbST.new(['/path/to/file.rst']).to_html

# Multiple file paths as an array.
RbST.new(['/path/to/file1.rst', '/path/to/file2.rst']).to_html

You can also use the convert class method to output HTML:

puts RbST.convert('*hello*')
#=> "<div class=\"document\">\n<p><em>hello</em></p>\n</div>\n"

Arguments can be passed to #to_html, #to_latex, new or convert, accepting symbols or strings for options without arguments and hashes of strings or symbols for options with arguments.

puts RbST.new('.. a comment').to_html('strip-comments')
# => '<div class="document">\n</div>'

Options passed as string use hyphens while symbols use underscores. For instance, the above could also be written as:

puts RbST.new('.. a comment').to_html(:strip_comments)
# => '<div class="document">\n</div>'

Document parts can also be specified with the :parts option.

puts RbST.new('hello world').to_html(:part => :fragment)
# => '<p>hello world</p>'

By default, RbST uses the html_body part for HTML and the whole part for LaTeX.

Available options can be viewed using the RbST.html_options and RbST.latex_options class methods.

You might run into a situation where you want to specify a custom script for processing one or both of the output formats. If so, just specify the full path to the custom script for the format by passing a hash to the RbST.executables= method:

RbST.executables = {:html => '/some/other/path/2html.py'}

# uses custom executable for outputting html
RbST.new('*hello*').to_html

# uses default executable for latex since a custom one wasn't specified
RbST.new('*hello*').to_latex

Similarly, if you want to explicitly specify which python executable to use, set the path with the RbST.python_path= method:

RbST.python_path = '/usr/bin/env python3'
RbST.new('*hello*').to_latex

For more information on reStructuredText, see the ReST documentation.

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright (c) 2009 William Melody. See LICENSE for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].