문제

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]]

올바른 솔루션이 없습니다

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top