A wiki markup class

P

Peter Hickman

Is there a class that can convert ordinary wiki mark-up into html and
all that? I don't want the whole of the wiki stuff just the parser.

I've looked at redcloth / textile which is very nice but I want a more
/normal/ wiki mark-up.

Any ideas?
 
D

Dave Burt

Peter Hickman asked:
Is there a class that can convert ordinary wiki mark-up into html and all
that? I don't want the whole of the wiki stuff just the parser.

I've looked at redcloth / textile which is very nice but I want a more
/normal/ wiki mark-up.

Redcloth also supports Markdown. Bluecloth is markdown-only.

Cheers,
Dave
 
L

Lyndon Samson

I wrote a little wiki for fun.

class LykiInterpreter
def LykiInterpreter.interpret(pageBody)
pb=3DpageBody.clone
regExps =3D []
regExps << ['(?:[^=3D>]|\A)([A-Z]{1}\w+[A-Z]{1}\w+)','<a
href=3D"?pageId=3D\1">\1</a>']
regExps << ['^ [*](.*)$','<li>\1</li>']
regExps << ['\r','<br/>']
regExps << ['\[\[','<b>']
regExps << ['\]\]','</b>']
regExps << ['"""""(.*?)"""""','<b><i>\1</i></b>']
regExps << ['"""(.*?)"""','<b>\1</b>']
regExps << ['""(.*?)""','<i>\1</i>']
regExps << ['\{\{\{','<pre>']
regExps << ['}}}','</pre>']

regExps.each_index{|i|
regExp =3D Regexp.new(regExps[0],Regexp::MULTILINE)
while pb.sub!(regExp,regExps[1]) !=3D nil do
puts "Sub #{pb}"
end

}

pb
end
end

Its not really robust or efficient, but it seems to work ok. the
syntax is from vqwiki, which I don't know if thats 'standard' wiki or
not. Creating the array and the Regexp objects each call is not clever
either :)
 
P

Patrick Gundlach

Hi,
Is there a class that can convert ordinary wiki mark-up into html and
all that? I don't want the whole of the wiki stuff just the parser.
I've looked at redcloth / textile which is very nice but I want a more
/normal/ wiki mark-up.

Whatever 'normal' means...

I have almost finished a mediawiki to xml/html parser. You can contact
me off-list at <pg <at> levana . de> or (for a short time) at the
address found in the header.

Patrick
 
G

Gavin Kistner

Is there a class that can convert ordinary wiki mark-up into html
and all that? I don't want the whole of the wiki stuff just the
parser.

I've looked at redcloth / textile which is very nice but I want a
more /normal/ wiki mark-up.

Any ideas?

TagTreeScanner is a class I wrote for describing any wiki markup you
like.
The documentation has a couple examples, and it was used to create
the OWLScribble markup.

http://phrogz.net/RubyLibs/OWLScribble/doc/tts.html

I sort of stalled in trying to get it packaged up nicely as a gem and
all, but you can download the library, OWLScribble, and some other
tests from here:
http://phrogz.net/RubyLibs/TagTreeScanner.zip
 
P

Phlip

Peter said:
Is there a class that can convert ordinary wiki mark-up into html and
all that? I don't want the whole of the wiki stuff just the parser.

I've looked at redcloth / textile which is very nice but I want a more
/normal/ wiki mark-up.

You could rip WikiFormatter class from MiniRubyWiki:

def test_simpleWikiMarkup()
aFormatter = WikiFormatter.new()
aFormatter.format("this is ''em''phatic\nthis is '''strong'''")
expect = "this is <em>em</em>phatic\nthis is
<strong>strong</strong>\n"
assert_equal expect, aFormatter.x.contents
end

Warning: You should rip the class, not try to "share" it with MRW, because
it's not productized or installable or any of those nice-to-haves.

http://rubyforge.org/cgi-bin/viewcvs.cgi/cvs_root.tar.gz?tarball=1&cvsroot=minirubywiki

Warning 2: Don't try the EXE; per my other thread here, I have not been able
to upgrade it yet.
 
P

Phlip

Lyndon Samson wrote a little wiki for fun:

class LykiInterpreter
def LykiInterpreter.interpret(pageBody)
pb=pageBody.clone
regExps = []
regExps << ['(?:[^=>]|\A)([A-Z]{1}\w+[A-Z]{1}\w+)','<a
href="?pageId=\1">\1</a>']
regExps << ['^ [*](.*)$','<li>\1</li>']
regExps << ['\r','<br/>']
regExps << ['\[\[','<b>']
regExps << ['\]\]','</b>']
regExps << ['"""""(.*?)"""""','<b><i>\1</i></b>']
regExps << ['"""(.*?)"""','<b>\1</b>']
regExps << ['""(.*?)""','<i>\1</i>']
regExps << ['\{\{\{','<pre>']
regExps << ['}}}','</pre>']

regExps.each_index{|i| ...

Here:

http://c2.com/cgi/wiki?WikiStyleSheet

Now you can edit the advanced Wiki tags in a Wiki page.
 
T

Thomas

Peter said:
Is there a class that can convert ordinary wiki mark-up into html and
all that? I don't want the whole of the wiki stuff just the parser.

I've looked at redcloth / textile which is very nice but I want a more
/normal/ wiki mark-up.

Depending on your needs, deplate[1] is probably a little bit too big.
But it shouldn't be too difficult to adapt it for any simple wiki markup
and can create output to html, latex, and docbook.

Cheers,
Thomas.

[1] http://deplate.sf.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top