diff --git a/inc/parser/parser.php b/inc/parser/parser.php index db49ff0c3c8f00dcfe16a9c48cf6f1af3662cf67..491206b813fbb34ef591b81ff0ece1514d69f825 100644 --- a/inc/parser/parser.php +++ b/inc/parser/parser.php @@ -611,6 +611,7 @@ class Doku_Parser_Mode_acronym extends Doku_Parser_Mode { var $pattern = ''; function Doku_Parser_Mode_acronym($acronyms) { + usort($acronyms,array($this,'_compare')); $this->acronyms = $acronyms; } @@ -633,6 +634,21 @@ class Doku_Parser_Mode_acronym extends Doku_Parser_Mode { function getSort() { return 240; } + + /** + * sort callback to order by string length descending + */ + function _compare($a,$b) { + $a_len = strlen($a); + $b_len = strlen($b); + if ($a_len > $b_len) { + return -1; + } else if ($a_len < $b_len) { + return 1; + } + + return 0; + } } //-------------------------------------------------------------------