| Introduction | How It Works |
| Advantages | Existing Macros |
| Disadvantages | Costs |
| How to Proceed |
<!-- 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 --> <!-- generated --> <span class="metric">20 cm</span> <span class="imperial">(7.87 in)</span> <!-- /generated by Measure -->
and renders for your viewers like this:
This also means you can’t, in a perfectly straightforward way, slip new versions of HTML static macros into yours the way you could with JSP. To make that update/merging process easier, when you modify code, create new replacement classes with new names and discard the old, rather than simply modifying code. Over the coming months I will work to split the code more cleanly in two, the stuff peculiar to my website and the code of general interest. That will make it easier for you to ignore my specific code and to incorporate revisions in the general purpose code into your own application.
| 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.amazon | 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 com.mindprod.htmlmacros. Book.java and com.mindprod.htmlmacros. Amazon.java and the com.mindprod.amazon packages. |
| com.mindprod.common11 | 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 com.mindprod.htmlmacros. CurrCon.java and the com.mindprod.currcon and com.mindprod.currconaux packages. |
| 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 4NT/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, 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 numbers in your macros. If you don’ handle books on your website, you can delete this package, com.mindprod.htmlmacros. Book.java and com.mindprod.htmlmacros. Amazon.java and the com.mindprod.amazon packages. |
| com.mindprod.jdisplay com.mindprod.jdisplayaux com.mindprod.jtokens com.mindprod.jprep | 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. 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 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 in to 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. |
| Various Existing Macros | |||
|---|---|---|---|
| Class | Purpose | Syntax | Example |
| 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 [years/months/days] --> | <!-- macro Age 1948-02-04 years --> |
| AllPosters | Generates a thumbnail affiliate link to AllPosters.com. | <!-- macro AllPosters title productid thumbnailImageName width height --> | <!-- AllPosters "skateboarder" 2024845 SSPOD/SUPERSTOCK_1287-350_a 115 86 --> |
| Amazon | Generates referral link to a Amazon, usually electronic sales. | <!-- macro Amazon many keyword=value pairs --> | <!-- macro Amazon asin=B00006LIQL class="sellamazoncol" 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.} --> |
| Art | Generates a thumbnail affiliate link to Art.com. | <!-- macro Art title productid width height --> | <!-- macro Art "Victoria Falls, Zimbabwe" 12870686 115 86 --> |
| Audio | Generates a iconic link to an audio file. | <!-- macro Audio soundfile format --> | <!-- macro Audio {http://www.radio4all.net/index.php/program/6824} 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 a Amazon, Powell’s, Barnes & Noble, Chapters etc bookstores. | <!-- macro Book isbn, [paperback] [hardcover] [kindle] title, author, [notes], [publisher], [published], [class], [bookcoversdir] --> | <!-- macro Book isbn=0960068880 paperback=0960068880 hardcover=0960068899 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.} --> |
| 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
../animalrights/freerange.html ../animalrights/intel.html ../applet/canadiantax.html ../applet/converter.html ../applet/fileio.html unmain.html -->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 rectangular dimensions in both metric and imperial measure. | <!-- macro Dim width x height unitsOfMeasure e.g. Dim 40 x 20 cm --> | <!-- macro Dim 40 x 20 cm --> |
| DVD | Affiliate referral link to a DVD. | <!-- macro DVD amazonProductCode, [upc12], title, author, [type] [notes], [class] --> | <!-- macro DVD amazon=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 than can be handled by your player.} --> |
| FileSize | Expands to the current size of a given file. | <!-- macro FileSize webRoot-relative local file name --> | <!-- macro FileSize zips/amper15.zip --> |
| Foot | Standard footer. Quite elaborate with rotating ads, navigation and various icons. | <!-- macro Foot [ad] [noad] [nonmil] [nextpage] --> | <!-- macro Foot nonmil unmainmisc.html --> |
| 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 --> |
| Include | raw include text from a local file anywhere on disk. Use absolute filename. May be nested. i.e. the included text might possibly containing embedded macros that need to be expanded/refreshed, including Include macros. | <!-- macro Include absolutefilename to include. --> | <!-- macro Include E:\mindprod\include\primeminister.html --> |
| J2EE | Link to Sun’s J2EE documention. | <!-- macro J2EE description reference. --> | <!-- macro J2EE "Server HTTP response codes" javax/servlet/http/HttpServletResponse.html --> |
| 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 Get.java --> |
| JDK | Generate a reference the current or previous JDK or some part of it. | <!-- macro JDK a flavour, e.g. macro version fullversion micro dir path url --> | <!-- macro JDK fullversion --> |
| JDKFile | Generate a reference to the local copy of some file in the current JDK. | <!-- macro SunDJKFile description reference --> | <!-- macro JDKFile native2ascii.exe bin\native2ascii.exe --> |
| JRE | Generate a reference the current or previous JRE or some part of it. | <!-- macro JRE a flavour e.g macro version fullversion micro dir path url --> | <!-- macro JRE path --> |
| JREFile | Generate a reference to the local copy of some file in the current JRE. | <!-- macro JREFile description reference --> | <!-- macro JREFile "cacerts list of trusted certificate authorities" lib/security/cacerts --> |
| 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 for use in included text that is adjusted to account for which page the text is included. | <!-- 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 mindprod.com "#101 - 2536
Wark Street" Victoria BC "V8T 4G8" Canada {Single, gay, HIV+,
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, — 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 | Displays units in both metric and imperial, e.g. mass, distance, flow… | <!-- macro Measure value units --> | <!-- macro Measure 20 cm --> |
| 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 --> |
| NeedJava | 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 NeedJava javaVersion(e.g. 1.1) (signed/unsigned) (jni/nojni) Applet projectLower Project_Desc [why signed] --> | <!-- macro NeedJava 1.1 unsigned nojni hybrid bio "Biorhythms Calculator" -> |
| NeedJWS | 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 NeedJWS takes no parameters --> | <!-- macro NeedJWS --> |
| Newsgroup | Generates a reference to a newsgroup. | <!-- macro Newsgroup newsgroupName --> | <!-- macro Newsgroup comp.lang.java.programmer --> |
| NoJava | Generates text that appears when Java is not available. | <!-- macro NoJava (Applet/JWS) --> | <!-- macro NoJava Applet --> |
| OSes | Generates a list of operating systems that have some property in common. | <!-- macro OSes list or ranges with colon e.g. WIN95:WINXP, or WIN2K+ or XP- etc. --> | <!-- macro OSes WIN2K:VISTA --> |
| PayPal | Generates an encrypted link to PayPal to let visitors buy something. Must define enum in class PayPalProduct. The PayPal encrypted strings are long and cumbersome. This is a hideous kludge. | <!-- macro PayPal enumCode --> | <!-- macro PayPal DONATE_TO_BUYERS_GLOSSARY --> |
| 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 --> |
| 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, bush, christian, environment , evolution , livinglove , misc , 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 mindprod.com "#101 - 2536 Wark 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 | 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 --> |
| Sun | Link to Sun’s documenation both locally and on their website. | <!-- macro Sun description reference --> | <!-- macro Sun Adler32 api/java/util/zip/Adler32.html --> |
| SunBug | Link to a bug in the Sun bug parade. | <!-- macro SunBug bugNumber description --> | <!-- macro SunBug 4809366 {The Bea JVM fails to give permission for <span class="jmethod">getClassLoader</span> even when you ask for <span class="ini">AllPermissions</span>.} --> |
| SunRFE | Link to a RFE in the Sun requests for enhancement. | <!-- macro SunRFE rfeNumber description --> | <!-- macro SunRFE 4449383 "JSR 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 {http://www.undersiegemovie.com/media/laibow_fbi.wmv} ms --> |
| 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 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 |
| BuildImaghe | 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 ofter 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 an 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 seeminly random basis. Does the math to compute the digests. |
| ReplaceLisa | Main routine. Custom list of files to expand for the HANS website. |
| 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 Sun’s various JDKs and JREs. |
| 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. |
![]() |
and suggestions to improve this page to Roedy Green : | ||
| Canadian Mind Products | |||
| mindprod.com IP:[65.110.21.43] | |||
| Your face IP:[38.103.63.62] | ![]() | ||
| You are visitor number 11. | |||
| You can get a fresh copy of this page from: | or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror) | ||
| http://mindprod.com/application/htmlmacrosmanual.html | J:\mindprod\application\htmlmacrosmanual.html | ||