You are not logged in.

#1 2009-09-08 13:27:43

techprophet
Member
Registered: 2008-05-13
Posts: 209

Suggestion for a [wiki] tag in the forum BBCode

So...would it be possible to have something like

[wiki=HAL]this[/wiki]

and have it work like  the normal url bbcode, except for the wiki?

[url=wiki.archlinux.org/index.php/HAL]this[/url]

Maybe not KISS, but definately useful

Offline

#2 2009-09-08 13:29:54

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,485
Website

Re: Suggestion for a [wiki] tag in the forum BBCode

If you find out how that could be done in FluxBB, it may be considered.  I doubt any forum maintainers are going to go out of their way to find it for themselves...

Offline

#3 2009-09-08 14:15:25

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: Suggestion for a [wiki] tag in the forum BBCode

interesting


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#4 2009-09-08 14:27:21

techprophet
Member
Registered: 2008-05-13
Posts: 209

Re: Suggestion for a [wiki] tag in the forum BBCode

Looking into it, what version of fluxbb does this forum run? Anyone know?

Offline

#5 2009-09-08 14:32:29

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: Suggestion for a [wiki] tag in the forum BBCode

techprophet wrote:

Looking into it, what version of fluxbb does this forum run? Anyone know?

FluxBB 1.2.22.

Offline

#6 2009-09-08 15:07:52

techprophet
Member
Registered: 2008-05-13
Posts: 209

Re: Suggestion for a [wiki] tag in the forum BBCode

Alright, I have a (somewhat messy) patch for fluxBB 1.2.22.

281,296d280
< //
< //Turns a [wiki=pagename]link[/wiki] bbcode into <a href="http://wikibase/pagename">link</a>
< //
< function handle_wiki_tag($pagename, $link = '')
< {
<       global $pun_user;
<
<       $wikiurl = 'http://wiki.archlinux.org/index.php/';
<
<       $full_url = str_replace(' ', '_', $wikiurl.$pagename);
<
<       $link = ($link == '' || $link == $pagename) ? ((strlen($pagename) > 55) ? substr($pagename, 0 , 39).' … '.substr($pagename, -10) : $pagename) : stripslashes($link);
<
<       return '<a href="'.$full_url.'">'.$link.'</a>';
< }
<
337,339c321
<                                        '#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s',
<                                        '#\[wiki\]([^\[<]*?)\[/wiki\]#e',
<                                        '#\[wiki=([^\[<]*?)\](.*?)\[/wiki\]#e');
---
>                                        '#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s');
348,350c330
<                                        '<span style="color: $1">$2</span>',
<                                        'handle_wiki_tag(\'$1\')',
<                                        'handle_wiki_tag(\'$1\', \'$2\')');
---
>                                        '<span style="color: $1">$2</span>');

It is based on the handle_url_tag function and supports the following syntax:

[wiki]Arch Linux[/wiki] (returns <a href="http://wiki.archlinux.org/index.php/Arch_Linux">Arch Linux</a>)
[wiki=Arch Linux]Somesuch[/wiki] (returns <a href="http://wiki.archlinux.org/index.php/Arch_Linux">Somesuch</a>)

EDIT: The above patch is for /include/parser.php

Last edited by techprophet (2009-09-08 15:11:47)

Offline

#7 2009-09-08 23:05:38

sand_man
Member
From: Australia
Registered: 2008-06-10
Posts: 2,164

Re: Suggestion for a [wiki] tag in the forum BBCode

Misfit138 wrote:
techprophet wrote:

Looking into it, what version of fluxbb does this forum run? Anyone know?

FluxBB 1.2.22.

huh, until now I thought this forum was run on punbb... Did it change while I wasn't looking?


neutral

Offline

#8 2009-09-08 23:08:49

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,485
Website

Re: Suggestion for a [wiki] tag in the forum BBCode

yes: http://bbs.archlinux.org/viewtopic.php?id=79469

Please open a bug report in the website section of the Arch project to ask for this to be included.

Offline

#9 2009-09-08 23:32:25

Pierre
Developer
From: Bonn
Registered: 2004-07-05
Posts: 1,964
Website

Re: Suggestion for a [wiki] tag in the forum BBCode

I would prefer a plugin over a patch (even a simple one) which has to be applied to upstream code.

Offline

#10 2009-09-09 01:06:32

techprophet
Member
Registered: 2008-05-13
Posts: 209

Re: Suggestion for a [wiki] tag in the forum BBCode

As of 1.2.22, there is no way to do a plugin instead of a patch. I believe in 1.4 there may be. If there is, I will make one for 1.4 as well.

Ref:
* http://fluxbb.org/wiki/v1.2:installing_modifications
* http://fluxbb.org/wiki/v1.2:customization

I would agree that plugin is better than patch. Patching can have unintended consequences, especially in the PHP world.

Last edited by techprophet (2009-09-09 01:07:35)

Offline

Board footer

Powered by FluxBB