Skip to content

Instantly share code, notes, and snippets.

@benzap
Last active September 20, 2018 15:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save benzap/9a4af8dabd68ded11fcc3eac4b712110 to your computer and use it in GitHub Desktop.
hiccup2xml script written in eden
#!/usr/bin/env eden
local help-message = "
hiccup2xml - Hiccup Markup to XML Markup
Usage:
hiccup2xml read <filename>
hiccup2xml eval <string>
"
local argv = system.argv
if count(argv) == 0 then
println(help-message)
elseif count(argv) == 2 and argv[0] == "eval" then
println(html.stringify(edn.parse(argv[1])))
elseif count(argv) == 2 and argv[0] == "read" then
local filename = argv[1]
if filesystem.file?(filename) then
local s = slurp(filename)
println(html.stringify(edn.parse(s)))
else
println("Given filename does not exist: " filename)
end
else
println(help-message)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment