Topic on Extension talk:BedellPenDragon

Jump to navigation Jump to search

Two mods for your brilliant extension

Mermeladomermelado (talkcontribs)

After installing your mod, I realized I needed two implementations for my needs and I decided to share with you (I hope you do not mind that).

First I found a bug in the extension translation. When a page or template tags <translate> is transcluded, they are not processed, but print on screen and is very ugly.

Second, when the article is very long, it may be interesting to reduce it in size and add a link to the relevant page.

To remove tags from translation, you use the parameter deltranslatetag = "true" and to shorten the text and make if it exceeds the number of characters the link indicated there appears to use the parameter cutter= "xx" where xx is the maximum number of characters to display.

The code It is divided into two parts, the first can be inserted in many places and have chosen just after:

$replace = '';
                if ( isset( $params['replace'] ) ) {
                        $replace = $params['replace'];

And then inserts this code:

// Mod mermelado
                $deltranslatetag = false;
                if ( $params['deltranslatetag'] == "true" ) {
                        $deltranslatetag = true;
                $cutter = '';
                if ( isset( $params['cutter'] ) ) {
                        $cutter = $params['cutter'];
                // Fin Mod mermelado

The second part can also be inserted in many places, I chose to put it after the following code:

if ( $replace ) {
                        $output = str_replace ( $replace, $title->getFullText(), $output );

And then inserts this code:

//Mod Mermelado

                if ( $deltranslatetag ) {
                         $replace1 ="<translate>";  $replace2 ="</translate>"; $replace3 ="<languages/>";
                         $output = str_replace ( $replace1, '', $output );
                         $output = str_replace ( $replace2, '', $output );
                         $output = str_replace ( $replace3, '', $output );

                if ( $cutter ) {

                if(strlen($output) > $cutter) { $output = substr($output, 0, $cutter).'...<center>[['.$title->getFullText().'|'.wfMessage( 'articlepage' ).'...]]</center>'; }
                                        //Mod Mermelado fin

Note: I have used the existing message 'articlepage' , but everyone is free to use the text that seems most appropriate.
I hope my mod seems useful to you, a greeting: mermelado.

BrentLaabs (talkcontribs)

Just a note as to why you haven't heard back from anyone: the creator of this extension has been banned from WMF wikis forever. So if you want to provide feedback, I'd suggest going to the Github issue page instead.

Reply to "Two mods for your brilliant extension"