image provider

JPrep


View the latest version of this manual online at http://mindprod.com/application/jprep.manual.html.
Introduction Colour Scheme
Directory Structure Parsers
Invoking JPrep Futures
Manual Embedding Acquiring JPrep
Automatic Embedding Links

Introduction

JPrep lets you display code snippets on your website in a variety of colours, fonts and sizes in a way that highlights the structure of the program, like this:

JPrep handles the following types of file:

Type Parser Also handles
batch files bat batfrag, btm, btmfrag
comma separated values csv
web pages html htmlfrag, dtd, dtdfrag, jnlp, jnlpfrag, js, jsfrag, jsp, jspfrag, xhtml, xhtmlfrag, xml, xmlfrag, xsd, xsdfrag
[section] configuration files ini inifrag, reg, regfrag, srs, srsfrag, sh, shfrag
Java source java javafrag, c, cfrag, cpp, cppfrag, css, cssfrag, h, hfrag, hpp, hppfrag, policy, policyfrag, properties
SQL (Standard Query Language) database sql sqlfrag
plain text files text txt list
jar manifest mft

Directory Structure

You compose some html documents that will eventually appear on your website, containing embedded snippets, in directories named for example x, y and z. Under these in a directory called snippet, e.g. x/snippet and y/snippet where you put your code snippets.

JPrep will put its results in x/snippet/iframe/xxx.htm, the snippet rendered as colourised HTML (Hypertext Markup Language) as an iframe, ready to include in your webpage.

JPrep also produces a file called x/snippet/ser/xxx.ser. This a compact binary, tokenised version of the snippet. The HTMLMacros JDisplay macro and JDisplay Applet can render it. It is used for large snippets. JDisplay also uses it to insert small inline snippets. x/snippet/ser/xxx.checksum is a FNV1a64 checksum of the iframe file. It is used to detect damage to it. JPrep automatically regenerates it is if it damaged.

Invoking JPrep

You invoke JPrep in an odd way. You must compose a Java class that implements either com.mindprod.support.JPrepConfiguration or the much larger com.mindprod.support.Configuration.

com.mindprod.support.JPrepConfiguration has two methods in it. com.mindprod.support.Configuration has mostly methods relevant to HTMLMacros:

Then you place the name of this configuration on the command line like this:

rem invoking JPrep to reparse any snippets
rem that have changed recently or that have become corrupt.
java.exe -jar jprep.jar ConfigurationForMindprod

Manual Embedding

After you have run JPrep, you could:

These are hard to maintain. You must redo them if the snippet contents ever changes.

Automatic Embedding

I handle this automatically by embedding a HTMLMacros JDisplay macro in my web page like this:

<-- macro JDisplay name-of-snippet -->

The JDisplay macro decides:

Then it generates the necessary HTML to render the snippet.

Colour Scheme

There are two mechanisms that control the colour scheme:

  1. For inline and iframe renderings, CSS (Cascading Style Sheets) controls the colours with jdisplay.css.
  2. For JDisplay Java Applet renderings, com.mindprod.jtokens.TokenPalette, com.mindprod.jtokens.TokenColourScheme and the individual Token classes control the colours.

I have tried to keep the two schemes in sync, but there is no great harm if they are not exactly the same.

You have to modify the source code to modify the Applet colour scheme. It is designed with logical colours to make sweeping changes easy.

Every snippet language can have its own colour scheme.

Parsers

This section would mainly be of interest to someone wanting to extend JPrep to handle other languages, e.g. JSP (Java Server Pages) which has a mixture of Java and XML (extensible Markup Language) in it, or Eiffel. Unlike a parser in a compiler, JPrep’s parsers are constructed by hand, not with a parser-generator like ANTLR (Another Tool for Language Recognition). They are finite state machines. This has its advantages:

This also has its disadvantages:

Futures

Here are various ways I hope to improve JPrep:

  1. Bypass the need for a Configuration on the command line and let you specify a list of directories to process.

Acquiring JPrep

JPrep is currently bundled as part of HTMLMacros.

PackageVersionReleasedLicenceLanguageNotes 
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 wush.net/svn/mindprod/com/mindprod/htmlmacros/.

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.
 
 
Download HTML Static Macros

This page is posted
on the web at:

http://mindprod.com/application/jprep.manual.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\application\jprep.manual.html
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.

IP:[65.110.21.43]
Your face IP:[3.219.167.163]
You are visitor number