X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=js%2Fformateur.js;h=eba6c5a3aa089e2de737e72ae1b9d8bb479aa555;hp=b7ec0eb89d7a2b1c6608c8ca53c027a6679edc75;hb=8ee1535f5594573931ddaebee77bf6148a5358cb;hpb=eb8708a7450d6c5147613fab28678b206aeb7c7e diff --git a/js/formateur.js b/js/formateur.js index b7ec0eb..eba6c5a 100644 --- a/js/formateur.js +++ b/js/formateur.js @@ -18,7 +18,7 @@ /** - * Classe permettant de formater du texte par exemple pour la substitution des liens dans les + * Objet permettant de formater du texte par exemple pour la substitution des liens dans les * message par "[url]". * TODO : améliorer l'efficacité des méthods notamment lié au smiles. */ @@ -28,7 +28,7 @@ euphorik.Formateur = function() { this.regexUrl = new RegExp("(?:(?:" + this.protocoles + ")://|www\\.)[^ ]*", "gi"); this.regexImg = new RegExp("^.*?\\.(gif|jpg|png|jpeg|bmp|tiff)$", "i"); - this.regexDomaine = new RegExp("^(?:(?:" + this.protocoles + ")://|www\\.).*?([^/.]+\\.[^/.]+)(?:$|/).*$", "i"); + this.regexDomaine = new RegExp("^(?:(?:" + this.protocoles + ")://)(.*?)(?:$|/).*$", "i"); this.regexTestProtocoleExiste = new RegExp("^(?:" + this.protocoles + ")://.*$", "i"); this.regexNomProtocole = new RegExp("^(.*?)://"); }; @@ -110,12 +110,12 @@ euphorik.Formateur.prototype.traiterURL = function(m, pseudo) { */ euphorik.Formateur.prototype.traiterWikiSyntaxe = function(m) { return m.replace( - /_(.*?)_/g, + /(?:^| )_(.*?)_(?:$| )/g, function(texte, capture) { return '' + capture + ''; } ).replace( - /\*(.*?)\*/g, + /(?:^| )\*(.*?)\*(?:$| )/g, function(texte, capture) { return '' + capture + ''; } @@ -124,7 +124,7 @@ euphorik.Formateur.prototype.traiterWikiSyntaxe = function(m) { /** * Renvoie une version courte de l'url. - * par exemple : http://en.wikipedia.org/wiki/Yakov_Smirnoff devient wikipedia.org + * par exemple : http://en.wikipedia.org/wiki/Yakov_Smirnoff devient en.wikipedia.org */ euphorik.Formateur.prototype.getShort = function(url) { var estUneImage = false;