Adj. Written by those who can see the future.
Sibylline is a language-agnostic time-dependent content markup notation. It enables the advance declarative authoring of text that will render differently depending on the time of rendering. It can be used with HTML, Markdown, plaintext, etc., and it can be interpreted at built time, server render time, client render time, etc. The interpreter reference implementation is written in JavaScript.
It |||(2018)is|isn’t||| the year Twenty Eighteen.
\\During 2018 --> It is the year Twenty Eighteen.
\\Not during 2018 --> It isn't year Twenty Eighteen.
Conditional content to be processed by the Sibylline interpreter is wrapped in triple pipes (|||
).
|||This content will be processed. |||This content won't be processed.
\\Always --> This content will be processed. This content won't be processed.
Conditions for rendering are indicated in parentheses following the opening triple pipe:
a|||(2018)b|||c
\\During 2018 --> abc
\\Not during 2018 --> ac
Content options are separated by single pipes:
a|||(2018)b|(2019)c|||d
\\During 2018 --> abd
\\During 2019 --> acd
\\Not during 2018 or 2019 --> ad
If none of the options with conditions match, the first option without a condition is used:
a|||(2018)b|c|d|||e
\\During 2018 --> abe
\\Not during 2018 --> ace
The main function in the Sibylline interpreter is render
, which requires the raw content for processing as input:
sibylline.render("a|||(2018)b|||c")
It also accepts an optional explicit timestamp:
sibylline.render("a|||(2018)b|||c", "2019")
Sibylline supports six operators:
During is indicated by a lack of explicit operator character:
|||(2018)abc|||
Not during is indicated by !
:
|||(!2018)abc|||
After than is indicated by >
:
|||(>2018)abc|||
During or after is indicated by +
:
|||(+2018)abc|||
Before is indicated by <
:
|||(<2018)abc|||
During or before is indicated by -
:
|||(-2018)abc|||
Sibylline provides five custom time shorthand patterns, which are disambiguated based on their structure. All other patterns are parsed by the underlying date engine.
Follows YYYY
format:
|||(2018)abc|||
Follows YYYY-MM
format:
|||(2018-12)abc|||
Follows YYYY-MM-DD
format:
|||(2018-12-31)abc|||
Follows MM
format:
|||(12)abc|||
At evaluation time, will be qualified with the current year.
Follows MM-DD
format:
|||(12-31)abc|||
At evaluation time, will be qualified with the current year.