Question

I was trying to do it like this in my Plugin.

function getType(){ return 'substition'; }
function getSort(){ return 299; } 
function connectTo($mode) { 
  $this->Lexer->addSpecialPattern('@.+?@',$mode,'plugin_externallink');
}

function render($mode, &$renderer, $data) {
  print_r($data);
}

but patten doesn't match anything.

Here is markup example:

[[http://@testDomain@/test|testDomain]]

No correct solution

OTHER TIPS

I'm afraid the content of [[ ]] is handled by either the internallink mode or the external link.

Those modes aren't configured to accept any other mode (because of the implementation of accepts which doesn't accept anything here).

What you could do is:

  • Match the whole pattern. ie: not just what's inside the @..@, but what's inside the [[ ]]
  • Define a priority smaller than the one of the internallink (300) and the one of the externallink (330). (Hence, 299 is already fine)

To handle it, you might then want to rely on the internallink method of the renderer

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top