The extract-code tool
View this
page in Romanian courtesy of azoft
Description
The extract-code tool takes an source file annotated with special
comment forms and extracts LaTeX files that can be used in a document.
The generated LaTeX uses the
code.sty package.
Currently, it supports both SML and Moby source files, but it
is easy to extend to other languages.
The tool can also produce HTML files in a form suitable for inclusion
in a LaTeX document being processed by
HeVeA.
Download
The extract-code tool is distributed in source form
as a gzipped tar file
(extract-code.tgz).
It was last modified on May 17, 2014; see the CHANGES
file in the distribution for more information.
You can also get the source via anonymous svn using the command
% svn co --username anonsvn \
https://svn.smlnj-gforge.cs.uchicago.edu/svn/extract-code extract-code
The password is anonsvn.
Installation
To install extract-code, you must have
SML/NJ installed on your machine and in your PATH.
Assuming that this is the case, then installation
is simple:
- Configure the installation by running the
configure script.
You can set the installation directory by using the
--prefix option (the default is
/usr/local).
- Build the system using the build make target.
- Install the system using the install make target.
For example, to build and install the system /usr, one
would use the following commands:
% ./configure --prefix=/usr
% make build
% make install
After running these commands, /usr/bin would hold the
extract-code command.
Usage
extract-code options files
where options are taken from the following:
- -lang language
Use language as the input language.
Currently, the following languages are supported:
Language |
File suffix |
cml |
.cml |
manticore |
.pml |
moby |
.mby |
sml |
.sml and .sig |
- -hevea
Generate HeVeA as the output format (this is the default).
Output files will have a .hva suffix.
- -tex
Generate LaTeX as the output format (this is the default).
Output files will have a .tex suffix.
- -txt
Generate text files with formatting comments stripped.
- -strip
Strip the formatting comments from the source files; for
an input file foo, the stripped output will be in
foo.strip.
Formatting commands
Formattting commands are written as comments in the source
language.
These comments must start in the first column of their line.
Here are the commands and their descriptions:
- (*@FILE attributes files *)
-
open the list of files for extracted output with the
specified attibutes (attributes are
either @LEFT, @CENTER)
- (*@BEGIN files *)
-
start directing output to the list of files
(these files are called active).
- (*@END files *)
-
stop directing output to the list of files;
if files is empty, then all active files are stoped.
- (*@BEGIN-ELLIPSE *)
- (*@END-ELLIPSE *)
- suspend/resume output to the currently active files.
- (*@BEGIN-HIGHLIGHT*)
- (*@END-HIGHLIGHT*)
- suspend/resume highlighting the output to the current files. Currently,
highlighting is represented by underlining.
- (*@IF-FILE files *)
- (*@ELIF-FILE files *)
- (*@ELSE *)
- (*@END-IF *)
-
conditional extraction.
- (*@INSERT
- ... stuff ...
- *)
-
insert the stuff into the currently active files.
- (*@KW*)token(*@WK*)
-
treat the token as a keyword. This markup is not supported for all
source languages.
Last modified: May 28, 2014.
Comments to: John Reppy