Extension talk:Sort

From MediaWiki.org
Jump to: navigation, search

[edit] Issues

The README refers to another extension as a reference

require_once( "{$IP}/extensions/MinimumNameLength/MinimumNameLength.php" );

if you have [1] [2] style links in your sort they will come out in random order on your page. so in the following example one.a's link could be [3] or it could be [1], same with two.a

== one ==
<sort>
* item b [http://google.com/]
* item a [http://google.com/]
</sort>
== two ==
<sort>
* item b [http://google.com/]
* item a [http://google.com/]
</sort>

[edit] Sublevel sort

Hello, i want to sort a list like this:

<sort>
* Level 1
** bla a
** bla b
*** bla c
* Level 2
** blub a
** blub c
*** blub b
</sort>

Has someone an idea to realize this?? Thank you very much for your help!

[edit] Bugs

The third parameter to efRenderSort in Sort.php is a reference, that should be a value. The extension uses parser->parse which breaks things (e.g. the Cite extension outputs its warning when it doesn't find the references tag, because it thinks it's at the end of the article), it should be using recursiveTagParse instead (in Sorter.class.php, Sorter::parse)

Index: Sort.class.php
===================================================================
--- Sort.class.php      (revision 77344)
+++ Sort.class.php      (working copy)
@@ -117,10 +117,9 @@
         */
        protected function parse( $text ) {
                wfProfileIn( __METHOD__ );
-               $output = $this->parser->parse( $text, $this->parser->mTitle,
-                       $this->parser->mOptions, true, false );
+               $output = $this->parser->recursiveTagParse( $text );
                wfProfileOut( __METHOD__ );
-               return $output->getText();
+               return $output;
        }
 
-}
\ No newline at end of file
+}
Index: Sort.php
===================================================================
--- Sort.php    (revision 77344)
+++ Sort.php    (working copy)
@@ -41,7 +41,7 @@
  * @param Parser $parser Parent parser
  * @return string
  */
-function efRenderSort( $input, $args, &$parser ) {
+function efRenderSort( $input, $args, $parser ) {
        $sorter = new Sorter( $parser );
        $sorter->loadSettings( $args );
        return $sorter->sort( $input );

-- Nx / talk 21:23, 26 November 2010 (UTC)

Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox