Clojure(Script) library for building Netscape Bookmark files
Based on: https://msdn.microsoft.com/en-us/library/aa753582%28v=vs.85%29.aspx
Add the following dependency to your project.clj file:
(defproject example "0.1.0"
:dependencies [[com.nysavann/clj-nsbm "0.1.0"]])Require the library:
(ns example
(:require [clj-nsbm.core :as nsbm]))Build a document with a vector containing subfolders or shortcuts:
(nsbm/build [{:title "Languages"
:children [{:title "Clojure" :url "http://clojure.org/"}]}
{:title "Go" :url "https://golang.org/"}]}])
;;=> "<!DOCTYPE NETSCAPE-Bookmark-file-1><!--This is an automatically generated file. It will be read and overwritten. Do Not Edit! --><Title>Bookmarks</Title><H1>Bookmarks</H1><DL><DT><H3 FOLDED>Languages</H3><DL><p><DT><A HREF=\"http://clojure.org/\">Clojure</A></DL><p><DT><A HREF=\"https://golang.org/\">Go</A></DL>"A shortcut is a Clojure map containing the required key :url and optional keys :title, :date, :modified, and :visited.
(nsbm/build-shortcut {:title "Hacker News" :url "https://news.ycombinator.com/"})
;;=> "<DT><A HREF=\"https://news.ycombinator.com/\">Hacker News</A>"A subfolder is a Clojure map containing the optional keys :title and :children.
(nsbm/build-subfolder {:title "$" :children [{:url "http://dogecoin.com/"}]})
;;=> "<DT><H3 FOLDED>$</H3><DL><p><DT><A HREF=\"http://dogecoin.com/\"></A></DL><p>"Copyright © 2015 Nysa Vann <nysa@nysavann.com>
Distributed under the Eclipse Public License. See LICENSE for details.