function writeHoricontalLine($line, &$status) { $status->trace(TC_Util2, 'writeHoricontalLine'); $count = countRepeats($line, '-'); if ($count < 4) { writeLine($line, $status); } else { guiLine($count - 3); } }
function wikiToHtml(&$session, $wiki_text) { $lines = explode("\n", $wiki_text); $session->trace(TC_Util1, 'wikiToHtml: ' . (0 + count($lines)) . ' Zeilen' . "({$lines['0']})"); $status = new LayoutStatus($session); $last_linetype = ''; foreach ($lines as $ii => $line) { $start_code = false; if (!$status->fPreformatted && ($line_trimmed = trim($line)) == '') { $last_linetype = ''; $status->changeOfLineType($last_linetype, ''); } else { $linetype = $status->fPreformatted ? '[' : substr($line, 0, 1); switch ($linetype) { case '-': $count = countRepeats($line, '-'); if ($count < 4) { $linetype = 'x'; } break; case '[': if (strpos($line, 'code]') == 1) { $start_code = true; } elseif (strpos($line, '/code]') == 1) { $status->finishCode(); $last_linetype = 'x'; $line = $line_trimmed = substr($line, 7); $session->trace(TC_Util2, 'wikiToHtml: /code-Restzeile: ' . $line); } else { $linetype = 'x'; } break; case '!': case ';': case '*': case '#': case '|': break; default: $linetype = 'x'; break; } $last_linetype = $status->testChangeOfLineType($last_linetype, $linetype); switch ($linetype) { case '!': if (strpos($line, '|') != 1) { writeHeader($line, $status); } else { writeTableHeader($line, $status); $last_linetype = '|'; } break; case '[': if ($start_code) { $status->startCode(); } $line = substr($line_trimmed, 6); if (!empty($line)) { writeLine($line, $status); } break; case ';': writeIndent($line, $status); break; case '*': writeUList($line, $status); break; case '#': writeOrderedList($line, $status); break; case '|': writeTable($line, $status); break; case '-': guiLine($status->fSession, $count - 3); break; default: writeLine($line, $status); break; } } } // foreach if ($status->fPreformatted) { $session->trace(TC_Warning, PREFIX_Warning . '[/code] fehlt'); } $session->trace(TC_Util1, 'wikiToHtml-Ende'); }