https://github.com/kenny2github/bbcodecontent
A MediaWiki extension that adds a content model for BBCode pages
https://github.com/kenny2github/bbcodecontent
Last synced: about 1 year ago
JSON representation
A MediaWiki extension that adds a content model for BBCode pages
- Host: GitHub
- URL: https://github.com/kenny2github/bbcodecontent
- Owner: Kenny2github
- License: mit
- Created: 2018-09-14T05:03:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-14T05:04:02.000Z (over 7 years ago)
- Last Synced: 2025-02-13T07:46:44.369Z (about 1 year ago)
- Language: PHP
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BBCodeContent
This extension adds a new content model, "BBCode", that you can switch pages to.
## Installation
Run the following commands (assuming you're at your wiki's root, e.g. /w):
```bash
cd extensions
git clone https://github.com/Kenny2github/BBCodeContent.git
cd ..
echo "wfLoadExtension('BBCodeContent');" >> LocalSettings.php
```
## Configuration
The only configuration variable is `$wgBBCCTags`, which controls how each different BBCode tag is interpreted.
Use it as follows for a simple tag:
```php
$wgBBCCTags['red'] = [
'', // opening tag
'', // closing tag
false // if true, this is closed by a newline rather than a [/red]
];
```
Or as follows for a tag with a parameter:
```php
// this is already in there by default
$wgBBCCTags['url'] = [
'', // {PARAM} is replaced by FOO in [url=FOO]
'',
false
];
```
Or as follows for a complex tag that needs special things:
```php
$wgBBCCTags['randomcolor'] = function ($tag, $content, $param) {
// $param is FOO in [randomcolor=FOO]
// it is not used here
// $content is BAR in [randomcolor]BAR[/randomcolor]
// it is directly echoed (everything has already been put through htmlspecialchars)
$out = '';
$out .= $content;
$out .= '';
return $out;
};
```