Skip to content

Commit 00f1499

Browse files
RumovZMichael Bryan
andauthored
Create generic ftl serializer (#241)
* Start writing up the serializer * Made sure indentation is handled properly * Started handling select expressions * Switched " " to "\t" to make recognising indents easier * Everything from TypeScript's "Serialize resource" test suite passes * Added the rest of the tests * Added a test to make sure subsequent entries with a comment aren't separated by newlines * Fix serializer for fluent-syntax 0.11.0 Botch with only `&str` supported. * Fix empty lines in messages being swallowed * Fix indentation of default asterisk It seems like `*` is supposed to go _inside_ the indent now. * Fix lints * Make `serialize()` generic over `Slice` * Handle rare edge case of line terminating `\r` * Fix redundant line break after after junk * Align parsing of CRLF-terminated patterns `\r\n` was parsed as a separate TextElement of `\n`, whereas `\n` is parsed as part of the antecedent TextElement. * Don't break line before leading dot pattern * Don't implicitly trim when writing literals * Replace roundtrip tests with manipulation tests * Reintroduce roundtrip tests * Move old fixtures into resource files. * Test on unnormalized fixtures as well. * Fix clippy lints * Document serializer mod and pub functions Also make Serializer private. * Replace unwrap with expect * Remove redundant error propogation * BLACKLIST -> IGNORE_LIST * Fix typo * Mention serializer on changelog * Revert c009674 and add crlf.ftl to ignore list Co-authored-by: Michael Bryan <[email protected]>
1 parent d53526f commit 00f1499

File tree

11 files changed

+832
-1
lines changed

11 files changed

+832
-1
lines changed

fluent-syntax/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Changelog
22

33
## Unreleased
4-
4+
- Add module `serializer`.
55
-
66

77
## fluent-syntax 0.11.0 (February 9, 2021)

fluent-syntax/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,5 @@
4848
//! ```
4949
pub mod ast;
5050
pub mod parser;
51+
pub mod serializer;
5152
pub mod unicode;

0 commit comments

Comments
 (0)