-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syntax for Rich Text & Dynamic Templates #392
Comments
For 1. Handle rich-text annotations, based as much as possible on some existing spec The main candidate is markdown based on common mark. which is already used in the Markdown Editor used by Cicero UI. Some open questions:
|
For 2. Handle arbitrary switching between Ergo expressions and texts To use expressions inside text, quote the expressions using |
I'm intrigued by the ` notation, for completeness and consistency with the conceptual use in JS, here's a third option:
|
The correspondence with code blocks is intriguing... |
For 3. Handle variables, expressions, lists, tables, based as much as possible on some existing template mechanism The proposal bellow is inspired by handlebars.
Variables ✅Variables are quoted with
Ergo Expressions ✅Expressions are quoted with Many special purpose things in handlebars can be written as Ergo expressions:
Other things you can do with Ergo expressions:
Block ExpressionsBlock expressions of kind Conditionals Blocks ✅
Unordered Lists ✅
Those are rendered as markdown. From:
to
Ordered Lists ✅
Those are rendered as markdown. From:
to
Joined Lists ✅You create a list with a delimiter
To render from:
to render:
ClausesClauses can be inlined: ✅
Or can be imported: ❌
Tables ❌Note: This is a very tentative part of the proposal
Those are rendered as markdown. From:
to
Other things that could be includedIterators Blocks ❌Eventhough you could use an Ergo expression, you could also support:
With ✅With which can be used to set a context:
instead of
Comments ❌
Whitespace control ❌
|
For 4. Support both parse and generateText methods in Cicero The idea is to identify the source variables in the text, and generate a parser when possible. What is handled by the parser is:
And those can also occur inside the following blocks:
Note that those are important for two reasons: whether the template can be used on input sample text ( |
Breaking changes from our current syntax:
|
This proposal has been implemented as part of release |
This issue is related to #346 but with a specific focus on syntax for discussion. Previous related issue #171 is closed and somewhat outdated, so I think a new issue is useful.
Requirements and proposals
The requirements for rich text and dynamic templates syntax are:
Some eye can be kept on backward compatibility, although this is not a strong requirement and consistency of design may take precedence.
Due diligence
The text was updated successfully, but these errors were encountered: