aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2017-10-28 15:47:06 +0200
committerChristian Weiske <cweiske@cweiske.de>2017-10-28 15:47:06 +0200
commit53cddb9c9e119561458dff43a4b1be67de73cf4f (patch)
tree9a3627b682d8a3324a0e086a208bdd7f0cbeac43 /src
parent01fee6cee1831c88fe9522167940d2ad68657efa (diff)
downloadphorkie-53cddb9c9e119561458dff43a4b1be67de73cf4f.tar.gz
phorkie-53cddb9c9e119561458dff43a4b1be67de73cf4f.zip
Word-wrap for txt files
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
Diffstat (limited to 'src')
-rw-r--r--src/phorkie/Renderer/Plaintext.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/phorkie/Renderer/Plaintext.php b/src/phorkie/Renderer/Plaintext.php
new file mode 100644
index 0000000..ef448f9
--- /dev/null
+++ b/src/phorkie/Renderer/Plaintext.php
@@ -0,0 +1,25 @@
+<?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;
+ }
+}
+
+?>