| inc | ||
| src | ||
| .gitattributes | ||
| .gitignore | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
sad
about
sad is a simple document format originally designed to be rendered in terminals using regular ansi control sequences. formatting is handled through "switches" in plain text.
repo structure
src/sad.pas— main sad parser unitsadv.pas— command line sad viewer/renderertest.pas— program for development testing
the rewrite
sad has been through a major rewrite and received major changes to the syntax and features.
{$begin-section} <name>->{$section} <name>(backwards compatible){$end-section}->{$end}(backwards compatible){$color <color>}removed{$reset}now resets the last applied style{$reset-all}resets all styles{$sub-head}- deprecated
- headers now derive their importance from the depth of the section which they are found in.
- only one per section, can not be in a section if a regular
{$head}switch was already encountered.
- deprecated
{$head}- headers now derive their importance from the depth of the section which they are found in.
- only one
{$head}or{$sub-head}switch may appear in a section.
{$title}switch can only be used in the document header
sadsuite
- sadv (included, broken) — CLI sad viwer
- fpc-sitgen — SAD based satic site generator
what the parsed data looks like
a parsed sa document is contained inside an instance of the TDocument record.
this record contains a map of the metadata, the title and a pointer to the root
section of the document.
switches recognized by the parser do not appear inside the parsed data,
non-recognized switches will still appear. if that behaviour is not wanted and
an error should be emitted if an unrecognized switch appears, define
OnlyStandardSwitches at compilation time.
sections
the root section is of the record type TSection like every other section and
contains is subsections in the field children. the text inside of a root
section is stored in blocks (array of TTextBlock). a new textblock is opened
everytime a style changes.
text blocks
a textblock (TTextBlock) represents a block of text associated with its active
set of styles (array of TStyle). The actual text is stored in an array of
strings which was initially split at every space and trimmed of whitespace,
except for linebreaks.
styles
active styles are represented using the TStyle record which stores the kind
of the style (TStyleKind) which may be either one of:
- Head
- SubHead
- Custom
and the arguments, if any, for that style in a string array.