|
QD Includer A Quick & Dirty Include Utility User Manual Version 1.00, 2003/09/04 |
|
Contents
QD Includer (or just QDI) is a program for quick-and-dirty text insertion into source files, developed originally to facilitate maintenance of mid- to large-size Web sites, but usable also outside of that area. The program is free. The HTML standard does not provide an easy to use code insertion facility (like, for example, one in the C programming language). Neither style sheets, nor server-side includes will replace this feature, the former being too limited in scope, the latter depending on the server software. Some HTML development tools offer similar functionality, but many of us stay away from them, as the quality of HTML code generated by those tools ranges from very bad to abysmal, and the code is often difficult to manage and maintain. Many HTML writers (myself included) believe that hand-coding, if done the right way, is easier, faster, and results in better pages. Regardless of all the above, it happens often that we would like the same fragment of code to be shared between a number of HTML documents. How simple would that be if the HTML standard allowed for something like
... some code ... No way. The text if "my_metatags.html" has to be mechanically inserted in every page using it, and when it needs to be changed, the changes have to be carried out in all files. How stupid. QDI fills this gap. It will take a directory tree, go through all HTML files in that tree, identify all insertion points and insert (or replace) the insertion text as needed. The whole process will take a minute or two. This is quite simple. If you want to insert the files "my_metatags.txt" and "site_map.txt"into a number of HTML files, you will have to modify each of those files like this:
... your old code before the first insertion point ... Note that the text between "" is transparent to all Web browsers, being treated as a comment. QDI recognizes a comment text starting from "#" as the name of file to insert, and a single "#" — as the end of insertion (these markers can be changed when you run the program, if you need). Now, if QDI finds files "my_metatags.txt" and "site_map.txt", the text from these files will be inserted between the markers like this:
... your old code before the first insertion point ... Important: all tags specifying the insertions have to be alone on their lines, and not split between lines. Thus, for example, this code will not work as expected: <HR> <!-- #my_metatags.txt --> and neither will this one: <!-- #my_metatags.txt --> If at any moment you modify the insertion files and rerun QDI, the old inserted text between the markers will be replaced with the new version. Note that each insertion is a single file. All insertion files are expected to be stored in the same directory. The default directory is "_i", placed in the local directory (i.e., the one from where you run QDI in the command line mode). This can be changed from the command line. To run QDI, open a command line interface (DOS session in Windows, or the Take Command shell from JP Software). You may have the location of QDI added to the path, or QDI copied to the directory you are in, or (if neither of these conditions is met), you will have run QDI specifying the full program path. QDI takes a number of command line arguments, some of the form "/x" (switches), and some — "key=value". No spaces are allowed around "=", and if the value contains spaces, it has to be contained in double quotes which will be removed by QDI. The switch-like arguments are:
Here are the keyed arguments recognized by QDI. If an argument is not given, the default value will be used. The dot, "." denotes the current directory.
For example, if you run QDI.EXE from your root HTML directory, and created a sub-directory "_i" there to store your include files, and if your files have an .html extension, you may run QDI just by entering the command line qdi /s If, however, your file extensions are .htm, and if you keep your include files just in the root directory, your command may be qdi idir=. files=*.htm /s Now, let us assume that, in addition to that, you want to use DOS line terminators (this is only a waste of space, as HTML recognizes the UNIX style under Windows just fine), and you do not want to process the nested directories. This way you have to type in qdi idir=. files=*.htm /s /d Notes:
QDI climbs your directory tree from the specified root. In every visited directory it processes all files matching the "files" command line argument. The processing of a single file is relatively simple.
QDI is free to use. Shareware and freeware vendors may include it i their collections as long as this document is also included. Updates (new features, bug fixes) are available at http://www.wrotniak.net/works/qdi/index.html where you can also find my email address. Although the program is supplied on the "as is" basis, I will be glad to receive feedback: problem reports and enhancement suggestions. On the other hand, I cannot offer you any help in HTML coding, or regarding the Windows directory structure. |
|
WARNING: QDI is not a toy! It is used to modify multiple files in multiple directories and this always can be a dangerous operation! Use this program only if you really know what you are doing, and always back up your files beforehand! Legal stuff: although the author has taken more than reasonable care to assure that the program works exactly as documented below and does not cause any damage, he assumes no responsibility, express or implied, for any results of use, misuse, or inability to use this software. If you, the end user, do not accept all risk and responsibility for running qdi and for any damages it may cause, you are hereby requestednot to use the program and remove the QDI executable from your system. Sorry for the language used above, but we are living in a country where a bunch of morons sues a hamburger maker for making them fat (they should rather sue their parents for giving birth to idiots), or where another nitwit wins a big settlement after spilling a cup of hot coffee on her private parts; I don't want to be kept responsible if you destroy your corporate Web site. Again: back up, back up, back up everything! |
| Document last updated 2005/08/15 |