*** RBPAR README ***

INTRODUCTION

rbpar is a program and an accompanying library suite meant for formatting text paragraphs. The library includes an implementation of the optimal line breaking algorithm by Donald E. Knuth and a semi-intelligent paragraph parser that is not confused by email quotes. This is due to the fact that rbpar was first designed for email writing.

The program executable ‘rbpar.rb’ is installed to the executable path by default. The program read input from STDIN and outputs formatted paragraphs to STDOUT.

INSTALLATION

If you received rbpar gem, you can install the gem with “gem install rbpar-0.1.0.gem”. An easier alternative is to use rubygems to download and install it directly with “gem install rbpar”. The file rbpar.rb should be automaticly added to your path.

USAGE

rbpar.rb [-v] [-w <number>]

rbpar.rb accepts the following parameters:

-v, --vim :     Use vim-style line endings (with an ending space)
-w, --width:    Set the desired line width

Example usage to format a text file:

cat unprocessed.txt | rbpar.rb > processed.txt

VIM INTEGRATION

To make vim ‘gq’ operator use rbpar, use the following command either in vim command menu or in your vimrc file:

set formatprg=rbpar.rb\ -w\ 63\ -v

This sets the desired line width to be 62 characters. One extra space is inserted after every line that does not end a paragraph. This enables vim (with format-option ‘w’) to understand the paragraph lines. This is handy when using the ‘auto-format’ format option. See vim help for “formatoptions”, “fo-table” and “auto-format” for details.

CONTACT

Please email comments and suggestions to <[email protected]>.