summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
01fee6c)
This means there are no line numbers for .txt anymore,
but I find it more important to have word wrap.
Resolves: https://github.com/cweiske/phorkie/issues/31
'txt' => array(
'title' => 'Text (plain)',
'mime' => 'text/plain',
'txt' => array(
'title' => 'Text (plain)',
'mime' => 'text/plain',
+ 'geshi' => 'txt',
+ 'renderer' => '\\phorkie\\Renderer_Plaintext'
),
'ts' => array(
'title' => 'TypoScript',
),
'ts' => array(
'title' => 'TypoScript',
--- /dev/null
+<?php
+namespace phorkie;
+
+/**
+ * Render plain .txt files
+ */
+class Renderer_Plaintext
+{
+ /**
+ * Simply displays the file
+ *
+ * @param File $file File to render
+ *
+ * @return string HTML
+ */
+ public function toHtml(File $file)
+ {
+ $html = '<div class="code"><pre class="txt">'
+ . htmlspecialchars($file->getContent())
+ . '</pre></div>' . "\n";
+ return $html;
+ }
+}
+
+?>
margin: 0px;
margin-bottom: 2ex;
}
margin: 0px;
margin-bottom: 2ex;
}
+.code pre.txt {
+ white-space: pre-wrap;
+}
.code {
overflow-x: auto;
}
.code {
overflow-x: auto;
}