Options: textSpaces on split="words"

The textSpaces option determines how spaces will be treated on the text. When using split="words" you have the following options:

textSpaces="remove" (default)

If you do not specify a textSpaces option, the default: textSpaces="style" is used. Spaces are removed. (Remember you can use padding and margin on the generated spans)

Example

Teen magazines are magazines aimed at female teenage readers. They usually consist of gossip, news, fashion tips and interviews and may include posters, stickers, small samples of cosmetics or other products and inserts.


var rules = {
    color: {
        values: ["#111111", "#eeeeee"],
        steps: true,
    },
    backgroundColor: {
        values: ["#ce4320", "#cc2020", "#b81840", "#c52475", "#a51b83"],
        steps: true,
    }

}

var opts = {
    split: "words"
}

var girlieMag = new generativeText(rules, opts);
girlieMag.applyToElementById("example1");
            

#example1 span { text-align: center; margin-bottom: 0.2em; padding: 0.2em; }
            

textSpaces="style"

Spaces are encapsulated in a span that is styled.

Example

Teen magazines are magazines aimed at female teenage readers. They usually consist of gossip, news, fashion tips and interviews and may include posters, stickers, small samples of cosmetics or other products and inserts.

var opts2 = {
    split: "words",
    textSpaces: "style"
}

var girlieMagStyledSpaces = new generativeText(rules, opts2);
girlieMagStyledSpaces.applyToElementById("example2");
            

#example2 span { text-align: center; margin-bottom: 0.2em; padding: 0.1em; }
            

textSpaces="nostyle"

Spaces are encapsulated in a span but not styled.

Example

Teen magazines are magazines aimed at female teenage readers. They usually consist of gossip, news, fashion tips and interviews and may include posters, stickers, small samples of cosmetics or other products and inserts.

var opts3 = {
    split: "words",
    textSpaces: "nostyle"
}

var girlieMagNoStyledSpaces = new generativeText(rules, opts3);
girlieMagNoStyledSpaces.applyToElementById("example3");
            

#example3 span { text-align: center; margin-bottom: 0.2em; padding: 0.1em; }
            

textSpaces="all"

A   entity is added to the beginning and end of each word, except for the beginning of the first word and the ending of the last word.

Example

Teen magazines are magazines aimed at female teenage readers. They usually consist of gossip, news, fashion tips and interviews and may include posters, stickers, small samples of cosmetics or other products and inserts.

var opts4 = {
    split: "words",
    textSpaces: "all"
}

var girlieMagAddedSpaces = new generativeText(rules, opts4);
girlieMagAddedSpaces.applyToElementById("example4");
            

#example4 span { text-align: center; margin-bottom: 0.2em; padding: 0.1em; }