Hiccup to html, html to hiccup.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src fix comment Oct 2, 2014
test/hiccup_bridge/test fix #6 doctype exception Sep 29, 2014
.gitignore README Oct 31, 2010
README.md v1.0.1 Oct 2, 2014
epl-v10.html add epl-v10.html Oct 29, 2010
project.clj v1.0.1 Oct 2, 2014

README.md

Hiccup-bridge

Hiccup-bridge is a conversion tool between plain html and plain Hiccup form.

Example

hicv/hello.html

<html>
  <head>
    <meta content="text/html;charset=utf-8" http-equiv="content-type" />
    <title>Hello</title>
  </head>
  <body>
    <h1>Hello World</h1>
  </body>
</html>

Above HTML will be converted to following and vice versa.

hicv/hello.clj

([:html
  [:head
   [:meta
    {:http-equiv "content-type", :content "text/html;charset=utf-8"}]
   [:title "Hello"]]
  [:body [:h1 "Hello World"]]])

Usage

As a library

Add hiccup-bridge to your project.clj, then:

(require '[hiccup-bridge.core :as hicv])

(hicv/html->hiccup "<foo><bar>buzz</bar></foo>")
;; -> ([:foo [:bar "buzz"]])

Html to Hiccup

% lein hicv 2clj

All HTML files under "hicv" directory are converted to Hiccup form.

Example

% mkdir hicv
% curl https://github.com/ > hicv/github.html
% ls -l hicv
total 48
-rw-r--r--  1 fatrow  staff  22239  7  7 09:14 github.html
%
% lein hicv 2clj
%
% ls -l hicv
total 96
-rw-r--r--  1 fatrow  staff  21833  7  7 09:16 github.clj     <- generated
-rw-r--r--  1 fatrow  staff  22239  7  7 09:14 github.html

You can specify files you want to convert.

% lein hicv 2clj hicv/hello.html

Hiccup to Html

% lein hicv 2html

Example

% ls -l hicv
total 48
-rw-r--r--  1 fatrow  staff  21833  7  7 09:16 github.clj
%
% lein hicv 2html
% ls -l hicv
total 88
-rw-r--r--  1 fatrow  staff  21833  7  7 09:16 github.clj
-rw-r--r--  1 fatrow  staff  18622  7  7 09:19 github.html    <- generated

Installation to Leiningen

Add hiccup-bridge to project.clj.

    :plugins [
      [hiccup-bridge "1.0.1"]
    ]

You can also use plugins for any project without modifying profect.clj by specifing them in your :user profile of ~/.lein/profiles.clj.

{:user {:plugins [[hiccup-bridge "1.0.1"]]}}

License

The source code for hiccup-bridge is available under the Eclipse Public License v 1.0.

For more information, see epl-v10.html.

(c) Copyright: Takahiro Hozumi and Hoang Minh Thang.