image provider

HTML Static Macros

View the latest version of this manual online at
Introduction Existing Macros
Advantages Quotations
Disadvantages Caching
How to Proceed Costs
How It Works Set Variables


HTML (Hypertext Markup Language) static macros are a way of generating boilerplate HTML for your website, without the complexity or cost of JSP (Java Server Pages) or other server-side technologies. You embed terse commands called macros, e.g. <!-- macro Foot --> in your HTML text and run the macro preprocessor to expand the boilerplate, e.g. a page footer. Once you have your expanded HTML decided all is as you want it, you upload the expanded HTML to your website, where it is served statically.

The basic idea is this. You embed magic comments in your HTML that look like something like this:

<!-- macro Measure 20 cm -->

Then you run htmlmacros.exe and it expands those comments to boilerplate that looks like this:

<!-- macro JDisplay Measure 20 cm -->

and renders for your viewers like this:

20 cm (7.87 in)

Advantages of HTML Static Macros

Disadvantages of HTML Static Macros

How to Proceed

The packages included:
Packages Included
Package Purpose
com.mindprod.htmlmacros The macro expansion engine and a large set of macros, some of which you might use unmodified, some you will find useless and can be discarded and some you can cannibalise to create your own variants e.g. page header and footer macros. com.mindprod.htmlmacros.macro contains the macros themselves. They extend abstract class com.mindprod.htmlmacros.macro.Macro. contains utility code to make writing macros easier.
com.mindprod.stores Code for generating references to a multitude of Amazon and other bookstores with embedded affiliate codes, so I get a commission if somebody clicks and buys a recommended book. If you don’t want to use this feature, you can discard and com.mindprod.htmlmacros.macro. and the packages.
com.mindprod.common18 Various utility classes, mainly for string manipulations.
com.mindprod.compactor Compacts out unnecessary whitespace from the finished HTML for faster up and downloading.
com.mindprod.comparators Comparators for sorting.
com.mindprod.csv Reads and writes Comma-separated value fields.
com.mindprod.currcon Displays prices in the local currency, works in conjunction with the CurrCon Applet. If you don’t want to use this feature you can discard and the com.mindprod.currcon package.
com.mindprod.entities converts HTML entities ⇒ unicode.
com.mindprod.filter Used to control which files to process.
com.mindprod.fourtidy Tidies DESCRIPT.ION files used in tcc/Take Command to track what all the various files are for.
com.mindprod.hunkio Utility class for rapidly reading entire files in one i/o.
com.mindprod.http Utility class doing HTTP (Hypertext Transfer Protocol), mainly screen-scraping information off the web. Not used directly by any macros but some of the auxiliary programs use it for batch gathering information, e.g. information about books.
com.mindprod.isbn Used if you handle book ISBN (International Standard Book Number) numbers in your macros. If you don’t handle books on your website, you can delete this package, and com.mindprod.htmlmacros.macro. and the packages.
com.mindprod.jdisplay com.mindprod.jdisplayaux com.mindprod.jtokens com.mindprod.jprep JPrep manual. It generates program and other listings colourised using a variety of fonts and sizes to highlight. If you don’t want to use this feature, you can discard com.mindprod.htmlmacros.macro. JDisplay . java and the com.mindprod.jdisplay, com.mindprod.jdisplayaux, com.mindprod.jdisplayorphans, com.mindprod.jprep and com.mindprod.jtokens packages.
com.mindprod.ledatastream Used to read little-endian binary data, such as the fields inside a GIF (Graphic Interchange Format) image.
com.mindprod.prices Used for generating such as price lists of software.
com.mindprod.qf Used to automatically build glossary indexes, such as the Java glossary, the Computer buyers’ glossary, the gay and black slang glossary and the environment glossary. Unless you have glossaries on your website, you can discard this package. It is fairly integrated into my headers, so you probably should just keep it around until you have removed all indexing style headers. It allows you to embellish entries with various icons to warn users of large web pages, particularly important items etc.
com.mindprod.seesort Used to sort lists of references to other pages in alphabetical order. Also to automatically insert links, using the glossary indexes.
com.mindprod.sitemap Builds a list of all files on the website, when it was last modified and how often it should be spidered. Used by Google to speed up spidering of your website.
com.mindprod.untouch Backdates files to their original dates if they contain no net changes since the last upload. This saves pointless uploads and Google respidering.
  1. Download the HTML static macros package. It comes bundled with various auxiliary packages also downloadable separately.
  2. Look at various pages on the website with your browser and view source to see the macros and how they expand. Study the source code. Use the Replicator to get yourself a local up-to-date copy of my entire website for easier study.
  3. Study the source code for a simple macro such as Photo. java.
  4. Install ANT and try compiling the code and using it to expand the macros on my website. If you don’t use the Jet native compiler, strip out the references to Jet in the ANT and BAT (Batch) files.
  5. Make a copy of the source code and modify com.mindprod.htmlmacros.macro. Configure. java. Leaving alone anything you don’t understand, for now.
  6. Throw away any macros you are fairly sure you will never use, or will never want to cannibalise. You can always get a fresh copy from my website. Write you own simple macro and try it out.
  7. You can do quite a bit to change the look and feel of the generated code just by modifying the style sheet mindprod.css, without changing any macros at all.
  8. Focus on getting your various header and footer macros going. Mine are pretty complicated with two kinds of Google AdSense ads, rotating public service ads, bread crumbs and indexes. Here are three approaches.
    1. You can write your own header and footer macros from scratch, cannibalising bits from mine.
    2. You can take mine and strip out parts you definitely don’t want, leaving the parts you don’t understand yet intact.
    3. You can hire me to write custom macros to your specifications for you.
    For this work, you might find the quoter amanuensis very useful. You can feed it finished sample HTML from your existing website and it will convert it into Java String literals that you can embed in your header and footer macros, then add the variable and calculated bits to it.
  9. Strip out whatever you don’t immediately need. You can always add it back later.
  10. Just keep gradually improving your macros and making your code more and more modular — encapsulate. Don’t clone! It is your code now. You can change anything you like.

How It Works

A general purpose parser called the Replace scans your HTML files looking for <!-- macro XXXX magic comments. The first word after the word macro is the name of the Macro and also the name of the class that expands it. Each parameter is enclosed in spaces,, "s or {}s. Keyword=value pairs may be optionally separated by =. Replace loads that class and hands in the massaged following parameters calling the macro’s expandMacro method. The macro hands back the expansion and the Replacer inserts that text after the <!-- macro XXXX so you can see both the abbreviation and the expansion. It removes any old expansion first. It uses Class. forName to load the classes, so all you need do to create a new macro is write the source code for the macro and put the class file in the jar. You don’t have to register the class in any way.

Existing Macros

Various Existing Macros
Class Purpose Syntax Example
Acronym Displays an acronym and its expansion with embedded styles to highlight the capital letters in the expansion. There are a number of built-in acronyms for which specifying the expansion is optional. <!-- macro Acronym [plain] [means] [td] {acronym} {expansion} --> <!-- macro Acronym DU (Depleted Uranium) {Depleted Uranium} -->
<!-- macro Acronym DU-->. The plain option displays just the acronym, suitably highlighted. The means option displays just the meaning, without the acronym. By default both are displayed the first occurrence on the page and just the acronym thereafter. The td option encloses the acronym and meaning in <td>…</td> tags to arrange acronyms and meanings in table columns.
Age calculates age in years, months, days, e. g. supply birthdate and it expands to current age in years as of the time the macro was expanded. <!-- macro Age date yyyy-mm-dd [on yyyy-mm-dd] [years/months/days] --> <!-- macro Age 1948-02-04 years -->
AllPosters Generates a thumbnail affiliate link to <!-- macro AllPosters title productID prunedProductLink prunedthumbnailImageName width height --> <!-- AllPosters macro AllPosters Morning Textures 923499 Morning-Textures 10/1020/IUUW000Z 160 160 -->
Art Generates a thumbnail affiliate link to <!--macro Art title productid width height --> <!--macro Art Victoria Falls, Zimbabwe 12870686 115 86 -->
Audio Generates an iconic link to an audio file. <!--macro Audio soundfile format --> <!--macro Audio {} mp3 -->
BestBrowsers Generates a list of recommended browsers and versions. <!-- macro BestBrowsers context, [trouble] --> <!-- macro BestBrowsers glossary Your current browser cannot deal with frames -->
Book Generates book referral link to an Amazon, Powell’s, Barnes & Noble, Chapters etc bookstores. <!-- macro Book isbn, [paperback] [hardcover] [kindle] title, author, [notes], [publisher], [published], [class], [bookcoversdir] --> <!-- macro Book isbn=9780960068883 paperback=9780960068883 hardcover=9780960068890 title="Handbook to Higher Consciousness author=Ken Keyes Jr. publisher=Love Line" published=1984-08 notes={Ken’s classic. This is by far his best selling book.} -->
Button Generates a clickable or decorative button <!-- macro Button buttonname [webroot-relativeURL] --> <!-- macro Button launch webstart/setclock.html --> The image used to render the button is image/button/launch.png. The lettering on the button is launch.
ColourScheme Displays a row of colour swatches <!-- macro ColourScheme list of hex colours --> <!-- macro ColourScheme #000000 #808080 #ffffff -->
CurrCon Displays currency/price converted to the user’s home currency. See CurrCon Manual. There are many variants. <!-- macro CurrCon c$AN USD 10.00 -->
DailySpecial Random link to something on the website. Changes daily. You need to follow it with some text, or an image and a </a> tag. <!-- macro DailySpecial list of relative-url-possibilities --> text/image </a> <!-- macro DailySpecial
-->Take a chance</a>
Degrees Computes and displays temperatures in both degrees Celsius and Fahrenheit. <!-- macro Degrees temperature then F or C [delta] --> <!-- macro Degrees 5 F delta -->
Dim Displays length, width × height or width × height × depth dimensions in both metric and imperial measure. The td option generates code for a pair of table columns. <!-- macro Dim width x height unitsOfMeasure td --> <!-- macro Dim 40 x 20 cm -->
Donates Generates link to PayPal to let a visitor donate. <!-- macro Donate cause buttoncode --> <!-- macro Donate Computer Buyers’ glossary T9GKBKG8XPBA4 -->
DVD (Digital Video Disc) Affiliate referral link to a DVD. <!-- macro DVD asin=, [upc=], title=, author=, [type=] [notes=], [class=] --> <!-- macro DVD asin=B00179CXIK title=The Truth About Climate Change author={David Attenborough} notes={Britain’s most famous naturalist holds forth. Only available in Britain. Make sure to get the version you buy has a region that can be handled by your player.} -->
Electronic Generates referral link to Amazon, Tiger Direct and NewEgg. Usually electronic sales. <!-- macro Electronic many keyword=value pairs --> <!-- macro Electronic asin=B00006LIQL title=TiVo Digital Recorder notes={Magnetic tape-style vcrs will not longer work with digital TV. Instead you use a digital recorder. This one from TiVo will record your favourite programs for you without you having to explicitly tell it when they are on since it consults an online TV guide it accesses via a telephone call. Further, it will let you pause and rewind a show you are watching live. It can record 80 hours digitally. Some TVs come bundled with a digital recorder.} -->
FileInJDK Generate a reference to the local copy of some file in the current JDK (Java Development Kit). <!-- macro JDKLocation reference description --> <!-- macro JDK Location bin\native2ascii.exe native2ascii.exe -->
Env Expands to the value of some variable in the set environment. <!-- macro Env {var} --> <!-- macro Env JAVA_HOME -->
FileInJRE Generate a reference to the local copy of some file in the current JRE (Java Runtime Environment). <!-- macro JRELocation reference description --> <!-- macro JRELocation {lib/security/C:\Users\} {cacerts list of trusted certificate authorities} -->
FileSize Expands to the current size of a given file. <!--macro FileSize webRoot-relative local file name--> <!--macro FileSize zips/ -->
Foot Standard footer. Quite elaborate with rotating ads, navigation and various icons. <!--macro Foot [ad] [noad] [nonmil] [nextpage]--> <!--macro Foot nonmil -->
Image Displays an image in the image directory tree, finds the dimensions itself. <!-- macro Image image file, [caption/link] altText [link url] [align] --> <!-- macro Image animal/browneggs.jpg caption Rhode Island Red free range brown eggs right --> Possible alignments include: none bottom center floatleft floatright left middle right top.
Include raw include text from a local file on disk. Use webroot relative filename. (Originally absolute names were used, but this was changed in preparation for converting to JSP .) May be nested. i.e. the included text might possibly containing embedded macros that need to be expanded/refreshed, including Include macros. <!--macro Include webroot-relative-filename to include. --> <!--macro Include include/primeminister.htmlfrag--> Include does not adjust relative links or link classes. You must prepare your includes with relative links constructed as if they were already included in place or use macro Link style self-adjusting links. Included text may contain macros, expanded or unexpanded. They may even include Include macros.
EE (Enterprise Edition) Link to Oracle’s EE documentation. <!-- macro EE {reference.} {description} --> <!-- macro EE {javax/servlet/http/HttpServletResponse.html} {Server HTTP response codes} -->
JavaAPI Link to Oracle’s Java classes Javadoc both locally and on Oracle website. <!-- macro JavaAPI reference description --> <!-- macro JavaAPI {java/util/zip/Adler32.html} {Adler32} -->
JavaFXAPI Link to Oracle’s JavaFX classes Javadoc both locally and on the Oracle website. <!-- macro JavaFXAPI reference description --> <!-- macro JavaFXAPI javafx/scene/control/DatePicker.html DatePicker -->
JDisplay Display a colourised program, bat, csv etc listing using a variety of automatically fonts and sizes based on parsing the file in corresponding snippet directories, preparsed by JPrep. <!-- macro JDisplay snippetName [maxwidth] [maxheight] --> <!-- macro JDisplay -->
JavaCC Generate a reference to a JavaCC parser. <!-- macro JavaCC parserName url email author releaseDate notes --> <!-- macro JavaCC Oberon {} oberon.jj "James Power" 1998-11-17 -{A parser for the programming language Oberon-2. Oberon is the latest generation in the Wirth family of languages, an heir to the Pascal and Modula tradition.} -->
JDK Generate a reference the current or previous JDK or some part of it. <!-- macro JDK flavour --> where flavour is one of defaultpath, dir, fullversion, macro, micro, path, path32, recommendedversion, url, url32 version. <!-- macro JDK fullversion -->
defaultpath : C:\Program Files\java\jdk1.8.0_131\
dir : jdk1.8.0_131
fullversion : 1.8.0_131
macro : 1.8
micro : 0
path : J:\Program Files\java\jdk1.8.0_131\
path32 : J:\Program Files (x86)\java\jdk1.8.0_131\
recommendedversion : 1.8.0_131
url : file:///J:/Program%20Files/Java/jdk1.8.0_131
url : file:///J:/Program%20Files%20(x86)/Java/jdk1.8.0_131
version : 1.8.0
There are still more like oldfullversion, jetprofileversion, jetversion, jetfullversion, intellijversion, intellijfullversion.
FileInJDK Generate a reference to the local copy of some file in the current JDK. <!-- macro JDKLocation reference description --> <!-- macro JDKLocation bin\native2ascii.exe native2ascii.exe -->
JRE Generate a reference the current JRE or some part of it. <!-- macro JRE flavour --> where flavour is one of defaultpath, dir, fullversion, macro, micro, path, path32, recommendedversion, url, url32, version. <!-- macro JRE path -->
defaultpath : C:\Program Files\java\jre1.8.0_131\
dir : jre1.8.0_131
fullversion : 1.8.0_131
macroversion : 1.8
microversion : 0
path : C:\Program Files\java\jre1.8.0_131\
path32 : C:\Program Files (x86)\java\jre1.8.0_131\
recommendedversion : 1.8.0_131
url : file:///C:/Program%20Files/Java/jre1.8.0_131
url32 : file:///C:/Program%20Files%20(x86)/Java/jre1.8.0_131
version : 1.8.0
There are still more like oldfullversion, jetprofileversion, jetversion, jetfullversion, intellijversion, intellijfullversion.
KJV Generate a labeled link into the online version of the King James Bible. <!-- macro KJV (! = display or ~ = suppress) book fromChapter:fromVerse [toChapter:toVerse] --> <!-- macro KJV ! Leviticus 15:29 15:30 -->
Link A generic href usually for use in included text that is adjusted to account for which page the text is included, in other words converts from upPath to relative link and css class for in the context of the the text is inserted. <!-- macro Link a webroot-relative-URL description cssclass. --> <!--- macro Link contact/roedy.html#NONMIL Non-military use only. plain -->
LL Describes one person for a database of people <!-- macro LL 15 fields: nickname name attended photo homephone workphone noLongerUsed emailpng website address city prov postal country notes --> <!-- macro LL Roedy Roedy Green + people/roedy200805.jpg "(250) 361-9093 workPhone dummy roedy XXXX YYYY Street" Victoria BC V8T 4G8 Canada {Single, gay, HIV (Human Immuno-deficiency Virus) +, born <span class=date>1948-02-04</span>. Been attending workshops since <span class=date>1977-06</span> in Berkeley. Lead a Living Love <a href=workshop.html>workshop</a> in England in <span class=date>2002-09</span> and at Quadra Island in <span class=date>2001-08</span>. If you visit Victoria, &mdash; you are welcome to sleep on my floor. Hosts a <a href=livinglove.html>Living Love Website</a>. See my <a href=llbio.html>living love biography</a>. See <a href=../contact/roedy.html>resume</a>. Knows Angela Wensley, Geneva Hagen and Marty Bunch.} -->

This example shows how you can embed HTML including entities and tags inside parameter values.

MailTo Generates a munged email reference using a Masker-created png file in the image/mailto directory. This foil spam harvesters looking for email references on your website. <!-- macro MailTo mungedEmailImageName(name of masker file without .png) personName [email/name/both] --> <!-- macro MailTo nicfulton Nic Fulton both -->
Measure Ddiscontiued. Replaced by the more general Dim macro.
Moved Generates a stub page to indicate a page that formerly had the stub’s name and location has moved, that automatically redirects to the new location. <!-- macro Moved webroot-relative-newName --> <!-- macro Moved applet/applets.html -->
NeedsJava Spells out in great detail just why and how Java is needed for a given task and what do it if it is not working. <!-- macro NeedsJava javaVersion(e.g. 1.1) (signed/unsigned) (jni/nojni) Applet className projectDesc [why signed] --> <!-- macro NeedsJava 1.1 unsigned nojni hybrid Bio Biorhythms Calculator -->
NeedsJWS Spells out in great detail just why and how Java Web Start is needed for a given task and what do it if it is not working. <!-- macro NeedsJWS takes no parameters --> <!-- macro NeedsJWS -->
Newsgroup Generates a reference to a newsgroup. <!-- macro Newsgroup newsgroupName --> <!-- macro Newsgroup -->
NoJava Generates text that appears when Java is not available. <!-- macro NoJava (Applet/JWS) --> <!-- macro NoJava Applet -->
OnOracle Link to Oracle’s documentation both locally and on their website. Use JavaAPI or JavaFXAPI for class Javadoc. <!-- macro OnOracle reference description --> <!-- macro OnOracle {} {online specification} -->
OS (Operating System)es Generates a list of operating systems that have some property in common. <!-- macro OS es list or ranges with colon e.g. W95:XP, or W2K: or XP- etc. --> <!-- macro OS es W2K:VISTA -->
Photo Displays a camera icon. When the user clicks it, he sees a photo, not necessarily of a person. The image is in the image directory tree. <!-- macro Photo imageFile(without lead mindprod/image/) --> <!-- macro Photo environment/electricbikebig.jpg -->
Qualified Displays a fully qualified method name with package, class and method with different styles for each piece. <!-- macro Qualified [package].[Class].[var].[method] {class/interface} --> <!-- macro Qualified com.mindprod.common18.ST.beep class -->
Quotation Generates a random quotation. Changes randomly every half hour, if the expansion is rerun using the Windows Task Scheduler. The quotations themselves live in the quote directory animalrights, Christian, environment, evolution, livinglove, misc, patriotism, politics, religion. These collections are combined in various ways to form the categories used on the Quotation macro. <!--macro Quotation takes a category parameter, e.g. animalrights. environment, general, livinglove, misc, politics, religion --> <!--macro Quotation religion -->
Reunion Generated a record about one person coming to a reunion. <!-- macro Reunion oldFirst oldLast newFirst newLast significantOther birthdate photo coming excuse homePhone workPhone emailHint emailMungImage website address city prov postal country bringing --> <!-- macro Reunion Munroe Green Roedy Green Geneva 1948-02-04 people/roedy200805.jpg + excuse (250) 361-9093 (250) 361-9093 roedy gee mindprod com roedy #101 — xxx YYYYk Street Victoria BC V8T 4G8 Canada pomegranate cider -->
Revised When something was last revised and when that fact was last verified. c.f. Updated <!-- macro Revised asofDate [revisedDate] [why] --> <!-- macro Revised 2008-07-25 2005-10-20 -->
RFC (Request For Comment) link to the text of a RFC document. <!-- macro RFC RFC number --> <!-- macro RFC 2781 -->
RSS generate an RSS feed item and display the item as HTML as well. <!-- macro RSS feedName YYYY-MM-DD webroot-relative-link/url title description --> <!-- macro RSS ethics 2008-08--03 new version of HTML Macros Realeasd {The new version makes it much easier to configure the icons…} -->
RSSBegin Marks the beginning of a group of RSS macros you want collected, grouped by feed and sorted in descending order by date. If you don’t use RSSBegin, the items will appear in the same order on each page that they appear embedded in your files. <!-- macro RSSBegin (no parms) --> <!-- macro RSSBegin -->
RSSEnd Marks the end of a group of RSS macros you want collected, grouped by feed and sorted in descending order by date. <!-- macro RSSEnd (no parms) --> <!-- macro RSSENd -->
Signed Generates instructions to deal with code signed with a phony certificate. Obsolete. <!-- macro Signed mainClass (Applet/weblet) --> <!-- macro Signed Wassup Applet/weblet -->
Bug Link to a bug in the Sun bug parade. <!-- macro Bug bugNumber description --> <!-- macro Bug 4809366 {The Bea JVM (Java Virtual Machine) fails to give permission for <span class=jmethod>getClassLoader</span> even when you ask for <span class=ini>AllPermissions</span>.} -->
RFE (Request For Enhancement) Link to a RFE in the Sun requests for enhancement. <!-- macro RFE rfeNumber description --> <!-- macro RFE 4449383 JSR (Java Specification Request) to add Design By Contract to Java -->
Updated displays the date some file was last substantially modified. c.f. Revised <!-- macro Updated webRoot-relative-file-name [plain/decorated] --> <!-- macro Updated jgloss/bali.html -->
Video Displays an iconic link to video file. <!-- macro Video mediaURL format(e.g.bittorrent divx dvd flash google mp3 mp4 ms pp qt real shockwave unknown vhs transcript youtube --> <!-- macro Video {} youtube {Albert Stubblebine} -->
WebRing Displays a WebRing nav bar. <!-- macro WebRing just a numeric u, the WebRing id --> <!-- macro WebRing 10002305 -->
Various Page Header Macros
Macro Purpose
AmanuensisHead header for Applet
AnimalRightsHead header for Animal rights essay
ApplicationHead header for Application docs
BglossHead header for the buyer glossary
BibleHead header for chapter of the bible
Bush911Head header for Bush essay
BushBooksHead header for Bush books
BushismsHead header for Bushisms essay
ContactHead header for Contact essay
DeepThoughtsHead header for Deep thoughts
EnvirHead header for environment essay
EthicsHead header for Ethics essay
FeedbackAnimalsHead header for feedback on animals
FeedbackGodHead header for feedback on religion
FeedbackPeaceHead header for feedback essay
FeedbackPornHead header for porn essay feedback
FeedbackSectionHead header for feedback section
Head generic header
HomeHead header for home page
HumanRightsHead header for human rights essay
IraqHead header for Iraq essay
JglossHead header for the Java glossary
JglossLetterHead header for the Java glossary index
LaserHead header for laser talks
LivingLoveHead header for living love essay
MenuFrameHead header for page that uses frames
MethodsHead header for Living Love methods essay
MoneyHead header for money essay
PhoneHead header for the phone list
PoliticsHead header for politics essay
ReligionHead header for religion essay
ReunionHead header for Reunion essay
SectionHead header for section
WebStartHead header for Java Web Start
Various Menu-generating Macros
Macro Purpose
AmanuensisMenuItem menu item for an Applet
ApplicationMenuItem menu item for an application
ColourMenu a menu of colour charts
MenuItem menu item
Quilt generate an n x m list of links
QuiltPair generate an n x m list of cell pairs
WebStartMenuItem generate a description for a JWS (Java Web Start) app
Utility classes, not macros
Class Purpose
AudioFormat enum of the various type of Audio format.
BibleBook enum of all the books of the King James bible
BuildImage Building <image links. Examines image files to find out the dimensions.
Configure Customising constants, e.g. affiliate ids, where you put various files, the name of your website, how often to rotate the ads, how long to hold onto RSS feed items…
CountryFlag generates flags of different countries. Used by Amazon macro.
GoogleAdSense enum for various sizes of ad chosen by Google to suit the page.
HTMLMacros Main routine. Will expand an arbitrary set of HTML files.
Indexing Used to generate glossary indexes.
ImageAlignment enum for all the ways to align an Image.
LoadCodeToProcessMacro dynamically load and cache class to process a macro
Macro The interface that all macro classes must implement. The Macro. expandMacro method is the key.
OS enum for the various possible operating systems.
ParmParser parses the parameters and cleans them up to present to the macro for expansion.
PayPalProduct Kludgy enum of PayPal encryptions.
QuotationCategory enum of various categories of quote of the day.
Randomiser Used by the random quotation generator and the public service ads to rotate the quotations on a predictable but seemingly random basis. Does the math to compute the digests.
ReplaceMindprod Main routine. Custom list of files to expand for the mindprod website.
Replacer The core macro engine that parser looking for macro commands and invoking the macros.
StripGenerated Removes previous expansions before expanding macros afresh.
SunJDKandJREVersions Constants to describe Oracle’s various JDKs (Java Development Kits) and JREs (Java Runtime Environments).
Tools General purpose tools useful to macros.
UnitsOfMeasure Enumeration of various metric and imperial units of measure.
VersionFlavour enum of the various type of JDK-JRE version number.
VideoFormat enum of the various type of Video format.


Embedded in the pages and at the foot of each page are pseudo-randomly selected quotations that automatically change frequently. How this works is probably the most complicated thing in the system. The quotations are where I deliver my messages to try to change the world. I consider them the purpose of the website.

The quotations themselves live in the quote directory separated by topics I call flocks. There are defined aggregates such as general that have a defined weighting percentage of the various flocks. For example, the remembrance aggregate I use on Remembrance Day contains contributions from the flocks: war (weight 200), patriotism (10), warbyroedy (1000) and patriotismbyroedy (1). specifies which aggregate to use for each page. It also specifies how often to rotate the quotation/PSA. SET resetfooterpercentage=10 further limits just how many quotations/PSAs will be allowed to change in any given run. (This can be useful if you disturb the quotation collections which would otherwise trigger a mass immediate changeover.)

The quotation chosen depends on the current time and the file name, but not the file contents.

The same slot at the foot of a page can be shared by a quotation, a PSA (Public Service Advertisement) or a non-military use only notice. The logic to select the current ad is hairy. See, and

The Quotation macro com.mindprod.macro.Quotation can embed a random quotation in the middle of a page.

The quotation flock files are kept sorted by author, with quotes without headings at the top to be corrected.

Quotations can contain embeded macros, most commonly Acronym, Age, Cite and Include.

In addition there are fixed quotation that HTMLMacros leaves undisturbed as ordinary text.


HTMLMacros tracks when various files containing HTML macros were last successfully processed. It can then speed things up by avoiding reprocessing them again until the contents changes. There are various exceptions:


The HTML static macros package itself is free. I am willing to answer questions, but if you need extensive consultation, or custom code written, you would have to arrange that for a fee.

Acquiring HTMLMacros

HTML Static Macros
2.6 2014-07-13 free Java
more infoprecismanualscreenshotbrowse source repository
for the current version of HTML Static Macros.
Static macros for HTML to generate complex boilerplate.
download 17.7MB zip for HTML Static Macros Java source, compiled class files, jar and documentation to run on your own machine as an application.

Runs on any OS that supports Java e.g. W2K, XP, W2003, Vista, W2008, W7-32, W7-64, W8-32, W8-64, W2012, W10-32, W10-64, Linux, LinuxARM, LinuxX86, LinuxX64, Ubuntu, Solaris, SolarisSPARC, SolarisSPARC64, SolarisX86, SolarisX64 and OSX.

First install the most recent Java.

To install, extract the zip download with WinZip, (or similar unzip utility) into any directory you please, often J:\ — ticking off the use folder names option.

To check out the corresponding source from the Subversion repository, use the TortoiseSVN repo-browser to
access htmlmacros source in repository with [Tortoise] Subversion client on

After you have installed the jar, you can run it as an application. Type:

java -jar J:\com\mindprod\htmlmacros\htmlmacros.jar parms

adjusting as necessary to account for where the jar file is.

download ASP PAD XML program description for the current version of HTML Static Macros.

$1989.00 US donated so far. If the CMP utilities solved your problem, please donate a buck or two, or donate to one of the charities featured in the footer public service ads throughout the website and get a tax receipt.

HTML Static Macros is free. Full source included. You may even include the source code, modified or unmodified in free/commercial open source/proprietary programs that you write and distribute. Non-military use only.

Set Variables

You can control HTMLMacros by setting up set Variables before you run. Most of them trigger probing online stores to refresh our inventory of what products they have in stock.

Set VariablePurpose
removedeadwood=no=no means leave deadwood,
=yes means Clear inventories of products we no longer recommend. It should not be used unless have done a resetcache.btm and are processing the entire website. Also clears lookup cache of ISBN to ASIN of any ISBNs (International Standard Book Numbers) without a corresponding ASIN, but which are mentioned in Book macros.
=find means find deadwood, but don’t remove it yet.
checkstores=yescheck all book, dvd and electronics stores
checkbookstores=yescheck all bookstores
checkamazonbookstores=yescheck all Amazon bookstores including Junglee
checkabebookstores=yescheck all Abe bookstores
checkotherbookstores=yescheck all no-Amazon non-Abe bookstores
checkdvdstores=yescheck all DVD stores
checkamazondvdstores=yescheck all Amazon DVD stores
checkelectronicsstores=yescheck all electronics stores
checkamazonelectronicsstores=yescheck alls Amazon electronic stores.
Individual Bookstores
checkabeca=yescheck bookstore
checkabecom=yescheck bookstore
checkabede=yescheck bookstore
checkabees=yescheck bookstore
checkabefr=yescheck bookstore
checkabeit=yescheck bookstore
checkabenz=yescheck bookstore
checkabeuk=yescheck bookstore
checkamazonca=yescheck bookstore
checkamazoncn=yescheck bookstore
checkamazoncom=yescheck bookstore
checkamazonde=yescheck bookstore
checkamazones=yescheck bookstore
checkamazonfr=yescheck bookstore
checkamazonit=yescheck bookstore
checkamazonuk=yescheck bookstore
checkbn=yescheck bookstore
checkchapters=yescheck bookstore
checkgoogle=yescheck bookstore
checkjunglee=yescheck bookstore
checkkobo=yescheck bookstore
checkpowells=yescheck bookstore
checksafari=yescheck bookstore
Individual DVD Stores
checkamazoncadvds=yescheck dvd store
checkamazoncndvds=yescheck dvd store
checkamazoncomdvds=yescheck dvd store
checkamazondedvds=yescheck dvd store
checkamazonesdvds=yescheck dvd store
checkamazonfrdvds=yescheck dvd store
checkamazonitdvds=yescheck dvd store
checkamazonukdvds=yescheck dvd store
checkbndvds=yescheck barensandnoble.cem dvd store
checkjungleedvds=yescheck dvd store
checkpowellsdvds=yescheck powells.cem dvd store
Individual Electronics Stores
checkamazoncaelectronics=yescheck electronics store
checkamazoncnelectronics=yescheck electronics store
checkamazoncomelectronics=yescheck electronics store
checkamazondeelectronics=yescheck electronics store
checkamazoneselectronics=yescheck electronics store
checkamazonfrelectronics=yescheck electronics store
checkamazonitelectronics=yescheck electronics store
checkamazonukelectronics=yescheck electronics store
checkbestbuycaelectronics=yescheck electronics store
checkbestbuyelectronics=yescheck electronics store
checkcanadacomputerselectronics=yescheck electronics store
checkjungleeelectronics=yescheck electronics store
checkncixcaelectronics=yescheck electronics store
checkneweggcaelectronics=yescheck electronics store
checkneweggelectronics=yescheck electronics store
checktigercaelectronics=yescheck electronics store
checktigerelectronics=yescheck electronics store
checknewproducts=yesUsually new products are probed to find out their status the first time they are encountered. If you set this to no, this is suppressed and new products are treated as not-carried. The next time you do a manual probe of its stores, the status will be updated. The main reason to use this is to turn off probing if it is temporarily not-working, giving you time to fix the problem and do a manual probe to catch up. Default yes.
-qquiet mode. supresses macro letters
-vverbose mode
debug=yesextra debug output
download HTMLMacros
JPrep manual

This page is posted
on the web at:

Optional Replicator mirror
on local hard disk J:

Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

Your face IP:[]
You are visitor number
The information on this page is for non-military use only.
Military use includes use by defence contractors.