|Manual Embedding||Acquiring JPrep|
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:
|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|
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.
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
After you have run JPrep, you could:
These are hard to maintain. You must redo them if the snippet contents ever changes.
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.
There are two mechanisms that control the colour scheme:
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.
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:
Here are various ways I hope to improve JPrep:
JPrep is currently bundled as part of HTMLMacros.
HTML Static Macros
❘ precis ❘ manual ❘ screenshot ❘ browse source repository
for the current version of HTML Static Macros.
Static macros for HTML to generate complex boilerplate.
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
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.
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.
This page is posted
Optional Replicator mirror
Your face IP:[22.214.171.124]
You are visitor number|