Menu

Mediawiki parser in wikindx

2010-12-16
2013-01-28
  • Slawomir Wawak

    Slawomir Wawak - 2010-12-16

    Hi!
    I'd like to put mediawiki parser into wikindx code (it's faster than using bbcode). There is ready to use parser at http://johbuc6.coconia.net/doku.php/mediawiki2html_machine/code (works nice). Where to put this code in wikindx? I tried file HTML.php in core/html codeToHTML and stripPPCode  functions, but it didn't work as it should. :-(

     
  • Mark Grimshaw

    Mark Grimshaw - 2010-12-16

    Hi,

    Thanks for this - all help much appreciated.  If I understand correctly, the parser functions a bit like using BBCode in wikindx quotes, paraphrases and so on but uses mediawiki markup instead.  In other words, the parser converts mediawiki markup in database fields to html for display in the browser.

    If this is the case, I suggest:
    a)  you make a separate class and separate file for all the parser functions and put it into /core/html/
    b)  the simplest, roughest way would be to put the start function for the parser at the top of HTML::codeToHtml() at line 41 so that mediawiki code is parsed before any BBCode.

    I say it's the roughest way.  I'm unfamiliar with mediawiki code but, if it allows for specifying the size of images, for example, you'll notice that codeToHtml() handles image sizes but also compares them to system set sizes picked up through sessions.  It might be worthwhile getting it to work roughly then figure out if you need to be a bit more precise.

    If you do get it working, please let me have the code so I can integrate it into v4 which I'm working on.  BBCode is getting a little old so it might be worth it to scrap that and go entirely to mediawiki markup (there are other advantages to doing that too).

    Mark

     
  • Slawomir Wawak

    Slawomir Wawak - 2010-12-16

    Thanks for answer.
    To mark text as bold in bbcode you have to use 4 different keys on your keyboard: text . In mediawiki only one (4 times): ' ' text ' '. It is much faster. The same with italic (' ' ').
    The code must be inserted after bbcode parser, because there is one conflict -  stands in mediawiki for url, so every bbcode would be changed into url.
    Today I tried to make it run, but I got blank page every time even with no errors. Does wikindx block information about errors? How to turn it off? (in my php.ini it is turned on).
    I keep trying. :-)
    Regards,
    Slawek.

     
  • Mark Grimshaw

    Mark Grimshaw - 2010-12-16

    Hi Slawek,

    Error reporting is turned on in wikindx3/config.php

    It sounds like I should convert v4 to mediawiki code entirely.  In converting the SUWP to multi-author functionality, it might be worthwhile to make it more wiki like too.  So, there are all sorts of advantages to moving away from BBCode.

    Mark

     
  • Slawomir Wawak

    Slawomir Wawak - 2010-12-16

    Ok. So finally it works. :-)

    It is very simple parser, but it has the most important functions:
    ' ' bold ' ' (without spaces!)
    ' ' '  italic ' ' '

    tables:
    {|  -> start table
    {| border="1" width="100%"  == <table border="1" width="100%">
    ! align=center | text == <th align=center> text</th>
    | text = <td>text</td>
    |- = </tr><tr> (new row)
    |} == </table>

    links:
    == <a href=http://example.com>link</a>

    and some others…

    It needs some testing of course. :-)

    How can I send you the file?
    Slawek.

     
  • Mark Grimshaw

    Mark Grimshaw - 2010-12-17

    Hi Slawek,

    You should be able to send it to my sirfragalot@users.sourceforget.net address.  There's no rush so do some testing and enhancement first.

    Mark

     

Log in to post a comment.