Need simplemarkup example

Hi

Does someone have an example using simplemarkup to convert a text
file to an HTML file?

I am looking at the code, but I don’t see any examples that
I can understand and that run.

For example, here is a common thing I am running into:

% dir
total 48
drwxrwxr-x 3 jfn cad 4096 Feb 13 14:48 ./
drwxrwxr-x 6 jfn cad 4096 Feb 13 14:48 …/
drwxrwxr-x 2 jfn cad 4096 Feb 13 14:48 CVS/
-rw-rw-r-- 1 jfn cad 6077 Dec 17 2001 h.html
-rw-rw-r-- 1 jfn cad 1091 Feb 13 15:15 sample.rb
% ruby
sample.rb
sample.rb:35:in initialize': wrong number of arguments(1 for 0) (ArgumentError) from sample.rb:35:innew’
from sample.rb:35

···


Jim Freeze

On a paper submitted by a physicist colleague:

“This isn’t right. This isn’t even wrong.”
– Wolfgang Pauli

Jim Freeze wrote:

Hi

Does someone have an example using simplemarkup to convert a text
file to an HTML file?

Jim:

How about this, which converts a file on stdin to HTML on stdout:

require ‘markup/simple_markup’
require ‘markup/simple_markup/to_html’

markup = SM::SimpleMarkup.new
html = SM::ToHtml.new
puts markup.convert(ARGF.read, html)

Of course the fun comes when you add your own special sequences to the
parsers (for example to handle hyperlinking and other good stuff). There
are examples of doing this in RDoc and RubLog.

Cheers

Dave

Thanks Dave. I’ll look into this.

Jim

···

On Friday, 14 February 2003 at 6:07:09 +0900, Dave Thomas wrote:

Jim Freeze wrote:

Hi

Does someone have an example using simplemarkup to convert a text
file to an HTML file?

Jim:

How about this, which converts a file on stdin to HTML on stdout:

require ‘markup/simple_markup’
require ‘markup/simple_markup/to_html’

markup = SM::SimpleMarkup.new
html = SM::ToHtml.new
puts markup.convert(ARGF.read, html)

Of course the fun comes when you add your own special sequences to the
parsers (for example to handle hyperlinking and other good stuff). There
are examples of doing this in RDoc and RubLog.

Cheers


Jim Freeze

Modern man is the missing link between apes and human beings.