-
Notifications
You must be signed in to change notification settings - Fork 77
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
Expose FluentSerializer.serializeExpression #134
Conversation
be7ff8f
to
0dbdc3a
Compare
@mathjazz This exposes the |
// A select expression with a selector. | ||
? `{ ${serializeSelectExpression(expr)}}` | ||
// A variant list without a selector. | ||
: `{${serializeSelectExpression(expr)}}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we use a single space before and after the expression?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is special-cased so that there aren't any spaces around it. Consider:
-brand-name =
{ ← no space after the opening {
*[nominative] Firefox
} ← no extra space before the closing {, just the 4-space indent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fan @stas tic!
I hacked this into the currently used fluent-syntax.js
in Pontoon and it does the job.
- Implement Fluent Syntax 0.5. - Add support for terms. - Add support for `#`, `##` and `###` comments. - Remove support for tags. - Add support for `=` after the identifier in message and term defintions. - Forbid newlines in string expressions. - Allow trailing comma in call expression argument lists. In fluent-syntax 0.6.x the new Syntax 0.5 is supported alongside the old Syntax 0.4. This should make migrations easier. `FluentParser` will correctly parse Syntax 0.4 comments (prefixed with `//`), sections and message definitions without the `=` after the identifier. The one exception are tags which are no longer supported. Please use attributed defined on terms instead. `FluentSerializer` always serializes using the new Syntax 0.5. - Add `AST.Placeable` (#64) Added in Syntax Spec 0.4, `AST.Placeable` provides exact span data about the opening and closing brace of placeables. - Expose `FluentSerializer.serializeExpression`. (#134) - Serialize standalone comments with surrounding white-space. - Allow blank lines inside of messages. (#76) - Trim trailing newline from Comments. (#77)
@mathjazz wrote the following snippet for Pontoon and asked if we could expose it from
fluent-syntax
.https://gist.github.com/mathjazz/4be883ea2562e2cbb59ca26beecf1e93
Yes, yes we could.