Haml-rs – Haml parser in Rust
source link: https://www.tuicool.com/articles/hit/AB7jEzB
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Haml-rs
This is a library and CLI for parsing Haml templates. You are able to get Haml-rs on Crates.io . The aim for this is to produce identical HTML to what the Ruby Haml gem produces.
Stability
This software is in its early stages and as such there may be issues with stability. While the public interface is unlikely to change from the library perspective (Haml::to_html(&str) is pretty straightforward) there will be changes behind the scenes.
If you find any bugs please don't hesitate to open an issue on github or, if you want, you can reach out directly to me at [email protected]
Example
Library
extern crate haml; use haml::Haml; fn main() { let test_haml = "%span"; let html = Haml::to_html(&test_haml); }
CLI
hamlrs input.haml output.html
Integration tests
There are currently a few integration tests (and more to come). If you are going to contribute to an integration test please make sure that the HTML file that is generated by the Ruby Haml gem so that we can ensure that we are producing the same output as the reference implementation.
Current limitations
There are a few limitations in this version of haml-rs.
- No variable support
- Must use HTML syntax for attributes rather than Ruby syntax (so "()" instead of "{}")
Roadmap
These are things that are on the roadmap for this project:
- Documentation
- Add variable support
- Support ruby attributes
- Add more tests
- Improve performance (there are areas that are copying when they may not need to)
License
This project is licensed under the MIT license .
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Haml-rs by you, shall be licensed as MIT, without any additional terms or conditions.
If you have any questions you can reach me via email at [email protected]
Recommend
-
35
Org Mode parser re-write in Rust ! Warning, this project is in early development ! Motivation Org is probably...
-
2
Rust Parser and State MachineRust Parser and State Machine - YouTube Back Skip navigation Search ...
-
6
Which is fastest? ERB vs. HAML vs. Slim A fast app means happy users. The speed that your pages render depends on which templating system you use. In this article, Diogo S...
-
6
Parser combinators in Rust Published on Tue, Mar 30, 2021 by
-
1
A new Left Recursive PEG Parser Generator for rust I’d like to introduce a new PEG parser generator for rust, called lrpeg. I’ve recently sta...
-
4
Why HAML is future of web and HTML, All about HAML. Reading Time: 4 minutesWhat is haml ?
-
7
haml-mode for Emacs haml-mode is an Emacs major mode for use with HAML source files. It provides syntax highlighting and support for syntax-aware indentation. Support for syn...
-
2
-
1
Rust - Writing Parsers With nom Parser Combinator Framework I've been working on my new Rust side-project for several months now, and I've got some learnings to share. The project is cal...
-
3
Hamlet A Haml template engine for Go.
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK