Not logged in. · Lost password · Register
Forum: General Help and Support Development RSS
getSort() order unexpected
Avatar
og #1
Member since May 2006 · 436 posts · Location: Bayern
Group memberships: Members
Show profile · Link to this post
Subject: getSort() order unexpected
Suddenly a plugin refused to work (reason unknown until now). It is a syntax-plugin which uses "[[..|..]]" syntax, like links do. Even if this is a bad choice, it worked for many years. After hours of debugging i found that sort order matters here. The plugin uses order 267 and as statet here https://www.dokuwiki.org/devel:parser:getsort_list any number below 300 (Doku_Parser_Mode_internallink) should do.
In fact it works again if i use a sort number < 100 which is somewhere in the formatting. BTW the plugin uses "substitution" type.

Any idea why this is so?
Oli...
Avatar
andi (Administrator) #2
User title: splitbrain
Member since May 2006 · 3520 posts · Location: Berlin Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Use the info plugin to list all syntax sorts in your wiki: https://www.dokuwiki.org/plugin:info#infosyntaxmodes

There's probably something else interfering with that syntax at a lower level.
Read this if you don't get any useful answers.
Lies dies wenn du keine hilfreichen Antworten bekommst.
Avatar
og #3
Member since May 2006 · 436 posts · Location: Bayern
Group memberships: Members
Show profile · Link to this post
Great! Did'nt knew this plugin :-)

The output is somewhat different than the list given in DokuWiki, but maybe thats okay. I can see following order:

plugin_siteexport_aggregate    300
internallink
plugin_siteexport_siteexport
rss    310
media    320
externallink    330
emaillink    340
windowssharelink    350
eol    370
plugin_authorstats    371
plugin_keyboard    444
plugin_sqlcomp    500
plugin_siteexport_pagebreak    999

The red one could not work because it uses the link-syntax and comes after it (yellow ones), so it is always overruled. This is why it does'nt work anymore. Inside the sqlcomp-plugin the getSort() is set to 267, but infoplugin shows it at 500 ! Any idea why?

P.S.: Is it possible to get a list of all patterns registered to the lexer to show it as msg() from inside the plugin? I just want to be shure my pattern is there...
Oli...
This post was edited on 2017-07-27, 11:04 by og.
Avatar
og #4
Member since May 2006 · 436 posts · Location: Bayern
Group memberships: Members
Show profile · Link to this post
Uh, i think a got a trace... i installed plugin "siteexport" recently, and this is using sortorder 100. This plugin uses several syntax additions and this one attracts my attention:
    function connectTo($mode) {
        $this->Lexer->addEntryPattern('<toc>(?=.*?</toc>)', $mode, 'plugin_siteexport_toc');
        $this->Lexer->addEntryPattern('<toc .+?>(?=.*?</toc>)', $mode, 'plugin_siteexport_toc');
        $this->Lexer->addSpecialPattern("\[\[.+?\]\]", $mode, 'plugin_siteexport_toc');
    }
Later on in code, it is handled with
               if ($this->insideToc) {
               ....
                } else {
                    // use parser!
                    $handler->internallink($match, $state, $pos);
                }
Here we have a conflict. I assume that handling the same syntax in a cascade is not possible, so link-handling ends here!
As i disable the plugin, everything works like expected. But this can happen again, anytime...
Oli...
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-02-17, 07:15:47 (UTC +01:00)