# fxlang **Repository Path**: sky-wang/fxlang ## Basic Information - **Project Name**: fxlang - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-07-09 - **Last Updated**: 2021-08-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Fxlang `fxlang` is a template language. Using `fxlang`, you can generate target sentences based on templates and metadata, and you can also extract metadata from target sentences based on templates. ## Installation Add this line to your application's Gemfile: ```ruby gem 'fxlang' ``` And then execute: $ bundle Or install it yourself as: $ gem install fxlang ## Usage ```Ruby template = Fxlang::Template.new("Hi, shipment {{shipment.fid}} has been {{status}}!", pack: true, unpack: true) # Generate target sentence metadata = { shipment: {fid: "Flex-123456"}, status: "completed" } template.pack(metadata) # "Hi, shipment Flex-123456 has been completed!" # Extract metadata from target sentence sentence = "Hi, shipment Flex-123456 has been completed!" template.unpack(sentence) # { shipment: {fid: "Flex-123456"}, status: "completed"} ``` ### Syntax to support `pack` - [x] Placeholder. The code block in the placeholder supports all the syntax of the current language (Ruby). - [ ] Conditional statements. `if...else...end`, `break`, `continue`, `return` - [ ] Loop. `for...end` ### Syntax to support `unpack` - [x] Placeholder. The code block in the placeholder supports all the syntax of the current language (Ruby). - [ ] Conditional statements. `if...else...end`, `break`, `continue`, `return` - [ ] Loop. `for...end` ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/fxlang. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). ## Code of Conduct Everyone interacting in the Fxlang project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/fxlang/blob/master/CODE_OF_CONDUCT.md).