Extension talk:AutoLink

Finally
I've been wanting an extension like this forever, but had no idea how to do it. Thanks for tackling this, can't wait to try and implement it on my wiki.--24.250.230.243 01:44, 15 June 2007 (UTC)

Big Bug (Resolved)
If for example you have the word "animal" in your wordlist AutoLinkPages and you have an images called animal.jpg in your curently edited artikel you get animal.jpg as a result. That ist bad in the "image-" Tag. I think with categories it is the same problem. Anyone here, who can change the code? 89.52.133.99 15:55, 2 July 2007 (UTC)
 * Thankyou very much for drawing my attention to this point.I have just started working with wikis,so as soon as i was done with this extension i put it here.But i'll definitely re-work on this extension keeping all your suggestions in mind.Please wait for some time so that i can make it perfect and then submit.--Sanjeev 08:41, 3 July 2007 (UTC)
 * Sadly to say - it isn't resolved.89.52.189.171 21:22, 9 July 2007 (UTC)
 * Is it too difficult to make this little change? If yes - this tool is not helpfull for me - I am sorry.89.52.164.171 23:47, 10 July 2007 (UTC)
 * In Next two dayz i'll do that.--Sanjeev 08:28, 16 July 2007 (UTC)

one bug, one "feature"
I edited the script so that if you have "animal" in the dictionary page, it will create a link to it from either "animal" or "Animal". Also, there was a bug in the code that did not autolink text if it appeared in position 0 in the content string. It had to do with the return value of the strpos function. You have to use "!== false" to evaluate properly. Anyway -- that was kind of eliminated when I switched to using preg_replace and preg_match. Feel free to roll back if it's not appropriate. I'm currently using the script as I've edited it on my own server. I was planning to address the issue with replacing words that appear inside of square brackets.

Thanks for the idea and for putting the original code together. --Flanagana 19:48, 3 July 2007 (UTC)
 * Hi Flanagana.
 * As,I said i was re-working on this extension,even i was planning to use preg_match/replace functions.And regarding !==false condition, this bug can also be removed if instead of strpos, strstr is used.But nywayz as you said preg_match if used then no need to worry about !==false condition.So the changes made by you to the code contribute towards it's perfection.Thankyou very much for that.Please try to find out if any other problem lies in that,so that we can work together on it. :)
 * Your changes to code and suggestions encourage me to think out of the box and to develop and contribute more extensions for our people.Thanks once again.--Sanjeev 04:50, 4 July 2007 (UTC)

Put all articles automatically into the article "AutoLinkPages" (resolved)
I want to have all my article put automaticaly into AutoLinkPages. Is it possible when opening the article "AutoLinkPages" to be asked "Do you want to have all your articles put into this page?" and when I answer "yes" the script will put all of them automatically into thte page?? 89.52.189.233 10:23, 6 July 2007 (UTC)
 * Hi!!!
 * Yes,it is very much possible to put all the Articles in AutoLink Page.
 * But when i wrote this extension, my requirement was for selective words in a page content.
 * I will definitely work on this to allow, putting all the Articles in that page
 * automatically,but can you please give some more details about your requirement.
 * For example,one case is that from now onwards any page/article you create will have an auto
 * entry in AutoLink page..,or else all the existing article names have to be added to
 * AutoLinkPage.So, Please give me some more details and time to prepare that.
 * Thankyou very much --Sanjeev 06:18, 9 July 2007 (UTC)


 * It's a good idea from you to allow the alternatives: give the user the possibillity ...
 * 1. ... to put single words into AutoLinkPages (as you did before)
 * 2. ... to abandon the AutoLinkPages and automatically use all the article-names
 * Thanks for your work
 * 89.52.189.171 21:16, 9 July 2007 (UTC)

Samuel Gelineau resolved wish 2. 89.52.154.165 09:38, 29 July 2007 (UTC)

Content is wiped out
Hi, I've tried this extension on my wiki, and I always get the content wiped out. I've just started trying editing it myself. If anybody has had the same issue, please suggest a solution. Thanks.--Cartoro 09:16, 11 July 2007 (UTC)
 * Hi Cartoro.

Please do not use the extension now as it's under re-work.Very soon i'll be replacing the code with one which will work perfectly.Sorry for inconvenience.--Sanjeev 13:16, 11 July 2007 (UTC)

Woohoo! Thanks Cartoro for making this point and thanks to Sanjeev for letting us know what is happening. I had thought it was something I was doing when I had the same problem as nobody else mentioned it. I look forward to the new version.

New Version of This Extension
Hi frenzz!!!
 * The code for this extension is updated latest(version1.2) and take cares of the above specified "animal.jpg" problem.Before you use this extension let me make you aware of something.This extension is re-worked to remove the bug like animal.jpg,but i won't say that a bug, coz it depends on once requirements.So this extension may satisfy certain requirements and others not, so all of you feel free to take the code and customize it as per your requirements.This Extension can be made more specific to include other conditions also,so please keep on adding more functionality to it.Ideas are appreciated and will definitely be taken care of.Now about including all Article names in AutoLinkPages,i tried that but it harms the performance badly as my wiki app has many articles.So i thought, not to include it.Please let me know if any issues.Thanks a lot. --Sanjeev 11:31, 16 July 2007 (UTC)

New issue
Sanjeev: I've only used this a little bit more, but I've hit the problem that the matching does not take place when the word is near other punctuation. For example if the word is "animal" then the sentence "This is an animal!" won't link properly, where "This is an animal !" will link... Anyway -- thanks for your efforts on making this better... I'm swamped with other tasks but if I get around to resolving any of these issues, I'll post my updated code. --70.21.34.164 02:26, 18 July 2007 (UTC)

Problems with pictures
"dogs" is put into AutoLinkPage. The following then is changed from:

thumb|500px|animals

into:

Bild:[[dogs and cats.gif|thumb|500px|animals]]


 * It is assumed that name of the images won't be having spaces between them.
 * For example if 'dogs and cat.gif' is 'dogs_and_cat.gif', extension will work and 'dogs' will not be linked.Thanks!!!!Sanjeev


 * You are right - it is no good idea to have spaces in filenames. But we have lots of spaces in names of pictures in our wiki. Nearly impossible to rename them all.
 * Suggestion: Wy not just stop replacing between " " ... and ... " " and also between " [" ... and ...  "] "? 89.52.168.70 11:24, 27 July 2007 (UTC)

New version
Hi, I (not the original Author) wrote a new version which didn't rely on an AutoLinkPage word list. I also rewrote the substitution code so it wouldn't depend on spaces (see "New issue" above), and added an easy-to-edit list of "exception blocks" within which words should not be substituted. There's a regression though: the so-called "animal" problem will probably reoccur.


 * Thank you very much for the further development of the extension.
 * Would it be possible to have both versions in one script? Maybe with a parameter for "wordlist" or "all pages"? Or if there is no article "AutoLinkPages" take all artikels.


 * Otherwise we'll get a third/forth/... version in a few months. 89.52.191.150 19:53, 28 July 2007 (UTC)

Two wishes: Don't touch the hyperlinks I wrote by hand myself. E.g.: There is an article "Animals" but no article "Animalfarm". Now animalfarm would result in "animalfarm" but it shouldn't be touched. 89.52.154.165 10:28, 29 July 2007 (UTC)
 * wiki links are already exception blocks, so the extension won't touch your hand-made hyperlinks. Besides, there's no way the regular expression /animalfarm/ will match the text  "animal]]farm" , so I'm deeply convinced that this already works as expected. Gelisam

Don't hyperlink the articlename itself more than once. E.g.: If the article is called "Animal" then mark only the first "Animal" otherwise there are a lot of bold "Animals". 89.52.154.165 10:28, 29 July 2007 (UTC)
 * I've just noticed; and I've just fixed it. Although I don't mark the first self-loop either. Gelisam

Added only a little to the "Gelineau"-version and now it is workin fine - thank you very much.89.52.176.161 16:52, 30 July 2007 (UTC)

Bracket bug
If you have an article "PHP" and you write an hyperlink in an other article  Only an example  then .php? gets  |php]?parameter=3 Only an example] . I tried to put  [ ]  into the mapIgnoringBlocks and got further errors. -89.52.168.59 16:08, 5 August 2007 (UTC)


 * I have asked here for an answer. -89.52.137.94 07:00, 21 August 2007 (UTC)

Etiquette violation?
I just posted a new version of this extension, and then I realized I might have committed some MediaWiki etiqutte violation. If so, I apologize and urge you to feel free to pull down my code. I probably should have contacted the author before posting a mod on the same page. --Vjg 16:50, 24 August 2007 (UTC)

nowiki bug
I discovered a bug in both versions that work with all pages. At first I thought I'd introduced it in my version, but I've confirmed it is present in the code I used as the basis of my change. I don't know if it is also present in the code that used the AutoLinkPage.

If you have a page with the text: Page &lt;nowiki&gt; reference Main Page is in a nowiki &lt;/nowiki&gt; block. the text that actually gets saved is: Page &lt;nowiki&gt; reference &lt;/nowiki&gt; Main Page is in a nowiki &lt;/nowiki&gt; block. Note the extra terminating &lt;/nowiki&gt; that was inserted immediately before the first nested wiki link tag. The nowiki block isn't being handled quite right. If I resolve the issue, I'll post changes, but it's low on my priority list. --Vjg 15:03, 27 August 2007 (UTC)

Delimiter warning (if not bug)
Be cautious with the use of the delimiter pair array. For instance, the categorytree tag won't be recognized if you have parameters set in the opening tag. Dropping the trailing &gt; on the opening tag will make it work again, but you need to consider this behavior for any delimiter pair you introduce. --Vjg 17:21, 27 August 2007 (UTC)