Piki Piki

In a beautiful meta-example of WikiNature, people have evolved PikiPiki into MoinMoin, with lots more features.


In addition, DiamondWiki is based on PikiPiki


PikiPiki is MartinPool's reimplementation of WikiWikiWeb in PythonLanguage, released under the GnuGeneralPublicLicense.

The source is available at http://sourcefrog.net/projects/piki/.

PikiPiki now comes with installation instructions and looks much prettier!

I wanted to write this software because:

Distinguishing features:

I'd like to solve the ReverseLinkDisabled problem, perhaps by distracting SpamBots to a SpiderTrap.

I've just installed it at MincomLtd as a ProjectWiki: it's going pretty well, but it takes a while to get people used to it. (More on this later, but see the discussion in ProjectWiki.)


I look back at this code now a year later and I still like it a lot. I think in some way it is the closest I have come to WabiSabi in code. -- MartinPool


There was formerly a Japanese-localized version of PikiPiki, derived from MoinMoin, but it no longer exists.

The only change to MoinMoin needed by the Japanese version was to insert a META tag to specify the charset. I was amazed myself. :)


Re: SpamBots.

Wiki currently denies access to sites that fetch stuff too quickly. Seems to work well, as the SpamBots can't tell the difference between a normal page and a page with nothing but a nasty message on it.

Have you considered using a "submit" button, as described on the ReverseLinkDisabled page?

If you're really in a bad mood, you could build a SpiderTrap: See http://www.turnstep.com/Spambot/harassment.html and http://www.monkeys.com/wpoison/ [link is dead. according to archive.org, it's been dead since 2002. Happily there are cached versions at archive.org]

I thought I'd probably use some combination of a SpiderTrap and a YouAreDominatingMe? message. The current working version is not public and so doesn't have to worry.


Thanks for making the source available, Martin (and thanks for advancing me a copy after my plea). BTW, it was easy as Py to install -- TimVoght


Can somebody help fix what I think is a PikiPiki bug? Verbatim mode ( three open braces in a row, text, three closed braces in a row ) doesn't seem to handle dashes correctly. It expands dashes to bars (HTML horizontal rules) instead of leaving them as ASCII dashes. Can someone point me in the right direction? My glance at the Python code didn't reveal any obvious defects.


The below code change seems to make PikiPiki handle dashes properly in verbatim mode. I made PikiPiki use a different regular expression scanner when in preformatted mode. If I knew Python, I could make a cleaner fix, but this seems to work.

 $ diff piki.cgi piki_old.cgi
 412,413d411
 <       # When text is in <PRE>formatted mode, don't substitute
 <       # HTML horizontal rules for dashes.
 426,436d423
 <         scan_pre = re.compile(
 <             r"(?:(?P<emph>'{2,3})"
 <             + r"|(?P<ent>[<>&])"
 <             + r"|(?P<word>\b(?:[A-Z][a-z]+){2,}\b)"
 <             + r"|(?P<url>(http|ftp|nntp|news|mailto)\:[^\s'\"]+\S)"
 <             + r"|(?P<email>[-\w._+]+\@[\w.-]+)"
 <             + r"|(?P<li>^\s+\*)"
 <             + r"|(?P<pre>(\{\{\{|\}\}\}))"
 <             + r"|(?P<macro>\[\[(TitleSearch|FullSearch|WordIndex"
 <                             + r"|TitleIndex?|RecentChanges|GoTo)\]\])"
 <             + r")")
 450,452c437
 <                 print re.sub(scan_re, self.replace, line)
 <             else:
 <                 print re.sub(scan_pre, self.replace, line)
 ---
 >             print re.sub(scan_re, self.replace, line)


Hi, does this do what you want? -- AndreasMeyer

 $ diff piki.cgi piki.cgi.new
 416c416
 <             + r"|(?P<rule>-{4,})"
 ---
 >             + r"|(?P<rule>^-{4,})"


The above looks like it will only convert a line of dashes to a horizontal rule if the line of dashes starts the beginning of a line. I don't think this does what I want, because preformatted text could also have a string of dashes that starts at the beginning of the line.


Dashes isn't the problem, but anything inside braces works like outside; try to insert any text inside double quotes and it will be italicized. This hopefully will fix the problem:

    def _pre_repl(self, word):
        if word == '{{{' and not self.in_pre:
            self.in_pre = 1
            return '<pre>'
        elif self.in_pre:
            self.in_pre = 0
            return '</pre>'
        else:
            return word

def replace(self, match): for type, hit in match.groupdict().items(): if hit: if (not self.in_pre or self.in_pre and hit == '}}}'): return getattr(self, '_' + type + '_repl')(hit) else: return hit else: "Can't handle match " + repr(match)

def print_html(self): # For each line, we scan through looking for magic # strings, outputting verbatim any intervening text scan_re = re.compile( r"(?:(?P<emph>'{2,3})" + r"|(?P<ent>[<>&])" + r"|(?P<word>\b(?:[A-Z][a-z]+){2,}\b)" + r"|(?P<rule>-{4,})" + r"|(?P<url>(http|ftp|nntp|news|mailto)\:[^\s'\"]+\S)" + r"|(?P<email>[-\w._+]+\@[\w.-]+)" + r"|(?P<li>^\s+\*)" + r"|(?P<pre>(\{\{\{|\}\}\}))" + r"|(?P<macro>\[\[(TitleSearch|FullSearch|WordIndex" + r"|TitleIndex?|RecentChanges|GoTo)\]\])" + r")") blank_re = re.compile("^\s*$") bullet_re = re.compile("^\s+\*") indent_re = re.compile("^\s*") eol_re = re.compile(r'\r?\n') raw = self.raw.expandtabs() for line in eol_re.split(raw): if not self.in_pre: if blank_re.match(line): print '<p>' continue indent = indent_re.match(line) print self._indent_to(len(indent.group(0))) print re.sub(scan_re, self.replace, line) if self.in_pre: print '</pre>' print self._undent()


See WikiWikiClone MyConfusedIdeaOfWiki



CategoryWikiImplementation


EditText of this page (last edited March 7, 2011) or FindPage with title or text search

Meatball   Wikibase