https://github.com/pyrmont/lemongrass
A converter in Janet for markup languages like HTML and XML
https://github.com/pyrmont/lemongrass
hiccup html xml
Last synced: 2 months ago
JSON representation
A converter in Janet for markup languages like HTML and XML
- Host: GitHub
- URL: https://github.com/pyrmont/lemongrass
- Owner: pyrmont
- License: mit
- Created: 2023-12-06T19:43:08.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-01T02:49:43.000Z (3 months ago)
- Last Synced: 2025-03-07T03:30:39.447Z (2 months ago)
- Topics: hiccup, html, xml
- Language: Janet
- Homepage:
- Size: 46.9 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lemongrass
[](https://github.com/pyrmont/lemongrass/actions?query=workflow%3Abuild)
Lemongrass is a pure Janet library for converting between markup languages like
HTML and XML and Janet data structures (in [Hiccup syntax][hs]). It comes with
a CLI utility for converting at the command line.[hs]: http://weavejester.github.io/hiccup/syntax.html "Read more about Hiccup syntax"
## Library
### Installation
Add the dependency to your `project.janet` file:
```janet
(declare-project
:dependencies ["https://github.com/pyrmont/lemongrass"])
```### Usage
Lemongrass can be used like this:
```janet
(import lemongrass)(lemongrass/markup->janet `
Hello world!
`)
# => @[:h1 @{:class "foo"} "Hello world!"](lemongrass/janet->markup [:h1 {:class "foo"} "Hello world!"])
# => "Hello world!
"
```## Utility
### Installation
To install the `lg` CLI utility with JPM:
```shell
$ jpm install "https://github.com/pyrmont/lemongrass"
```### Usage
Run `lg --help` for usage information:
```
$ lg --help
Usage: lg [--format ] [--output ] [--reverse] []Convert from HTML/XML to Janet data structures.
Parameters:
input The for the input file. (Default: stdin)
Options:
-f, --format The of the markup, either html or xml. (Default: html)
-o, --output The for the output file. (Default: stdout)
-r, --reverse Reverse the polarity and convert from Janet to markup.-h, --help Show this help message.
```## Bugs
Found a bug? I'd love to know about it. The best way is to report your bug in
the [Issues][] section on GitHub.[Issues]: https://github.com/pyrmont/lemongrass/issues
## Licence
Lemongrass is licensed under the MIT Licence. See [LICENSE][] for more details.
[LICENSE]: https://github.com/pyrmont/lemongrass/blob/master/LICENSE