views:

451

answers:

1

I'm using jquery DynaCloud with wordCount to create a dynamic tagcloud. I have specific terms to include in the cloud (though the frequency is different for each user), and some of the terms are multiple word, or have special characters ("&", "'", " ", etc.) as part of the term.

I break the terms with specific html blocks:

<pre><span class="tag">this isn't the last tag</span></pre>

as an example.

The way wordCount works (as far as I can tell) is to accept only specific characters and to split on the spaces between words.

I've been trying to edit the script to allow all characters (including special), and only break on the <span class=tag>.

However, it doesn't seem that any changes I make have any effect.

Any idea how to alter this code to get everything between the tags and break on the tag?

//accept Latin-1 basic + Latin-1 extended characters
testChar: function(c) {
    return((c >=   0 && c <= 500)
        || (c >= 128 && c <= 151)
        || (c >= 160 && c <= 164)
        || (c >=  48 && c <=  57)
        || (c >= 224 && c <= 246)
        || (c >= 249 && c <= 255));
},

//split words
splitWords: function(words) {
    var w = new Array(), str = '';
    for(var i = 0, j = words.length; i < j; i++) {
        c = words.charCodeAt(i);
        if(this.testChar(c)) str += words.substring(i, i + 1);
        else {
            w.push(str);
            str = '';
        }
    }
}

thanks, Pete

+1  A: 
pedalpete