(To Drupal Developers and users who wish to have WikiText support:)

[[If this submission violates certain posting guidelines or suffers from RTFM mishaps, or you've got a question, plz post me an email via my contact page (http://drupal.org/user/6841/contact).]]

I've been using Drupal since 4.2.x, and have been relatively happy with the simple Wiki module derived from phpwiki that someone contributed to Drupal. Granted, it's really only an input filter, without support for what one expects to find in a Wiki (such as diffs, etc.), and offers a fairly limited set of markups (compared with, say, WikiMedia). However, in the context of the rest of Drupal, it serves most needs. For my own usage, I added other markup supports like simple HTML table.

Users of this module have probably known about the odd integration of the wiki module with Drupal's "filter architecture." That is, WikiText filtering was supported only for certain node types. The good news is that Drupal release 4.5.0 apparently offers a "re-architected" input formatting scheme with much cleaner support for filters.

Not having seen a Wiki module made available for 4.5.0, I decided to port the Wiki module from 4.3.2 (my latest Drupal installation) into the 4.5.x input filter architecture. I'm not completely sure that I've done the task correctly, but I'm confident that it follows the examples of the legacy.module and filter.module. I have gotten the WikiText filter to work in 4.5.1. As would be expected, the WikiText filtering works for all node content types from book to page to story to comment. Basically, wherever you can select an Input format, there Wiki support will be also.

I did notice another user posting a patch on Nov 7, 2004 suggesting the upgrade of the Wiki module to 4.5.0 (http://drupal.org/node/12416). I didn't really take time to examine that patch to differentiate it from my patch, although my sense from briefly inspecting it is that it didn't use the 4.5.x filter hooking mechanism.

My "patch" is really a new module, where I've included the markups I've added over the year while using the previous Wiki module. This new wikitext module doesn't interact well yet with the HTML Filter, but I'll let someone else worry about that for now.

To use this new wikitext module:

1. Plop it into the modules dir of your 4.5.1 drupal installation
2. Enable the wikitext module via administer/modules
3. Go to administer/input formats and take one of two routes:
- Route #1: If you want all your existing nodes that have been using the _default_ Filtered HTML input format to now support WikiText, then configure that input format and check the WikiText filter to enable it (preferably disable the other filters, or rearrange them to eliminate conflicts).
- Route #2: Alternatively, add a new input format (call it anything you want, like "WikiText"), and configure it to enable WikiText.
4. If you want the WikiText filter to support HTML tags, go over to "configure filters" and choose "Enable HTML." What this does is to allow you, on any line, to use HTML tags simply by beginning the line with |>
5. To see the WikiText formatting guidelines, click on the "more info about formatting options" link on any edit page, or go under http://yoursite/filter/tips

Hope you find this useful!

~mosquito

CommentFileSizeAuthor
#4 wikitext_0.module25.88 KBn8o
wikitext.module25.66 KBmosquito

Comments

carl ditzler’s picture

Category: task » bug

Added wikitext.module to 4.5.1 /modules and received the following:
Parse error: parse error, unexpected ']', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/public_html/modules/wikitext.module on line 237:
$orig[] = $matches[2];

kzeng’s picture

I got the same bug. Could you please fix it? Thanks!

n8o’s picture

line 106:
===
EOS1b; break;
===

There needs to be a carriage return after "EOS1b;", before the "break" ; - php's herefile syntax requires EOF markers to be alone on their own line.

works great, after that's fixed.

--

n8o’s picture

StatusFileSize
new25.88 KB

try this file, instead. (should be attached)

n8o’s picture

I'll be durned, it has the same problem!

My source is corrected, and works. There's a bug in the upload process, here, somewhere - my bet is that that's the same problem that hit what mosquito uploaded.

Any clues as to the proper place to report this upload bug?

butelo@drupal.org’s picture

I couldn´t solve the problem, doing that, the only difference is that the bug is now in 237 instead in 236.

butelo@drupal.org’s picture

no, it worked but with mosquito`s file not whith nh8 I don´t know why cos thei´re identical.

veridicus’s picture

Assigned: Unassigned » veridicus

I have it all fixed. I removed the <<< strings because on some (most/all?) *nix systems they require both carriage return and line feeds before the ending label even though that's not standard for unix. It's all clean with regular strings now, so no more OS-related problems.

I'm also fixing other old bugs. I've applied the original patch. All I have left is to fix links and footnotes. Hopefully I'll be done in a day or 2 and have CVS updated.

So don't bother writing more patches yet or I'll have a hell of a time merging them in. Let me get it all working and updated in CVS. After that I'll close out this issue as it'll be ready for 4.5 and you can post new suggestions and feature requests.

veridicus’s picture

Sorry, last comment got messed up with <<<. Anyway, those long strings are removed. Carriage returns and line feeds are both needed before the last label and become OS dependant.

I'm about to update the original wiki.module with mosquito's generous contributions. So please don't contribute more changes at the moment. I'm fixing old bugs. All I have left is to fix links and footnotes. Hopefully I'll be done in a day or two. I'll then update CVS and close out this issue. Then new feature requests/issues/patches can be posted based on that.

So hang on tight, I'm almost done.

Also, I've contacted the person responsible for another wiki module contribution. They're creating a new node type. After I have this code up they may use this wiki.module for parsing. So we'll see how that goes...

veridicus’s picture

Code contributions merged. wiki.module now complies with Drupal 4.5 API. A few fixes are still required, but almost all functionality is working.

Bèr Kessels’s picture

Note that there are a lot of wiki projects going on.
please synchronise your ideas with these people. Really: We do not need lots of different wiki modules, doing nearly the same, but in a slightly different way, with different schemes etc. What we need is a one wiki bundle, that is complete and wherein the modules co-operate, instead of conflict.