[TxMt] MediaWiki bundle + Ruby library for interfacing w/ wiki pages

Andrew Dupont andrew at andrewdupont.net
Mon Mar 6 03:40:02 UTC 2006


Haven't tackled it yet.  Explicit communication between the browser  
and TextMate isn't the crucial part, at least for me, plus I know at  
the very least it'd be pretty easy to set up an AppleScript (invoked  
via a Quicksilver trigger or something) to do the legwork. TextMate  
would still have to do a bunch of work, including logging in, so most  
of the communication would have to be done with the server directly  
rather than through the browser.

I've read the external editor spec <http://en.wikipedia.org/wiki/ 
Help:External_editors/Tech> and the sample Perl implementation  
<http://cvs.sourceforge.net/viewcvs.py/wikipedia/extensions/ee/ee.pl? 
view=markup>; the part I don't get about it is that the external  
editor still has to do all the work of screen-scraping the damned  
page. You can fetch the raw wikitext of a page with ?action=raw,  
eliminating the need for screen-scraping, in theory.

But to me it seems like the point of grabbing the wikitext is to edit  
it -- and if you want to submit an edit you *have* to grab the ? 
action=edit version of the page anyway. Why? Because there are POST  
values you must submit that you can't get without scraping that page  
-- two timestamps and an edit token.  Even their own Perl  
implementation resorts to regexes to grab these values from the HTML.

Hopefully the preceding paragraphs convey what it took me hours to  
conclude: MediaWiki's efforts to facilitate external editors are  
somewhat promising, but ultimately half-baked.  There's a great spec  
for a protocol called WTTP <http://meta.wikimedia.org/wiki/ 
WikiText_Transfer_Protocol> which would solve all these problems  
quite elegantly, in my opinion, but it doesn't seem to have much  
momentum, from what I can tell.

At any rate, I think MediaWiki's idea of delivering a custom MIME  
type (so that the browser can associate the content with a specific  
application) is excellent.  (When you request a page with ? 
action=raw, in fact, it's served with a Content-Type of text/x-wiki.)  
And the best part about the external editor spec is that it's a  
really quick, terse way to grab some configuration values that the  
user would otherwise have to enter.

But when it comes to MIME types, Safari is hardly an A-student (it  
ignores the MIME type if it thinks it knows better <http:// 
diveintomark.org/archives/2004/08/13/safari-content-sniffing>), so  
frankly I'm glad there's more than one way to do it.

(This is what happens when you spend your weekend reading about wiki  
software instead of going outside.)


Andrew


On Mar 5, 2006, at 7:54 PM, Michael Sheets wrote:

> Well I'm actually interested for another reason, I was trying to  
> figure out how to have a text box sent to TextMate from a browser  
> and Allan pointed out the MediaWiki external editor spec page.  
> Would be interested to see how you tackled the issue.
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate




More information about the textmate mailing list