Mabinogi Guru
MainMabiBlogForumsMabinogi WikiImage GalleryArcadeFlash Chat

Navbar Left Navbar Right

Mabinogi Guru Forums » Mabinogi Guru Fansite » Tip Box » Wikilinks in the Forums?

Reply
Tcat Left
 
LinkBack Thread Tools Display Modes
Thead Left Old 02-13-2008, 02:54 PM   #1 (permalink) Thead Left
Supporter
 
Join Date: Feb 2008
Posts: 358
Gold: 3,062
Hark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enough
Default Wikilinks in the Forums?

I wasn't sure if this was already implemented in one form or another, but I think it would be useful to more tightly bind the wiki and forums by allowing wikilinks in the forums. For example,

Fishing would resolve to Fishing.

Implementation should be fairly simple (admittedly, I've never hacked around with vBulletin specifically, but adding a regex-based filter shouldn't too difficult if it doesn't already have the feature built-in) - just have

'/\[\[([^|\]]+)\]\]/' filter to a link like '[url]http://www.mabiguru.com/wiki/index.php?title=$1[/url]' (or the equivalent HTML, depending on the order in which the filter is applied with respect to bbcode).

Then you'd also want to add in something like

'/\[\[([^|\]]+)\|([^\]]+)\]\]/' to filter to '[url=http://www.mabiguru.com/wiki/index.php?title=$1]$2[/url]'

To handle rtfg -> rtfg

(Or some other, more bbcode-ish syntax like [wiki=article name]optional link name[/wiki], etc; though I think keeping the same syntax used on the wiki is a little bit more intuitive.)

I think this would make the fact that there is an integrated wiki significantly more prominent, which will hopefully promote and ease future usage (since a wiki is significantly better suited for maintaining guides and encyclopedic knowledge than a forum). I think once the open beta starts and the forum and wiki become more populated, it'll be significantly more useful than it currently is.

Just a thought

EDIT: Whoops, accidentally escaped the examples too.
Hark is offline   Reply With Quote
Thead Left Old 02-13-2008, 03:04 PM   #2 (permalink) Thead Left
Wiki Squad
 
Bakuryu's Avatar
 
Join Date: Feb 2008
Posts: 1,509
Gold: 9,116
Bakuryu is a jewel in the roughBakuryu is a jewel in the roughBakuryu is a jewel in the roughBakuryu is a jewel in the roughBakuryu is a jewel in the roughBakuryu is a jewel in the roughBakuryu is a jewel in the roughBakuryu is a jewel in the roughBakuryu is a jewel in the rough
Send a message via MSN to Bakuryu
Default

I like the idea,
__________________
Bakuryu~
Bakuryu is online now   Reply With Quote
Thead Left Old 02-13-2008, 03:34 PM   #3 (permalink) Thead Left
Am I cute?
 
LuigiPT's Avatar
 
Join Date: Jan 2008
Posts: 262
My Mood:
Gold: 5,421
LuigiPT is on a distinguished roadLuigiPT is on a distinguished road
Default

The ideia is good, but if that would be implemented I hope BBCode isn't erased, because there are some people (like me) that aren't very well known of Wiki code.
__________________

The "avvy" is sponsored by Falsetto
IGN: Aluman / SERVER: Ruairi
LuigiPT is offline   Reply With Quote
Thead Left Old 02-13-2008, 03:40 PM   #4 (permalink) Thead Left
Supporter
 
Join Date: Feb 2008
Posts: 358
Gold: 3,062
Hark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enough
Default

No, it wouldn't affect bbcode at all. Depending on how vBulletin's wordfilter system works, it could be implemented as a simple wordfilter (ie, the same way swears are blocked in some forums).

If the wordfilter doesn't support regexes, then you either have to hack in a regex-based wordfilter system, or just hardcode those two filters before the posts get passed into the bbcode parser. My comment about bbcode/filter precidence was just pointing out that if the replacement is done after bbcode is parsed, then the [url] bbcode tags won't be handled correctly and it won't be turned into a link.

The comment about syntax was just saying that I prefer [[Fishing]] over [wiki]Fishing[/wiki]; I wasn't trying to imply that we should use the rest of the wiki markup for anything D:
Hark is offline   Reply With Quote
Thead Left Old 02-13-2008, 06:43 PM   #5 (permalink) Thead Left
Dangerously Sweet
 
TofuCakee's Avatar
 
Join Date: Jan 2008
Posts: 2,534
My Mood:
Gold: 68,974
TofuCakee is a jewel in the roughTofuCakee is a jewel in the roughTofuCakee is a jewel in the roughTofuCakee is a jewel in the roughTofuCakee is a jewel in the roughTofuCakee is a jewel in the roughTofuCakee is a jewel in the roughTofuCakee is a jewel in the roughTofuCakee is a jewel in the rough
Default

this sounds like a good idea, itchy might hool it up.
__________________
MyPets:Umami, Cottoncandy, Hotchocolate, Marshmallo
TofuCakee is offline   Reply With Quote
Thead Left Old 02-13-2008, 08:34 PM   #6 (permalink) Thead Left
Dunbarton Explorer
 
Kari's Avatar
 
Join Date: Jan 2008
Posts: 83
My Mood:
Gold: 196
Kari is still learning the ropes
Send a message via MSN to Kari
Default

Yea, that'd be a great idea (:

Easily accessable as well.

Hopefully it works
__________________

Last edited by Kari : 02-13-2008 at 08:34 PM. Reason: oopsy speelling D:
Kari is offline   Reply With Quote
Thead Left Old 02-14-2008, 03:11 AM   #7 (permalink) Thead Left
Administrator
 
Itchy's Avatar
 
Join Date: Dec 2007
Posts: 547
My Mood:
Gold: 29,971
Itchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura aboutItchy has a spectacular aura about
Default

Hmm, this is would not be an easy task but it's a great feture, you can easily add links going to the wiki. I don't think an existing script exists that does the function.

Maybe you can hand code it Hark?
__________________

The Cool Mabinogi Fansite - Use this Mabisiggy | Love the Guru? You can show your support by donating!
Itchy is offline   Reply With Quote
Thead Left Old 02-14-2008, 03:47 AM   #8 (permalink) Thead Left
Supporter
 
Join Date: Feb 2008
Posts: 358
Gold: 3,062
Hark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enough
Default

As I mentioned, I'm not very familiar with vBulletin (because it isn't free software, and I'm not going to pay for something I can write myself), and can't easily create a patch without illegally obtaining a copy of the source. Since I'm not familiar with the structure of the code, I can't give you exact instructions, but I can offer you some high-level advice on how to implement it.

First, it doesn't look like vBulletin supports regex-based wordfilters out of the box, which doesn't surprise me: I've yet to find a bbs which did (simply because most end-users have no idea wtf a regex is). You'll probably never use a regex for anything else, so adding full-blown support for them isn't really necessary. Instead, the easiest thing to do would be to hard-code it in there.

To make things easy, you should look for the function which takes a post and swaps out all the bbcode tags into it. Into this function, before the bbcode is evaulated, you should locate which variable contains the post data. This should be fairly easy - the bbcode replacement will use a function named "preg_replace", which shouldn't be used in very many places in the code.

In this function, before the bbcode is replaced insert the following lines of code:

Code:
$str = preg_replace( '/\[\[([^|\[\]]+)\]\]/', '[url]http://www.mabiguru.com/wiki/index.php?title=$1[/url]', $str );
$str = preg_replace( 
'/\[\[([^|\[\]]+)\|([^\[\]]+)\]\]/', '[url=http://www.mabiguru.com/wiki/index.php?title=$1]$2[/url]', $str );
Making sure to replace all four instances of "$str" with the variable containing the post data.

And that should take care of it.

Last edited by Hark : 02-14-2008 at 03:56 AM. Reason: Okay, escaped the code correctly. That should do the trick.
Hark is offline   Reply With Quote
Thead Left Old 02-14-2008, 07:21 PM   #9 (permalink) Thead Left
Supporter
 
Join Date: Feb 2008
Posts: 358
Gold: 3,062
Hark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enough
Default

If you really want, I can try to find a copy of vBulletin and make an appropriate patch for it which you can then apply to your source tree and have it working. I really do want this feature added; there's been two or three cases already where I wanted to link to the wiki from the boards and had to manually dig up the URL and put it in a normal link :\

* looks for a vBulletin torrent...
Hark is offline   Reply With Quote
Thead Left Old 02-14-2008, 07:42 PM   #10 (permalink) Thead Left
Supporter
 
Join Date: Feb 2008
Posts: 358
Gold: 3,062
Hark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enoughHark will become famous soon enough
Default

Okay, I've attached my "patch":
  • Open up /include/class_bbcode.php
  • Search the file for "function do_parse"
  • Inspect the section of code you find with the bit of the file I provided. If you haven't changed any other parts, it should match exactly.
  • Copy-Paste the lines between "HARK'S EDIT" and "END OF HARK'S EDIT" into the corresponding place in your code.
  • Test the script on your dev setup to make sure nothing is horribly broken.
  • If it's not broken and appears to work, put into production source tree.

Honestly, I'm appalled at the vBulletin source base. It's absolutely bloat bloat bloat. There's over 100,000 lines of code in this bloated behemoth; ugh, worse even than phpbb.

Anyway, I didn't bother testing it because I couldn't be arsed to copy the entire 11MB of source over to a server, then configure a database for it to run off of, then test it, etc, but I did test the two lines in question and the regex used, and I'm sure they work. The only reason it might not work has to do with vBulletin's caching semantics, or some other weird typo etc.

I really do want this feature though D:
Attached Files
File Type: txt new_class_bbcode.txt (823 Bytes, 3 views)

Last edited by Hark : 02-14-2008 at 07:43 PM. Reason: whoops fixed the list tags
Hark is offline   Reply With Quote
Bottom LeftBottom Right

Reply



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
vBCredits v1.4 Copyright ©2007, PixelFX Studios
Skin by CompletevB