0

Is there any wiki module for asp.net mvc or soemthign that can be adapted with relative ease :)

alternatively, are there any formatters for the wiki markup which perhaps implment the most common wiki markup formatting etc.

Kumar
  • 10,997
  • 13
  • 84
  • 134

3 Answers3

1

try

MiniWiki

It's pretty easy to customise.

griegs
  • 22,624
  • 33
  • 128
  • 205
  • scanned through that, couldn't find info on the markup, any help on that ? – Kumar Jul 15 '09 at 00:21
  • The markup is in the code. It uses a weird notation to create a link to a new page but it works fine. I modified the code in mine to accept a better notation and it only took about an hour to understand and customise. Take a look in the file WikiToHtmlFormatter.cs in MiniWiki.DomainModel for details. – griegs Jul 15 '09 at 00:24
  • i traced the value backwards from 8 and went all the way in code to 7 but lost it somewhere along the way, perhaps if you know of the markup required to generate the tag i can step through it that way – Kumar Jul 15 '09 at 18:46
  • Strangely enough that's the exact tag I modified because it made little sense to me. I no longer have the original code but from what I remember is that if you have two capital letters in the same word it made it a link to a new page. So check my next answer because i changed it so that anything enclosed in [] is an anchor link to a new or existing page. – griegs Jul 16 '09 at 03:00
1

A new mvc4-based wiki engine has been released at http://lynxwiki.codeplex.com with a running version of the engine at http://www.sapientier.com:88/LynxWiki/WikiTopic/Page/WikiRoot/WikiDir/HomePage

This is a full-featured wiki with many of the features of MediaWiki plus it has the capability for dynamic content by using embedded IronPython scripting

John Davidson
  • 637
  • 5
  • 11
  • 1
    Welcome to Stack Overflow! Thanks for posting your answer! Please be sure to read the [FAQ on Self-Promotion](http://stackoverflow.com/faq#promotion) carefully. Also note that it is *required* that you post a disclaimer every time you link to your own site/product. – Andrew Barber Mar 14 '13 at 20:29
0
    private void ProcessLine(string line, TextWriter writer)
    {
        int state = 0;
        int i = 0;
        int wordStart = 0;
        Action encode = () => HttpUtility.HtmlEncode(line[i].ToString(), writer);
        Func<bool> isws = () => Char.IsWhiteSpace(line[i]);

        for (i = 0; i < line.Length; ++i)
        {
            switch (state)
            {
                case 0:
                    if (line[i] == '*')
                    {
                        state = 1;
                    }
                    else if (line[i] == '/')
                    {
                        state = 4;
                    }
                    else if (line[i] == '[')
                    {
                        wordStart = i + 1;
                        state = 7;
                    }
                    else
                    {
                        encode();
                    }
                    break;

                case 1: //Start bold
                    if (isws())
                    {
                        encode();
                        state = 0;
                    }
                    else
                    {
                        writer.Write("<b>");
                        encode();
                        state = 2;
                    }
                    break;

                case 2: //End bold
                    if (isws())
                    {
                        encode();
                        state = 3;
                    }
                    else if (line[i] == '*')
                    {
                        writer.Write("</b>");
                        state = 0;
                    }
                    else
                    {
                        encode();
                    }
                    break;

                case 3:
                    if (isws())
                    {
                        encode();
                    }
                    else
                    {
                        encode();
                        state = 2;
                    }
                    break;

                case 4: //Start italics
                    if (isws())
                    {
                        HttpUtility.HtmlEncode("/ ", writer);
                        state = 0;
                    }
                    else
                    {
                        writer.Write("<i>");
                        encode();
                        state = 5;
                    }
                    break;

                case 5: //End italics
                    if (isws())
                    {
                        encode();
                        state = 6;
                    }
                    else if (line[i] == '/')
                    {
                        writer.Write("</i>");
                        state = 0;
                    }
                    else
                    {
                        encode();
                    }
                    break;

                case 6:
                    if (isws())
                    {
                        encode();
                    }
                    else
                    {
                        encode();
                        state = 5;
                    }
                    break;

                case 7: //Start link
                    state = 8;
                    break;
                case 8: //End link
                    if (line[i] == ']')
                    {
                        WriteLink(line.Substring(wordStart, i - wordStart), writer);
                        state = 0;
                    }
                    break;
            }
        }

        // Clean up italics, bold etc. based on the state we were in at the end of the line.
        switch (state)
        {
            case 0:
                break;
            case 1:
                HttpUtility.HtmlEncode("*", writer);
                break;
            case 2:
            case 3:
                writer.Write("</b>");
                break;
            case 4:
                HttpUtility.HtmlEncode("/", writer);
                break;
            case 5:
            case 6:
                writer.Write("</i>");
                break;
            case 7:
                HttpUtility.HtmlEncode(line.Substring(wordStart), writer);
                break;
            case 8:
                WriteLink(line.Substring(wordStart), writer);
                break;
        }

    }
griegs
  • 22,624
  • 33
  • 128
  • 205
  • The above code changes the behaviour such that anything enclosed in [] is made a link to a new or existing page. Hope this is what you were after Kumar. – griegs Jul 16 '09 at 03:01