Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tusharad/blaze-generator
Convert html code to blaze-html syntax.
https://github.com/tusharad/blaze-generator
Last synced: about 1 month ago
JSON representation
Convert html code to blaze-html syntax.
- Host: GitHub
- URL: https://github.com/tusharad/blaze-generator
- Owner: tusharad
- License: other
- Created: 2024-04-07T20:18:02.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-04-17T18:46:24.000Z (9 months ago)
- Last Synced: 2024-04-17T19:56:53.448Z (9 months ago)
- Language: Haskell
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Blaze Generator
Welcome to the Blaze Generator repository! This tool is designed for Haskell developers who want to seamlessly integrate HTML templates into their Haskell code using the powerful [blaze-html](https://jaspervdj.be/blaze/) library. `blaze-html` is a combinator library that allows for embedding HTML templates directly within Haskell code, providing a type-safe way to generate dynamic HTML content.
## Overview
The Blaze Generator takes your static HTML files and converts them into Haskell code that uses `blaze-html` syntax. This conversion process allows you to work more efficiently by writing your web UI in HTML and then automatically converting it into Haskell code, ready to be integrated into your web applications.
## Example
Consider you have the following HTML code for a login page:
```html
ScottyCrud - Login Page
Search
Login
```
To convert this HTML file into `blaze-html` syntax, you would use the Blaze Generator like so:
```bash
cabal exec blaze-generator "/path/to/your/html/file/login.html"
```The output will be Haskell code in `blaze-html` syntax:
```haskell
html ! lang "en" $ do
head $ do
title $ "ScottyCrud - Login Page"
body $ do
div ! class "main" $ do
nav ! class "header-bar navbar navbar-expand-lg navbar-dark" $ do
form ! class "d-flex ms-auto my-lg-0" $ do
input ! aria-label "Search" ! class "form-control me-2" ! placeholder "Search" ! type "search"
button ! class "btn btn-outline-light" ! type "submit" $ "Search"
button ! class "btn btn-outline-light ms-2" ! type "button" $ "Login"
div ! class "footer-bar" $ do
p $ "Footer here"
```## Getting Started
To get started with Blaze Generator, clone this repository and build the project using Cabal or Stack.
```bash
cabal build
``````bash
cabal exec blaze-generator "path/to/html/file"
```## Future Improvements
- **HTML Comments**: Currently, the Blaze Generator does not support converting HTML comments into Haskell comments. We plan to add this feature in a future release to ensure that comments in your HTML templates are preserved in the generated Haskell code.
Stay tuned for more updates and improvements to the Blaze Generator. We're constantly looking to enhance this tool to better serve the Haskell web development community.