From 5f2d4d9d38caa1546b0d8dd7b72c6a0647aaea7a Mon Sep 17 00:00:00 2001 From: "David Humphrey (:humph) david.humphrey@senecacollege.ca" Date: Thu, 3 Apr 2014 21:09:43 -0400 Subject: [PATCH] Better output for regular files --- src/handlers.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/handlers.js b/src/handlers.js index eeafc13..b02e09d 100644 --- a/src/handlers.js +++ b/src/handlers.js @@ -344,7 +344,7 @@ function(Filer, Async, Log, Content) { }, /** - * Send the raw file + * Send the raw file, making it somewhat more readable */ handleFile: function(path, fs) { fs.readFile(path, 'utf8', function(err, data) { @@ -353,7 +353,16 @@ function(Filer, Async, Log, Content) { this.handle404(path); return; } - _writeMarkup(data); + + // Escape the file a bit for inclusing in
...
+ data = data.replace(/\/gm, '>') + .replace(/&/gm, '&'); + + var syntheticDoc = '' + + ' ' + + '
' + data + '
'; + _writeMarkup(syntheticDoc); }); },