Assuming that you wanted the first string after the first bracket to be strong, and the rest em, you could do this:
if (!defined('DOKU_INC')) die();
require_once(DOKU_PLUGIN.'syntax.php');
class syntax_plugin_yourplugin extends DokuWiki_Syntax_Plugin
{
public function getInfo()
{
return array(
'author' => 'You',
'email' => 'your email',
'date' => 'some date',
'name' => 'name of your plugin',
'desc' => 'what does it do',
'url' => 'www.example.org/plugin/yourplugin',
);
}
public function getType() { return 'substitution'; } // We substitute stuff for other stuff.
public function getSort() { return 165; } // Run this before unformatted text is rendered.
public function connectTo($mode)
{
// The last parameter of addSpecialPattern is 'plugin_' then your plugin's name.
// In this example, your plugin is a class called syntax_plugin_yourplugin - yourplugin
// is the plugin's name.
$this->Lexer->addSpecialPattern('\{\{pluginname>.*?\}\}',$mode,'plugin_yourplugin');
}
public function handle($match, $state, $pos, &$handler)
{
// We don't really care about {{pluginname> or }}, we just want the stuff between it.
$match = substr($match, 13, -2);
// Make an array out of the supplied strings.
$strings = explode('>', $match);
// Loop through and add the XHTML.
$l = count($strings);
for ($i = 0; $i < $l; $i++) {
if ($i === 0) {
$strings[$i] = '<strong>' . $strings[$i] . '</strong>';
}
else {
$strings[$i] = '<em>' . $strings[$i] . '</em>';
}
}
return $strings;
}
public function render($mode, &$R, $data)
{
// Add the strings and the XHTML to the document.
$R->doc .= implode(' ', $data);
}
}
The above file would go in lib/plugins/yourplugin/syntax.php
I wrote all that before I looked at the date of the post, better late than never?