Skip to content

pyrmont/lemongrass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lemongrass

Test Status

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.

Library

Installation

Add the dependency to your info.jdn file:

  :dependencies ["https://github.com/pyrmont/lemongrass"]

Usage

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.

Utility

Installation

To install the lg CLI utility with JPM:

$ jpm install "https://github.com/pyrmont/lemongrass"

Usage

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.

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.

Licence

Lemongrass is licensed under the MIT Licence. See LICENSE for more details.

About

A converter in Janet for markup languages like HTML and XML

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages