X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=js%2Fformateur.js;h=5e8095a202d4f386a381b1b2ac9953ecdd0d5671;hb=efae3fc07564a2a29b24f8c87b6d8f6658b873a0;hp=e0e72405dee61767dc718a1f06ce0f48760958b0;hpb=1146f3264ff7535ff3408230140414789c3c25da;p=euphorik.git
diff --git a/js/formateur.js b/js/formateur.js
index e0e7240..5e8095a 100644
--- a/js/formateur.js
+++ b/js/formateur.js
@@ -16,8 +16,6 @@
// You should have received a copy of the GNU General Public License
// along with Euphorik. If not, see .
-/*jslint laxbreak:true */
-
/**
* Classe permettant de formater du texte par exemple pour la substitution des liens dans les
@@ -112,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 + '';
}
@@ -154,14 +152,25 @@ euphorik.Formateur.prototype.getShort = function(url) {
return [versionShort ? versionShort : "url", estUneImage];
};
+euphorik.Formateur.prototype.supprimerSmiles = function(m) {
+ objectEach(this.smiles, function(nom, smiles) {
+ for (var i = 0; i < smiles.length; i++) {
+ m = m.replace(smiles[i], "");
+ }
+ });
+ return m;
+};
+
/**
* Traite les pseudo et messages à être affiché dans le titre d'une image visualisé avec lightbox.
+ * Supprime les smiles pour pas qu'ils puissent être remplacés par la fonction 'traiterSmiles'.
+ * TODO : trouver un moyen pour que les smiles puissent être conservés
*/
euphorik.Formateur.prototype.traiterPourFenetreLightBox = function(M, urlCourante) {
var thisFormateur = this;
var traitementUrl = function(url) {
- return "[" + thisFormateur.getShort(url)[0] + (urlCourante == url ? "*" : "") + "]";
+ return "[" + thisFormateur.getShort(url)[0] + (urlCourante === url ? "*" : "") + "]";
};
- return this.remplacerBalisesHTML(M).replace(this.regexUrl, traitementUrl);
+ return this.remplacerBalisesHTML(this.supprimerSmiles(M)).replace(this.regexUrl, traitementUrl);
};