Exemple #1
0
 private function applyBorders(\DOMElement $node, $text, $context)
 {
     /*{{{*/
     $has_border_top = $node->hasAttribute('border-top');
     $has_border_bottom = $node->hasAttribute('border-bottom');
     if ($has_border_bottom || $has_border_top) {
         $width = Text\MultiByte::text_width($text, $this->charset);
         $txt_width = $width - mb_strlen($context['indent'], $this->charset);
         if ($has_border_bottom) {
             $char = $node->getAttribute('border-bottom');
             $border = str_repeat($char, $txt_width);
             $text = rtrim($text) . "\n" . $context['indent'] . $border . "\n";
         }
         if ($has_border_top) {
             $char = $node->getAttribute('border-top');
             $border = str_repeat($char, $txt_width);
             $text = $context['indent'] . $border . "\n" . ltrim($text);
         }
     }
     return $text;
 }
Exemple #2
0
 public function format()
 {
     return Text\MultiByte::wordwrap($this->xslt->transformToXml($this->dom), $this->wordwrap, "\n", true, $this->charset);
 }