Пример #1
0
 function testRenderHighlightThatIsIgnorableByBulk()
 {
     $highlight1 = new Highlight(14, 14, Highlight::DELETED, 0, 0, 'ref1');
     $splitPositions = array(14 => array(new SplitPosition(1, SplitPosition::ATOM, $highlight1)));
     $renderedText = $this->textRenderer->renderText($this->textFragment, $splitPositions);
     $pastedText = strip_tags($renderedText);
     $bulkText = preg_replace('/[!#]/', ' ', $pastedText);
     $cleanText = preg_replace('/\\s\\s+/', ' ', $bulkText);
     assertThat($cleanText, is("foo bar baz quux"));
 }
Пример #2
0
 public function scanMonkFileRendered($tmpfname)
 {
     list($licenseIds, $highlights) = $this->scanMonk($tmpfname);
     $text = file_get_contents($tmpfname);
     $this->highlightProcessor->addReferenceTexts($highlights);
     $splitPositions = $this->highlightProcessor->calculateSplitPositions($highlights);
     $textFragment = new TextFragment(0, $text);
     $rendered = $this->textRenderer->renderText($textFragment, $splitPositions);
     return array($licenseIds, $rendered);
 }
Пример #3
0
 /**
  * \brief Given a file handle, display "strings" of the file.
  */
 function getText($inputFile, $startOffset, $Flowed, $outputLength = -1, $splitPositions = null, $insertBacklink = false)
 {
     if (!($outputLength = $this->checkAndPrepare($inputFile, $startOffset, $outputLength))) {
         return "";
     }
     $output = "";
     $output .= $Flowed ? '<div class="text">' : '<div class="mono"><pre>';
     fseek($inputFile, $startOffset, SEEK_SET);
     $textFragment = new TextFragment($startOffset, fread($inputFile, $outputLength));
     $renderedText = $this->textRenderer->renderText($textFragment, $splitPositions, $insertBacklink);
     $output .= ($Flowed ? nl2br($renderedText) : $renderedText) . (!$Flowed ? "</pre>" : "") . "</div>\n";
     return $output;
 }