Scott Hurring coded a script that would accept the url of some script and view its (colored) source. That script can be found at
http://hurring.com/code/php/view_source/
I've changed that script a bit. In Scott's version some directories could be blacklisted. In my version the scripts that can be displayed must be whitelisted. I am more convenient with that version.
Additionally I made the script generate XHTML conforming to
1.0 strict. And removed some code that dealt with incapabilities of older versions of
InternetExplorer.
For documentation of that script please refer to Scott's page linked above.
'Download'
My version can be accessed
here. I just removed some directory-names in that public version of the script.
Addition
- 20050617: I've written a small script that checks whether the referenced files actually exist. The script can be accessed here. You'll need python to run the script...
Motivation
I came upon this solution because I didn't want to have a version of the script that does the work and another that could be displayed (e.g. by appending
.txt to the script's name). Some scripts change rather often which results in bothering me by having to generate that second version.
That script allows for displaying the script that actually does the work. No need for some .txt-version.
Version 1.1 introduced
aliases which helps hiding the internal structure of the server (-directories).
Sometimes it is still necessary to generate a second version. That's mainly the case when the script contains information one does not want to get public.
Examples
Versioning
1.0gungfu @ 20050415
First version gungfuized.
1.1gungfu @ 20050506
Introducing aliases in $whitespace. Instead of giving a concrete location to some file an alias can be used which is mapped in the script to the concrete location. This hides even more the internal structure of the server and has the additional advantage of decoupling the name from the location, making changes to the structure not breaking the links.