LinkTitles edit

Hallo Daniel,

ich probiere gerade die Extension:LinkTitles aus und wollte Dich fragen, ob man das so einrichten kann, das pro Seite jeder Link nur einmal erscheint? Gruß, Hans--89.247.72.165 18:07, 10 December 2012 (UTC)Reply

Hallo Hans, probier mal die neue Version 1.5.0 aus und schau, ob das so funktioniert. Du mußt einen neuen Parameter $wgLinkTitlesFirstOnly auf true setzen, um die Option einzuschalten. -- Bovender (talk) 15:41, 11 December 2012 (UTC)Reply
Perfektes Timing ;-) Habe ich gerade gemacht und warte nun ein wenig, bis der Cache leer ist und schreibe das Ergebnis hier rein. Noch eine andere Frage (Anregung): Bei WP kann ich einen Begriff z.B. so verlinken – [[Begriff]]e –. Bei der Ext. von Dir muss ich den Begriff immer so schreiben, wie er als Lemma existiert oder eine entsprechene Weiterleitung anlegen, was bei entsprechend vielen Varianten eines Begriffes eine Menge Weiterleitungen ergibt. Fällt Dir dazu u.U. einen Möglichkeit ein? Gruß vom Hans --89.247.59.201 11:45, 12 December 2012 (UTC)Reply
Update: Scheint nicht zu funktionieren, ich habe jetzt den Cache abgeschaltet, aber der Begriff XY wird immer noch jedesmal verlinkt.--89.247.59.201 12:02, 12 December 2012 (UTC)Reply
Ich habe folgende Konfiguration:$wgLinkTitlesParseOnEdit = true; $wgLinkTitlesParseOnRender = true; $wgLinkTitlesParseHeadings = false; $wgLinkTitlesPreferShortTitles = true; $wgLinkTitlesSkipTemplates = false; $wgLinkTitlesMinimumTitleLength = 5; $wgLinkTitlesFirstOnly = true; --89.247.59.201 12:34, 12 December 2012 (UTC)Reply
Hm, das ist merkwürdig. Bei mir funktioniert es prima in zwei Wikis (eins lokal, eins im Netz, aber leider privat, kann ich also nicht demonstrieren). Bist Du sicher, daß die neuen Dateien aus dem Archiv korrekt extrahiert und die alten Dateien überschrieben wurden? Was zeigt denn die Versionsnummer auf der Spezialseite "Version" an? -- Es war übrigens kein Timing, sondern Auftragsarbeit ;-) -- Bovender (talk) 21:20, 12 December 2012 (UTC)Reply
(Version 1.5.0) Alles korrekt soweit. Ich habe auch mal alles ausgeschaltet, aber die Verlinkungen bleiben. Komisch. Und nu?--89.247.90.236 10:25, 13 December 2012 (UTC)Reply
Mist, daß es nicht klappt. Nur um Mißverständnissen vorzubeugen, weil Du geschrieben hast "die Verlinkungen bleiben": Die Extension wird keine Links entfernen, die vorher schon da waren. Aber wenn auf einer Seite ohne Links immer noch ein und dasselbe Lemma mehrfach verlinkt wird, bin ich etwas ratlos, da muß man ins Detail gehen: In der Datei "LinkTitles.body.php" steht in Zeile 146 $limit, das könntest Du durch die Zahl 1 ersetzen, ebenso in Zeile 143 $loopLimit durch die Zahl 1 ersetzen. Dann sollte wirklich jedes Lemma immer nur einmal verlinkt werden.
Habe ich gemacht … keine Änderung. Mit den Verlinkungen meine ich, dass, selbst wenn ich die Ext. ausschalte, die von ihr angelegten Links erhalten bleiben. Hm, ich bin auch ein wenig ratlos.--89.247.124.70 14:18, 17 December 2012 (UTC)Reply
So, ich check das jetzt gar nicht mehr. Ich habe auf einer Seite alle Links entfernt, die Option $wgLinkTitlesParseOnEdit = false; und die Option $wgLinkTitlesParseOnRender = true; gesetzt. Nichts passiert, keine Links beim aufrufen. Dann pars on edit auf true und pars on render auf false gesetzt. Keine Links. Gruß vom Hans, --89.247.6.195 12:01, 18 December 2012 (UTC)Reply
Ende des Alarms; auf neuen Seiten funktioniert es nun so, wie es sein soll. Danke für das Tool :-), Hans --89.247.4.211 15:57, 19 December 2012 (UTC)Reply
Gut! Ich hatte schon begonnen, mich am Kopf zu kratzen, woran es denn noch liegen könnte. Die zweite Fragestellung ließe sich auch noch lösen, indem das Suchen-und-Ersetzen nicht auf Wortgrenzen achtet. Das hatte ich für mein Wiki bewußt vermieden, kann das aber demnächst mal in die Extension hineinbasteln.
Vielleicht als Option? Gruß zum Weltuntergang vom Hans :-) --89.247.34.179 06:45, 21 December 2012 (UTC)Reply
Nee, als zwei Optionen ;-) Version 1.6.0 steht zum Download bereit. Weihnachtsgrüße an einen unbekannten User! -- Bovender (talk) 16:43, 22 December 2012 (UTC)Reply
Cool, danke, aber da stimmt etwas an den Optionen nicht: Du hast einmal die Optionen $wgLinkTitlesStartOnly und $wgLinkTitlesStartOnly und dann $wgLinkTitlesWordStartOnly und $wgLinkTitlesWordEndOnly. Welche ist korrekt? Gruß vom Hans
$wgLinkTitlesWordStartOnly und $wgLinkTitlesWordEndOnly, also immer mit dem 'Word', danke für den Hinweis! -- Bovender (talk) 21:53, 23 December 2012 (UTC)Reply
So, jetzt aber nichts wie ab zum Weihnachtsmann ;-) – Alles Gute vom Hans. --89.247.38.169 16:05, 24 December 2012 (UTC)Reply
Version 1.6.1 behebt einen Fehler, der bei gesetzter Option "$wgLinkTitlesFirstOnly" verhinderte, daß überhaupt irgendwas verlinkt wurde. Viel Spaß damit & frohes Neues! -- Bovender (talk) 11:51, 31 December 2012 (UTC)Reply
Habe ich so nicht bemerkt, aber ich installiere die neue Version. Wenn es Probleme gibt, poste ich das hier. Dir ein gutes neues Jahr, Hans --89.247.21.51 13:49, 3 January 2013 (UTC)Reply

PubmedParser edit

Heiya Bovender, thank you again for your improvements of this extension. Although I am not a programmer I have two little suggestions: You could use https for the links linking to MediaWiki.org and this extension still uses the depreciated "LanguageGetMagic" hook. This works with current versions of MW but may break as soon this hook gets removed from core. Cheers --[[kgh]] (talk) 19:18, 12 February 2013 (UTC)Reply

Heiya Bovender, I just saw that you updated the extension to not use the depreciated hook. Cool. I just updated the extensions page. Thank you and cheers --[[kgh]] (talk) 10:45, 20 May 2013 (UTC)Reply


Extension:LinkTitles edit

Hi Daniel, with MediaWiki 1.18, PHP 5.3.10-1ubuntu3.6 and LinkTitles-2.2.1 I get this error and the text of the page gets mostly erased..

PHP Warning:  preg_replace(): Compilation failed: nothing to repeat at offset 32 in /home/www/wiki/extensions/LinkTitles/LinkTitles.body.php on line 202,

what's the problem?

thanks

Not easy to solve. Do you happen to have any wiki pages with special characters in their title by any chance? It might be caused by a plus sign or asterisk (*), although I failed to reproduce the error with made-up page titles like "+test" or "*test". -- Bovender (talk) 00:35, 9 August 2013 (UTC)Reply
I was indeed able to reproduce the problem. The error message occurs only in my server logs, so I think there are two issues here. Firstly, the LinkTitles extension needs to be tweaked to allow these special characters in page titles (I'm working on it). Secondly, if it is a public wiki, you could want to consider to turn off error logging to HTML output on your server. Have a look at the error_reporting(); function or the display_errors variable in your php.ini. -- Bovender (talk) 13:03, 9 August 2013 (UTC)Reply
Hm. But I dont have any pages with special titles. Maybe there's something missing in my PHP ..?
Alright, I quickly implemented a fix, it was easier than I thought. On my test system, the errors in the log file disappeared. Hopefully this works for you too! -- Bovender (talk) 15:40, 9 August 2013 (UTC)Reply
I should add that the updated version 2.2.2 is available at Github (tarball). -- Bovender (talk) 15:42, 9 August 2013 (UTC)Reply
I can confirm that its working. Thanks a lot.

I have a question - is it possible to somehow to make aliases for the links? For example, there's a word "routers" in the text and I would like to autolink it to "router" page.

Oh great, creating wiki Redirect works with your extension too!


One minor bug: it edits the text in the PRE sections. It shouldnt. Also in templates, like {{softredirect|something}}

Please see this announcement on version 2.4 that offers asynchronous or batch processing. Text in PRE sections is now exempt from linking. -- Bovender (talk) 15:51, 6 June 2014 (UTC)Reply

LinkTitles LinkTitlesFirstOnly edit

Hi Daniel,

First I'd like to thank you for this useful extension.

I'm trying to use the $wgLinkTitlesFirstOnly=true option. It works, but every time an article is saved, the next occurrence of the page title is linked. Is there a way to avoid this behaviour ?

Best regards, --Ludovic Strappazon (talk) 09:45, 2 December 2013 (UTC)Reply

Hi, well I think you found a bug. It appears that the first two occurrences of a title are linked, rather than just the first one. I'll look into it, but it may take a while since I am extremely busy at the moment. -- Bovender (talk) 18:55, 6 December 2013 (UTC)Reply

Hi, thanks for your answer. I plan to use your extension on a dictionnary handling around 25000 articles and i'm worried about the performances. I'm also thinking about our importation phase, when we will have to re-open the firsts imported articles to make them parsed against the lasts titles. I humbly suggest two features :

  • add a way to link asynchronously ($wgLinkTitlesParseNightly...) ;
  • add a magic word acting as a dynamic blacklist, allowing the editors to decide if an article has to be the target for autolinks.

Best regards, --Ludovic Strappazon (talk) 09:22, 18 December 2013 (UTC)Reply

The 'asynchronous' processing has been suggested by someone else now as well. Please see my response there. I'd be more than happy to implement this, but there are only 24 hours in a day... As for the dynamic blacklist, I fear this would dramatically increase the processing time as each existing page would have to be checked for the presence of the magic word. -- Bovender (talk) 13:56, 31 December 2013 (UTC)Reply
Please see this announcement on version 2.4 that offers asynchronous or batch processing. I've also added a new magic word __NOAUTOLINKTARGET__ to prevent a page from being linked to. -- Bovender (talk) 15:51, 6 June 2014 (UTC)Reply
Version 3 is out now with greatly improved performance! -- Bovender (talk) 15:28, 13 June 2014 (UTC)Reply

LinkTitles LinkTitles UTF8 Fehler? edit

Hallo, ich habe die neuste Version der Extension in einem MediaWiki 1.23.6 versucht zu nutzen, leider gibt es jede menge Fehler im LOG in der Form PHP Warning: preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Compilation failed: invalid UTF-8 string at offset 33 in /srv/mediawiki/extensions/LinkTitles/LinkTitles.body.php on line 226

Wenn ich die Extension in der localsettings aktiviere, zerstört sie die Wiki-Seite (Aussehen und Inhalt) egal ob ich den Parameter nur beim Rendern oder "on edit" setze ... Ich weiß nicht mehr woran es liegt ...

Datenbankserver MariaDB10.0, Database-Type ist INNODB, das Tabellenformat wurde jetzt von LATIN1 und BINARY angepasst auf UTF8_unicode und BINARY

$wgDBmysql5 ist TRUE in der localsettings.php

DANKE!!! VG Gerd --192.166.53.201 10:47, 25 November 2014 (UTC)Reply

Hm, das kann m.E. nur an dem Seitentitel liegen. Der reguläre Ausdruck funktioniert eigentlich, zumindest auf meinem Entwicklungslaptop als auch im richtigen Leben auf unserem Server. In den regulären Ausdruck wird aber der jeweils aktuelle Seitentitel eingebaut, kann es sein, daß da bei Euch spezielle Zeichen drin vorkommen? Anders kann ich es mir nicht erklären. Bovender (talk) 18:51, 25 November 2014 (UTC)Reply

Hallo, Danke für die schnelle Antwort. Habe es gerade mit einer jungfräulichen Installation auf dem Server versucht - da klappt alles wie gewünscht! Hängt also wohl wirklich an Seitentiteln im Produktiv-Wiki. Wobei ich es auch mit zwei neuen Seiten im Produktiv-Wiki versucht habe - "Test" und "Versuch" und beim Inhalt/Text jeweils das andere Wort hingeschrieben habe. Da wird aber dann gar nichts angezeigt oder gespeichert, die Seiten bleiben einfach leer?!? VG Gerd

Ich habe zur Zeit das gleiche Problem, jedoch habe ich keine Sonderzeichen in den Seitentiteln. Werden denn irgendwelche weiteren Bedingungen an das Wiki gestellt, die du nicht explizit in deiner Dokumentation angegeben hast? Irgendwelche Datenbank-Einstellungen oder Probleme mit anderen Extensions? --Miles Fides (talk) 13:44, 27 February 2015 (UTC)Reply

How to automatically add links to Chinese words? edit

The matched content is displayed in Chinese. How to do?

Hm, I don't know? With UTF-8 encoding it should with Chinese too, shouldn't it? Bovender (talk) 15:39, 9 January 2015 (UTC)Reply

LinkTitles: Restrict adding links to separate words only. edit

Hi Daniel,

First of all, great work creating the very usefull extension Linktitles. I have a question. Is it possible to setup LinkTitles in such a way that only separated words/series of words are linked, and not substring matches.

Case 1: I'm using the <file>....</file> extension: eg <file>\\server\folder1\folder2\filename.ext</file> When folder1/folder2/filename also exists as a page title in the wiki, the file link is screwed up: eg <file>\\server\folder1\folder2\filename.ext</file>

Solution would be if Linktitles would check for a preceding and succeeding space character instead for any occurrence of the specific string.

The settings $wgLinkTitlesWordStartOnly, $wgLinkTitlesWordStartOnly and $wgLinkTitlesSkipTemplates do not cover what I'm looking for.

Best regards, Patrick

Patrick, in theory the $wgLinkTitlesWordStartOnly and $wgLinkTitlesWordEndOnly settings should be what you need. However, in this special situation the problem is that the backslashes are word boundaries, i.e. 'server', 'folder1' and so on are recognized as distinct words. There is an easy solution however: I've updated the extension to version 3.1.0, which ignores text inside <file>...</file> tags. Hope this helps! -- Bovender (talk) 20:04, 5 February 2015 (UTC)Reply
Thanks for your solution. I also found the $delimiter option inside LinkTitles.body.php (stated on the discussion page of LinkTitles). I have added the following line: '<file>.*?<\/file>|'. // Direct file access. Needs some minimal coding budt that also works for me.
:-) That's basically what I did as well! 5314331 -- Bovender (talk) 09:21, 6 February 2015 (UTC)Reply

LinkTitles restriction by namespace edit

Hi, Bovender! I've been using your LinkTitles extension and love it - very useful, especially for non-wiki users. I was wondering whether it might be possible to limit the scope of LinkTitles so it only parses (on render) pages within the Main namespace (and not Forms, or Special:Form Edit, as defined by Semantic Forms). Is this possible? Thanks in advance! ~Teis

Sorry for the long delay, due to a server configuration error I did not receive notifications from this site any more. You are not the first to request this feature, I'll try to look into it. -- Bovender (talk) 07:54, 4 June 2016 (UTC)Reply

Pubmed & https edit

Hi Bovender, I love your pubmed parser extension. As an FYI: PubMed is switching to httpS only tomorrow (Nov 9, 2016) for all APIs. Details.[1] Not sure if this will affect the extension. --Tbplante (talk) 16:00, 8 November 2016 (UTC)Reply

Thanks. Although I'm not sure if it wouldn't continue to work with the redirection, I've updated the URLs to use https and release 4.0.1 just now. -- Bovender (talk) 22:03, 9 November 2016 (UTC)Reply

LinkTitles Problem edit

Hallo, ich teste gerade LinkTitles in der aktuellen Version 5.0.5 auf einem Mediawiki 1.30.0. Das funktioniert fast wie geplant, allerdings: Ich habe Dutzende von Artikeln in der Form "Name 1", "Name 2", "Name 3", ... "Name 304", "Name 305" - du hast das Bild? Ich verwende die Default-Einstellungen, nach denen der längste Artikelname zuerst verlinkt werden soll. Interessanterweise wird bei Vorkommen von "Name 304" im Text dann "Name 3" verlinkt, also [[Name 3]]04. Ich habe ja die Befürchtung, dass das irgendwie mit den Ziffern zu tun hat, ansonsten ist mir dieses Verhalten nicht aufgefallen. -- Kyr (talk) 08:56, 3 April 2018 (UTC)Reply

Das muß ich mir näher ansehen. Vermutlich hat es etwas mit der Erkennung von Wortgrenzen zu tun. Kann ich nicht ganz auf die Schnelle lösen, werde ich mir aber ansehen. -- Bovender (talk) 19:51, 3 April 2018 (UTC)Reply
Kyr, ich habe Testcode geschrieben, der das Problem nachvollzieht. Allerdings habe ich es noch nicht verstanden. Ich glaube, es werden Wortgrenzen nicht richtig erkannt, aber warum nicht vorrangig Name 304 verlinkt wird, wenn dieser Text so auf der Seite vorkommt, habe ich noch nicht verstanden. -- Bovender (talk) 20:13, 26 June 2018 (UTC)Reply
Version 5.0.7, soeben veröffentlicht, sollte das Problem beheben. Meine automatisierten Tests werden alle bestanden. Bitte Rückmeldung, wenn es im echten Leben doch noch nicht klappt. -- Bovender (talk) 19:37, 27 June 2018 (UTC)Reply

Usage problems edit

$wgLinkTitlesParseOnRender = false; There is no automatic link.

Return to Special:LinkTitles.Error occurred:

  • Notice: Undefined variable: config in x:\WWWRoot\x\extensions\LinkTitles\includes\Special.php on line 149
  • Notice: Trying to get property 'specialPageReloadAfter' of non-object in x:\WWWRoot\x\extensions\LinkTitles\includes\Special.php on line 149

Asking for help!

This was a bug that finally got fixed now (v5.0.8). Bovender (talk) 17:45, 13 March 2019 (UTC)Reply