Version 9, last updated by niels.brouwers at May 28, 2009 08:33 UTC
Welcome to FopSnor.
FopSnor is a parser for structured text meant to be a less-verbose alternative to XHTML. FopSnor can convert text written in FopSnor syntax to XML for direct publication on the web or further processing with tools like Prince.
Getting it
You can check out the source from SVN. There's a very old version under files, but I wouldn't recommend it.
Running it
Fopsnor is written in Java and distributed as a Jar file. Check out the source from svn and type
sudo ant install
This will compile the code and copy the generator fopsnor.jar into /usr/share/java. If you just want to get a jar file because you're not on linux or because your distro places jar files in a different location, you can go with just compiling the thing:
ant compile
Running it
Once fopsnor is installed, run it by typing
java -jar /usr/share/java/fopsnor.jar input.fs -o output.xml
The options are
- -o [file] or --output [file]: write output to [file]
- -r [string] or --root [string]: if there is no root node in the document, create a node of type [string] as a root node (defaults to 'html')
- -t or --toc: create a table of contents from section, subsection, subsubsection and subsubsubsection nodes found in the document
Syntax
@html{
@body{
@i{Hello} @b{World!}
}
}
When processed with FopSnor, the output will be
<html>
<body>
<i>Hello</i> <b>World!</b>!
</body>
</html>
FopSnor tags can also carry attributes:
@font(size="3" color="red"){This is some text!}Will produce
<font size="3" color="red">This is some text!</font>
FopSnor will automatically create <P> tags around blocks of text that are separated by one or more empty lines
@html{
@body{
This is paragraph number one.
This is paragraph number two.
}
}Results in
<html>
<body>
<p>This is paragraph number one.</p>
<p>This is paragraph number two.</p>
</body>
</html>
FopSnor code can be commented using the '#' symbol
@html{
@body{
# this is a line comment
This is paragraph number one.
This is paragraph number two.
}
}You can escape the '@', '%', '#', and '\' symbols with a backslash
billg\@microsoft.co
You can include fopsnor files in other files using
%include{introduction.fs}Open issues
I've been using FopSnor to write my thesis and it seems to be in a good enough state for someone with in-depth knowledge of Java, CSS, and XML to produce good looking documents. The code is far from finished however.
The tokeniser and parser are hand-rolled and need lots of tlc. Especially the way white space is handled can be a bit weird. There's a bug that causes the tokeniser to bork on commented out lines with commands in them.
It also needs a better plug-in system, so that users may write their own document transformation visitors, and so that some of the hacks for my thesis can be moved out of the main repos.
But heym it works for me :)