Extension talk:Sort2

Discussion goes here

Option style=""
I thought about implementing the style option to be restricted to the list style types valid for ordered lists. To be honest, I was too lazy and I chose to pass any style through.

If this is considered to be too threatening and if there's consensus I am willing to implement the restriction.

I just need your feedback on this.

Bugs
Hey,

Before the Sort2 function you created I had a list like the following:


 * Software Configurations
 * Permission
 * Disconnects
 * Unable to browse

But when I changed it for the sort2 my link to my doc did not work anymore:

 Software Configurations Permission -> Disconnects Unable to browse

You might want to see if you could include this functionally

Thanks, Justin

Special characters like colons, asterisks (*), and hashes (#) are removed even if they are not serving as list item markers. This means that, for instance, sorting a list that includes any links with namespaces or external ( http:// ) links will break the links.

CarLuva 21:41, 21 October 2009 (UTC)

This extension strips the wiki syntax list tokens to allow the sorting of already existing lists. But unfortunately it does it wrong way. Only the leading characters should be removed, not all of them, otherwise the entire line will be corrupted. The problem can be solved with the following change: function stripWikiListTokens( $text ) { $pattern ='/^\s*([\*\#\:])\s*/'; return trim(preg_replace($pattern, ,$text )); }

Suggestions
Hi. Is it possible to sort links? SORT2 is removing ":" ? Is this right? Anyway thank you for your extension. --Micc 20:55, 1 March 2007 (UTC)

Not working with links
Useful extension. But breaks on lists with links. any fixes?


 * We use the extension at Stargate Wiki. We had no problems with links. Example: Template:Erd-Objekt.


 * We've tried to get it to work with in-page links; but since it removes the '#' sign (and other chars) these links cannot be sorted. It also can't deal with parameters sent into a template, e.g. , --Callum Wilson 10:45, 23 August 2010 (UTC)


 * Just tested it and it that standard link markup isn't being interpreted. --JimAlexP (talk) 02:30, 1 December 2016 (UTC)


 * This is apparently caused by the following function removing the ":" in hyperlinks.


 * --JimAlexP (talk) 20:45, 1 December 2016 (UTC)
 * --JimAlexP (talk) 20:45, 1 December 2016 (UTC)

How to add first letter?
How to create list for example?

A B
 * AMD
 * argument
 * ball
 * BMW

Modifications
I must admit that I'm still green when it comes to PHP. I've created the following modifications to extend the functionality of this extension. The mods are ugly and I can't be 100% they won't break something else.

In order to add URLs modify the function stripWikiListTokens to the following: What we're doing is going through out Sort2 block and looking for http: and temporarily replacing it with http{colon}. Then we go through the Sort2 block again removing all the MediaWiki specific list tags. Finally we go through the Sort2 block one last time replacing http{colon} with http:.

If you are alphabetizing a list of links in standard [url display] format Sort2 will alphabetize based on the URL. So a URL of  Google </tt> will come AFTER  Google </tt>. Both links are evaluated on the first letter following the http://</tt>. Therefore Sort2 sorts using the W in the former and the G in the later.

This may sound odd but I didn't like how the 'br' type looked. Especially considering that paragraphs are separated using '  ' tags instead. I added an additional type to support this. In order to implement add the following:

In function loadSettings look for this line: and replace it with the following line to make 'p' a valid 'type': Finally we need to handle 'p' types. In the function makeList add the following case to the switch statement: Then just use Sort2 as you normally would using 'p' as a type,  </tt>

BlueSuede 21:21, 8 December 2011 (UTC)

Extra Bullet Point
If I use ul or ol it adds an extra bullet point at the bottom with no text beside it. I can get around this by using dl but I'd like the bullets. Any idea how I can fix this?