Size: 10886
Comment:
|
Size: 10978
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 51: | Line 51: |
That's a much more elegant solution then mine - good idea. -- JosYule [[DateTime()]] |
Why and Wherefore
I've been using several different wiki tools over the past few years, both at work and home. Zwiki, UseMod and now MoinMoin have seen use. I'm currently enamoured with MoinMoin as it's in Python, like Zwiki, but much easier to code for. Here are a list of some of the ideas that i've been working on in MoinMoin.
You can reach me at MailTo(jos AT theorganization NOSPAM DOT net).
Pages i'm following
Wiki as a ProjectManagement tool
Really, there is more to come here!
Wiki as a game playing platform
I really like how easy it is to both code up a rules engine (a macro), and the framework that the wiki offers (pages for move entry), when looking at Moin as a game playing tool.
Rock Paper Scissors
I just uploaded my rock-paper-scissors game macro to the MacroMarket (see MacroMarket/RockPaperScissors).
Checkers links and things
http://www.jimloy.com/checkers/rules.htm The Standard Laws of Checkers
http://www.acfcheckers.com/ American Checkers Federation
http://www.jimloy.com/checkers/numbered.htm The numbered Checker board - excellent! This is all i need to get started!
Patches and other code goodies
Footnotes macro
There is a request (see MoinMoinTodo Release 1.3) for the footnotes macro to be able to display wiki markup.
I've got a version of this running, but it required some largish hacking on the MoinMoin\parser\wiki.py file to get to work.
I had to add a new format function, one that, rather then using self.request.write to output its results, it simply adds to a string (self.output), which it then returns. I added the following function (attachment:formatInMemory.py) (please note, all i did was to copy the base format function, and replace all the request.write calls to self.output += blah_blah().) to MoinMoin\parser\wiki.py.
What about changing the format method to accept an output stream keyword arg, which defaults to request? So you could just give format a StringIO instance and removes the redundant formatInMemory method which only duplicates code. -- OliverGraf DateTime(2004-07-20T11:11:28Z)
See ["MoinMoinTodo/Release 1.3"] for my alternate diff. -- OliverGraf DateTime(2004-07-20T11:25:12Z)
That's a much more elegant solution then mine - good idea. -- JosYule DateTime()
Also, changes were made to macro\FootNote.py. You can use the diff (attachment:footnotediff.txt) or copy and paste the new code /FootNotesCode.
Yay! Very cool, that's great!
-- Adam.
Form
I've gotten forms working to the point where i can define a form in the wiki, and have the date update or create a new page. It requires the the following diff to the form.py macro: attachment:form.py.diff
What this does is allows for 2 extra args to the form macro. The name of the action (formaction) you want executed and the page that you want the output of the action to affect (addtopage). Only the formaction arg is required. So, you can now put actions into the action folder and submit data to them with from a form. See the example below.
Example
Here is an example which uses a form to post blog-like entries.
The form itself (on a page called BlogForm)
#form type=caption name=dummy label="Weblog Entry Form" #form type=text name=headline label="Headline" size=40 maxlength=50 #form type=textarea name=text label="Text" rows=10 cols=60 #form type=submit name=save label="Add entry"
The blogpost.py action that will be called (put this into the action folder): attachment:blogpost.py
And the macro call to Form:
[[Form(BlogForm,blogpost,JosYule/MyBlog)]]
The actual post is created on a subpage of JosYule/MyBlog. I've got the MonthCalendar macro running on the /MyBlog page, and the Form creates new posts on sub-pages of /MyBlog in the same format as MonthCalendar, allowing easy use of the wiki:macro/IncludePages macro to create a blog like thing.
Trackback
I've stopped dev on this till i can get TLA/Arch working on my windows box. Hopefully sometime in the next 2 weeks i'll have this up and running, and will get back to dev on this.
I've had some great feedback to the work that i've done on the trackback project so far. One of the first things i've got to fix is how the trackback.py action get called, as it was pointed out to me that they way i currently have it, it will only work for CGI based installs. It was suggested to me to use some kind of name suffix, like __trackback__ (JosYule__trackback__), which could be checked for in request.py at the same time that the XMLRPC stuff if checked (thanks OliverGraf, AdamShand and other #moin irc'ers). This suffix could be configurable as well. I'm still not sure where to save the data - this is an open question to any and all Moin devs.
The second part of the trackback stuff, is the sending of trackback pings to urls contained on a Moin page. I think the easiest way to enable this is to just write a action, SendTrackback.py. This action will also have to create some persistant data, which should be written to the same place that the trackback data is written to (i'm assuming).
Resources and Links
[http://www.movabletype.org/trackback/beginners/ What is Trackback?]
[http://www.movabletype.org/docs/mttrackback.html Trackback Protocol]
R 0.2 info
Added config vars: allow_trackback 0|1, trackback_suffix defaults to __trackback__, but could be whatever one wanted.
Trackback is now detected in the run() method of request.py (just after the XMLRPC detection) rather then the previous mutant GET/POST mess.
I'm going to put all the trackback related data (sent and received pings) in the data/pages/<pagename>/trackback folder. This follows how/where attachments are saved. I'm still not sure of the format for saving the trackback data. XML? RSS? Plain-text? A pickled object?
- I don't think it really matters too much. My only real request is that it's something which can be edited with a normal text editor rather then having to write a program to parse it. -- Adam
Hurm. See, just when i was all happy to go with using a pickled list of objects, you have to want to edit it by hand...
I guess its back to XML then. -- JosYule
R 0.1 instructions
Please note that this code is soon to change in a pretty big way - this is just for experimenting with!!!
Add the variable allow_trackback to the config.py file. It is set to 0 by default, so if you want this to work, you also have to added the var to the moin_config.py file, and set it to 1.
Add the following line to _setup_args_from_cgi_form (from request.py), just before the return args line.
1 if not args.has_key('action') and os.environ["QUERY_STRING"]:
2 args['action'] = [os.environ["QUERY_STRING"].split('=')[1]]
Copy attachment:trackback.py and attachment:ViewTrackbacks.py to your action directory
Apply the following diff to Page.pyHere is the diff for Page.py (from moin 1.2.x)
629a630,646 > # Trackback RDF > if config.allow_trackback: > permalink = "http://" + request.server_name + request.script_name + "/" + wikiutil.quoteFilename(self.page_name) > trackback_url = permalink + "?action=trackback" > request.write(""" > <!-- > <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" > xmlns:dc="http://purl.org/dc/elements/1.1/" > xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"> > <rdf:Description > rdf:about="%s" > dc:title="%s" > dc:identifier="%s" /> > trackback:ping="%s" > </rdf:RDF> > -->""" % (permalink, self.page_name,permalink,trackback_url)) >
Future Ideas
Users who are subscribed to be notified of changes should be notified of new trackbacks? AdamShand
It would be nice if trackbacks were incorporated into the RecentChanges page somehow (or something similar so site admins could keep up with what's going on). AdamShand
Both the above are kind of related. I think the email-new-trackbacks is probably more doable then the RecentChanges, but i've not even looked at the code yet. JosYule
At some point the ability to send trackbacks will probably need to be able to be acl'd to stop abuse. AdamShand
I'm not really clear how to plug an action into the ACL framework. Again, i'll have to look at the code. JosYule
It would be nice if there was a way to display any trackbacks inline on the page (eg. ShowTrackBacks). AdamShand
This is already in the works -- JosYule
Instead of having both a ViewTrackbacks and a SendTrackbacks action, what about just having a "Trackbacks" action which displays any trackbacks for that page and also has a form which can be used to send one? AdamShand
The SendTrackback action works 'automagically' - it parses all the hrefs on the current page, checks each one for trackback RDF and if it finds some, sends a trackback ping to the listed url. I had not intended to have an actual 'form' for sending trackbacks (see [http://www.movabletype.org/docs/mttrackback.html#autodiscovery%20of%20trackback%20ping%20urls this]). JosYule
- Right, sorry that makes sense. I was thinking about it from a manual point of view but of course you are correct that this is the easist way. -- Adam.
When you have a page which includes multiple other pages then you end up with multiple a trackback RDF section for each included page. I have no idea if this is legal but I suspect not. View the source of my blog pages (for an example see: AdamShand). -- Adam.
This is legal (i think ;). I know that if you use the MT popup tool to post a message to a page like yours, you are presented with a list of all the 'trackback-able' URLs that you could ping. For the plug-in that i'm planning to write, it will take the first RDF-trackback URL it finds and ping that. This actually makes me want to put the RDF output for a page at the top, rather then at the bottom, so that if someone wanted to ping your frontpage it would work, rather then pinging the first item on that page. JosYule
- Yep, you're correct again. I went poking around some typepad blogs and they do have multiple trackback entries. -- Adam.