Parse group from fluent file specified by macro attribute
Dependencies
- [2]
QSK7JRBAAdd simple `attribute_path` function - [3]
UOMQT7LTAdd support for cardinal CLDR plural selectors - [4]
5TEX4MNUSplit `fluent_embed` into `group` and `parse` modules - [5]
XGNME3WRMove `Group::derive_enum` to new `crate::parse_macro` module - [*]
O77KA6C4Create `fluent_embed` crate
Change contents
- replacement in fluent_embed/src/parse_macro.rs at line 53
pub fn attribute_path(attribute: syn::Attribute) -> PathBuf {pub fn attribute_groups(attribute: syn::Attribute) -> Group { - replacement in fluent_embed/src/parse_macro.rs at line 57
let supplied_path = PathBuf::from(path_literal.value());// Read the fluent file at the given pathlet manifest_root = std::env::var("CARGO_MANIFEST_DIR").unwrap();let resource_path = PathBuf::from(manifest_root).join(path_literal.value());let fluent_contents = std::fs::read_to_string(resource_path).unwrap();// Parse the file into a `Group`let resource = fluent_syntax::parser::parse(fluent_contents).unwrap();let group = Group::from_resource(resource); - replacement in fluent_embed/src/parse_macro.rs at line 67
// TODO: path should be relative to source file, not working directorysupplied_path.canonicalize().unwrap()group - replacement in fluent_embed/src/lib.rs at line 6
pub use parse_macro::{attribute_path, derive_enum};[3.3509]pub use parse_macro::{attribute_groups, derive_enum};