Files
contra/documentation/contra.5
2023-11-15 18:26:50 +01:00

58 lines
2.1 KiB
Groff

.TH CSML 5 "November 2023" "Version 1.0" "CSML Manual"
.SH NAME
CSML \- C Style Markup Language Documentation
.SH DESCRIPTION
The C Style Markup Language (CSML) is a markup language designed for 1 to 1 translation into traditional markup languages such as XML or HTML. Its syntax is engineered to be similar to the C programming language and resembles Groovy's advanced templating language.
CSML is intended to be a temporary representation of other markup languages during their editing. Developers can open a file in another markup language, convert it to CSML, make updates, and then convert it back without losing any data.
.SH SYNTAX
.SS Tags
.br
.B <tag> [(<head>)] {<body>}
.br
.B <tag>;
Example:
.br
.B textarea (readonly) { lorem ipsum }
.br
.B br;
The last identifier, defined by the regular expression: [A-z][A-z0-9]*, before an (optional) head, body, or semicolon is considered to be a tag. CSML does not enforce any (sub)set of words to be "valid". Each tag is pushed into a stack and later popped by the end of a body being found.
If the tag is followed by a semicolon (';'), it's a self-closing tag.
The head holds attributes. A missing head signals that there are no attributes to be translated. Any text may be a valid attribute. Attributes can be given values by placing a colon (':') after them.
The value is parsed until the first non-escaped comma (',') or until the end of the head (closing ')').
The body is everything enclosed by curly braces ("{}"). It may contain more tags or comments.
.SS Escaping
Any special character may be escaped by prepending it with a backslash ('\\'). This will prevent it from being parsed as a significant token to the syntax.
List of escaped special characters:
+ \\(
+ \\)
+ \\{
+ \\}
+ \\,
+ \\:
+ \\;
Note, that they are not required to be always escaped, but are highly advised.
.SS Comments
CSML supports C99 comments, both single and multi-line.
Example:
.br
.B //single line
.br
.B /*multi-line*/
.SS Echoing
Anything not holding special meaning (tags, heads, comments) is considered regular text, which is significant. This includes whitespace too.