2151fbcd53 | ||
---|---|---|
src/main | ||
.gitignore | ||
.project | ||
README.md | ||
pom.xml |
README.md
Scribbly format
The Scribbly text format is a document format whose syntax is inspired by the Scribble documentation format of Racket.
The format is basically plain text enhanced with commands indicating the context.
In the Scribbly format, the commands are introduced by a @
, can take named parameters introduced between [
and ]
and be applied to a section of Scribbly text delimited by {
and }
.
An example of a Scribbly document:
@document
[title:Scribbly example]
{
An example of a Scribbly document. @newline
The character @unicode[point:26C4] represents a snowman.
@style[color:red][bold:true]{An important message}: @large{snowmen melt in the sun}.
}
The Scribbly format does not interpret the commands. It's up to the application using the format to define them, their meaning and their parameters.
The commands and parameter names are limited to the latin lowercase alphabetic characters.
The characters @
, [
, ]
, {
and }
must be escaped with a prefixing @
if they are not part of a command.
Compiling the Java library
The Java library for manipulating Scribbly text can be compiled using maven. It uses the standard commands (clean, package, install).
mvn clean package
mvn install
The Java API
The classes are in the fr.feufochmar.scribbly
namespace.
A Scribbly document is represented by the ScribblyDocument
class, which contain a list of ScribblyElement
.
A Scribbly
element is either a ScribblyCommand
(representing a command, its parameters, and the list of ScribblyElements on which it apply) or a ScribblyText
(representing text outside commands).
A Scribbly document is processed using the visitor patter, using an instance of the ScribblyVisitor
interface.
The ScribblyDocumentParser
class can be used to build a ScribblyDocument
from a file, input stream or reader.
The ScribblyDocumentWriter
is an example of ScribblyVisitor
implementation allowing to write a ScribblyDocument
into an output stream or writer.