idiot, mais fonctionne. Il suffit de modifier les valeurs des mots et des éléments tableau à vos besoins
function removeSingleCharLineBreak(){
var words = ['a', 'i', 's', 'z', 'v', 'k', 'o', 'u',
'A', 'I', 'S', 'Z', 'V', 'K', 'O', 'U', '€',
'na', 'za', 'do', 'Na', 'Za', 'Do',
];
var elements = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'li', 'td', 'td'];
$.each(words, function(index, word){
var regex = new RegExp(" " + word + " ", "g");
$.each(elements, function(index, element){
$(element + ':contains(' + word + ')').each(function(){
if (word == '€')
{
$(this).html(
$(this).html().replace(regex, ' ' + word + ' ')
);
}
else
{
$(this).html(
$(this).html().replace(regex, ' ' + word + ' ')
);
}
});
});
});
}
vous devrez vérifier le contenu en ligne s'il y a 1 mots de caractère et si oui, vous placez un '\ n' avant d' – Aelop