Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
require_once(HTML2PS_DIR.'inline.content.builder.php');
4
 
5
class InlineContentBuilderPre extends InlineContentBuilder {
6
  function InlineContentBuilderPre() {
7
    $this->InlineContentBuilder();
8
  }
9
 
10
  /**
11
   * CSS 2.1 16.6 Whitespace: the 'white-space' property
12
   *
13
   * pre
14
   *
15
   * This  value prevents  user  agents from  collapsing sequences  of
16
   * whitespace. Lines are  only broken at newlines in  the source, or
17
   * at occurrences of "\A" in generated content.
18
   */
19
  function build(&$box, $text, &$pipeline) {
20
    $text = $this->remove_trailing_linefeeds($text);
21
    $lines = $this->break_into_lines($text);
22
 
23
    $parent =& $box->get_parent_node();
24
 
25
    for ($i=0, $size = count($lines); $i<$size; $i++) {
26
      $line = $lines[$i];
27
      $box->process_word($line, $pipeline);
28
 
29
      if ((!$parent || $parent->isBlockLevel()) && $i < $size - 1) {
30
        $this->add_line_break($box, $pipeline);
31
      };
32
    };
33
  }
34
}
35
 
36
?>