From 53cddb9c9e119561458dff43a4b1be67de73cf4f Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Sat, 28 Oct 2017 15:47:06 +0200 Subject: [PATCH 1/1] 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 --- data/config.default.php | 3 ++- src/phorkie/Renderer/Plaintext.php | 25 +++++++++++++++++++++++++ www/css/phorkie.css | 3 +++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/phorkie/Renderer/Plaintext.php diff --git a/data/config.default.php b/data/config.default.php index 06b53ed..fce74c1 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -161,7 +161,8 @@ $GLOBALS['phorkie']['languages'] = array( 'txt' => array( 'title' => 'Text (plain)', 'mime' => 'text/plain', - 'geshi' => 'txt' + 'geshi' => 'txt', + 'renderer' => '\\phorkie\\Renderer_Plaintext' ), 'ts' => array( 'title' => 'TypoScript', 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 @@ +
'
+            . htmlspecialchars($file->getContent())
+            . '
' . "\n"; + return $html; + } +} + +?> diff --git a/www/css/phorkie.css b/www/css/phorkie.css index e9bce5d..3619d54 100644 --- a/www/css/phorkie.css +++ b/www/css/phorkie.css @@ -110,6 +110,9 @@ h1 { margin: 0px; margin-bottom: 2ex; } +.code pre.txt { + white-space: pre-wrap; +} .code { overflow-x: auto; } -- 2.30.2