File: genhtml/__docs__/this-page-template.txt

$DOCTYPE$

<HTML>

<HEAD>

<TITLE>genhtml - Book supplemental example</TITLE> 

$META$

$ICON$

$STYLE$

$SCRIPT$

<STYLE>
.notebox {
    margin-left: 40px; 
    margin-right: 40px; 
    margin-top: 30px;
    margin-bottom: 30px;
    border-style: solid; 
    border-width: 1; 
    padding: 5px;
    background-color: cornsilk;
}
</STYLE>

</HEAD>


<BODY>


<H1><I>genhtml</I> &mdash; Static HTML Inserts for Website Files</H1>


<P class=notebox>
<I><B>New</B></I>: as of June 2017, genhtml now  
handles ".*" Mac/Unix cruft files in inserts and templates folders.
This includes both ".DS_Store" Finder files, and any "._*" AppleDouble 
resource-fork files on non-Mac drives.  Both are skipped in inserts 
to avoid errors, but are simply copied like other non-HTML in templates 
because more may pop up&mdash;filter later with your zip or upload tools 
(e.g., <A HREF="ziptools.html">ziptools</A>).
See the new <A HREF="genhtml/genhtml.py">script's</A> 
docstring for details.  For a quick example of genhtml at work, 
see also the template file for the page you are
<A HREF="genhtml/this-page-template.txt">viewing</A>, and its expansion 
via your browser's "view source."


<P>
This Python 3.X program replaces keys in a folder's HTML code files with the 
content of correspondingly-named text files, providing basic HTML macro functionality. 
For static content, it can be used to avoid mass cut-and-pastes (which are
prohibitively tedious); JavaScript hacks on the client (which users may disable);
and PHP server-side inserts (which can make your pages dependent on a server).

<P>
Among its features, this program has automatic dependency tracking&mdash;HTML files are 
regenerated when their templates or any inserts they use have changed; configurable Unicode 
support&mdash;encodings in a sequence are tried in turn for each HTML file; and one-level 
nested inserts&mdash;insert files can insert other insert files.  It also serves to 
illustrate a typical utility role for Python scripts.

<P>
See the main script's docstring and other items below for usage details.


<P>
<B><I>Code and docs</I></B>:
<UL>
<LI><A HREF="genhtml/genhtml.py">genhtml.py</A> &mdash; the main script's source (380 lines, 1/3 docstring)
</UL>


<P>
<B><I>Example</I></B>:
<UL>
<LI><A HREF="genhtml/Html-inserts/FOOTERMAIN.txt">Inserts file</A> &mdash; filename gives key 
                                                  (plus the <A HREF="genhtml/Html-inserts/FOOTER-COMMON.txt">nested insert</A>)

<LI><A HREF="genhtml/Html-templates/test1.html">Template page</A> &mdash; with insert targets (inspect with "view source")

<LI><A HREF="genhtml/Complete/test1.html">Generated page</A> &mdash; with inserts applied (inspect with "view source")
</UL>


<P>
<B><I>Usage</I></B>:
<UL>
<LI><A HREF="genhtml/__docs__/run-log.txt">Run log examples</A> &mdash; script interaction

<LI><A HREF="genhtml/__docs__/console.png">Console screen shot</A> &mdash; session capture

<LI><A HREF="genhtml/__docs__">Docs folder</A> &mdash; assorted documentation augmenting the script's docstring
</UL>


<P>
<B><I>Download/view all</I></B>:
<UL>
<LI><A HREF="genhtml/genhtml.zip">genhtml.zip</A> &mdash; with all tests, docs, and examples</A>

<LI><A HREF="genhtml/">Unzipped content online</A> &mdash; script, docs, more examples and test pages
</UL>
</P>


<P>
This program was last changed June 11, 2017.

<P>
For more code examples, see the
<A HREF="programs.html">programs</A> page.  
</P>



$FOOTERTAN$

</BODY>
</HTML>



[Home page] Books Code Blog Python Author Train Find ©M.Lutz