#!/usr/local/bin/perl # *********************************************************************** # # * * # # * Copyright (c) 1996-1999 Scott Crevier * # # * All Rights Reserved Worldwide * # # * * # # * This program product material is the property of Scott Crevier. * # # * This program may be used and modified by anyone free of charge, * # # * as long as this copyright notice remains in tact. By using this * # # * code, you agree to indemnify Scott Crevier from any liability * # # * that might arise from its use. * # # * * # # * scott@crevier.org - Scott M. Crevier - www.crevier.org * # # *********************************************************************** # # * HyperText Converter v2.0 22-Dec-1998 * # # * * # # * The purpose of 'htc' is to convert an HTML file into an equivalent * # # * HTML file that is practically impossible to read with the human * # # * eye. This allows web developers to convert sensitive web pages * # # * into a format, so that when the typical web surfer views the HTML * # # * source, they immediately think "What the hell is this?!" * # # * * # # * This is a perl script that converts alpha characters to their * # # * equivalent values in the ISO-Latin-1 character set. It also * # # * converts all newline characters to spaces. * # # * * # # *********************************************************************** # # * Instructions: * # # * * # # * 1. Put the 'htc' script in a directory that is referenced in * # # * your PATH envirnment variable. Also make sure that the script * # # * is executable (chmod 700 htc). * # # * * # # * 2. Create your HTML file just as you normally would, except for * # # * the filename. Use the ".src" file extension. For example, your * # # * main file would be named "index.src". * # # * * # # * 4. Run the 'htc' script, passing it your source filename as an * # # * argument on the command line and redirecting the output as * # # * needed. For example: * # # * * # # * htc index.src > index.shtml * # # * OR * # # * htc index.src > index.html * # # * * # # * * # # *********************************************************************** # # * WARNINGS: * # # * * # # * 1. This is version 2.0. It's pretty crude but it works just fine. * # # * Future versions may be made a little more efficient, etc. * # # * * # # * 2. Your target file may be up to 6 times larger than your source * # # * file. This is not a design flaw; it's how it works. You can * # # * easily understand this if you know, for example, that every * # # * occurance of the letter 's' will be converted to the string * # # * 's'. * # # * * # # * 3. The contents of HTML tags MUST NOT be converted, therefore, * # # * they will remain in their original state and will still be * # # * legible. Only the alpha text (A-Z,a-z) between HTML tags will * # # * be converted. (I could have converted digits also, but it * # # * really is not necessary). * # # * * # # * 4. Since all newline characters are also removed, certain * # # * implementations of JavaScript might get messed up, so pay close * # # * attention. * # # * * # # * 5. If you use any character entities in your code (i.e. ©) * # # * the alpha portion of the code WILL BE CONVERTED. THIS IS BAD. * # # * Therefore, before converting the file, change any codes to * # # * their numeric equivalent (i.e. ©). * # # * * # # * 6. This script will remove all comment lines. For purposes of * # # * functionality, a comment line is defined as one that begins * # # * with the 5 characters " endOfPlug print ""; print ' ' x 20; # *************************************************************** # # * Loop through each line in the file. * # # *************************************************************** # $conv_flag = 1; while (<>) { # *********************************************************** # # * If it's a comment line, we don't want it. * # # *********************************************************** # unless (/^ userComments exit(0); # *********************************************************************** # # * Subroutine to determine if a character is an alpha character. * # # *********************************************************************** # sub isalpha() { local($ch) = @_; $ch =~ /[a-zA-Z]/; }