summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/parser/parser.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/inc/parser/parser.php b/inc/parser/parser.php
index db49ff0c3..491206b81 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;
+ }
}
//-------------------------------------------------------------------