Lemongrass is a pure Janet library for converting between markup languages like HTML and XML and Janet data structures (in Hiccup syntax). It comes with a CLI utility for converting at the command line.
Add the dependency to your info.jdn file:
:dependencies ["https://github.com/pyrmont/lemongrass"]Lemongrass can be used like this:
(import lemongrass)
(lemongrass/markup->janet `<h1 class="foo">Hello world!</h1>`)
# => @[:h1 @{:class "foo"} "Hello world!"]
(lemongrass/janet->markup [:h1 {:class "foo"} "Hello world!"])
# => "<h1 class="foo">Hello world!</h1>"Check out the API document for more information.
To install the lg CLI utility with JPM:
$ jpm install "https://github.com/pyrmont/lemongrass"Run lg --help for usage information:
$ lg --help
Usage: lg [--format <format>] [--output <path>] [--reverse] [<input>]
Convert from HTML/XML to Janet data structures.
Parameters:
input The <path> for the input file. (Default: stdin)
Options:
-f, --format <format> The <format> of the markup, either html or xml. (Default: html)
-o, --output <path> The <path> for the output file. (Default: stdout)
-r, --reverse Reverse the polarity and convert from Janet to markup.
-h, --help Show this help message.
Found a bug? I'd love to know about it. The best way is to report your bug in the Issues section on GitHub.
Lemongrass is licensed under the MIT Licence. See LICENSE for more details.