A wiki markup class

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?

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

I 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|
      regExp = Regexp.new(regExps[i][0],Regexp::MULTILINE)
      while pb.sub!(regExp,regExps[i][1]) != 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 :slight_smile:

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

http://projects.netlab.jp/hikidoc/

syntax: http://projects.netlab.jp/hikidoc/?TextFormattingRules

···

On Mon, Nov 07, 2005 at 07:30:56PM +0900, Peter Hickman wrote:

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.

--
Mauricio Fernandez

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

···

On Nov 7, 2005, at 3:30 AM, Peter Hickman wrote:

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?

Peter Hickman wrote:

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

I personaly like RDoc's syntax. It's really easy to expand, and it
doesn't try to allow too much formatting.

You would want to extend: SM::SimpleMarkup and SM::ToHtml. If you'd
like some examples let me know.

For reference:
  http://ruby-doc.org/stdlib/libdoc/rdoc/rdoc/index.html

  .adam sanderson

Peter Hickman wrote:

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.

···

--
  Phlip
  greencheese.org <-- NOT a blog!!!

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.

···

--
  Phlip
  http://www.greencheese.org/ZeekLand <-- NOT a blog!!!