public function testUTF8Wrap() { $inputs = array(array('aaaaaaa', 3, array('aaa', 'aaa', 'a')), array('aa<b>aaaaa', 3, array('aa<b>a', 'aaa', 'a')), array('aa&aaaa', 3, array('aa&', 'aaa', 'a')), array("aa東aaaa", 3, array("aa東", 'aaa', 'a')), array('', 80, array()), array('a', 80, array('a'))); foreach ($inputs as $input) { list($string, $width, $expect) = $input; $this->assertEqual($expect, phutil_utf8_hard_wrap_html($string, $width), "Wrapping of '" . $string . "'"); } }
protected function applyIntraline(&$render, $intra, $corpus) { $line_break = "<span class=\"over-the-line\">⬅</span><br />"; foreach ($render as $key => $text) { if (isset($intra[$key])) { $render[$key] = ArcanistDiffUtils::applyIntralineDiff($text, $intra[$key]); } if (isset($corpus[$key]) && strlen($corpus[$key]) > $this->lineWidth) { $lines = phutil_utf8_hard_wrap_html($render[$key], $this->lineWidth); $render[$key] = implode($line_break, $lines); } } }