/** * @covers Syllable::hyphenateText * @todo Implement testHyphenateText(). */ public function testHyphenateText() { $this->object->setHyphen('-'); $this->object->setLanguage('en-us'); $this->assertEquals(';Re-dun-dant, punc-tu-a-tion...', $this->object->hyphenateText(';Redundant, punctuation...')); $this->assertEquals('In-ex-plic-a-ble', $this->object->hyphenateText('Inexplicable')); // note that HTML attributes are hyphenated too! $this->assertEquals('Ridicu-lous-ly <b class="un-split-table">com-pli-cat-ed</b> meta-text', $this->object->hyphenateText('Ridiculously <b class="unsplittable">complicated</b> metatext')); }
</form> <hr/> <div class="example"> <h2>Source</h2> <h5>Without hyphens</h5> <?php echo nl2br($source); ?> </div> <div class="example"> <h2>Soft-hyphens</h2> <h5>&shy; entities</h5> <?php $syllable->setHyphen(new Syllable_Hyphen_Soft()); echo nl2br($syllable->hyphenateText($source)); ?> </div> <div class="example"> <h2>Hyphens</h2> <h5>All hyphen locations</h5> <?php $syllable->setHyphen('<span class="debug-hyphen">-</span>'); echo nl2br($syllable->hyphenateText($source)); ?> </div> <div class="example"> <h2>Zero-width spaces</h2> <h5>&#8203; entities</h5>