Git Product home page Git Product logo

html-to-hiccup's Introduction

html-to-hiccup

CircleCI

Clojars Project Cljdoc badge Clojars download_badge

A tiny, simple and truly cross-platform (CLJC) html->hiccup function which does not rely on the browser.

Installation

Clojars Project

Feature

  • Truly cross-platform (CLJC), does not rely on the browser.
  • Tiny source code, easy to digest.
  • Highly hackable. Fork me as soon as needed!

Usage

(require '[taipei-404.html :refer [html->hiccup]])

(html->hiccup "<p>hello, world</p>")
; => ([:p "hello, world"])

Contributing

Pull Requests and bug reports are welcome.

You can run the tests in the background by using ./bin/kaocha --watch in a terminal while you are changing the source code in your preferred editor.

License

Copyright © 2022 Vincent Cantin and contributors.

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

html-to-hiccup's People

Contributors

andyhorng avatar green-coder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

html-to-hiccup's Issues

ClojureScript: Invalid :refer, var instaparse.core/defparser does not exist

Hello Vincent,

I tried to use your library on ClojureScript, but I think you might need a different import statement for ClojureScript. According to the README from the instaparse library:

;; Clojure
(:require [instaparse.core :as insta :refer [defparser]])
;; ClojureScript
(:require [instaparse.core :as insta :refer-macros [defparser]])

So I guess this should correct the issue in the declaration of the namespace:

(ns taipei-404.html
  (:require [clojure.string :as str]
            [clojure.edn :as edn]
            #?(:clj [instaparse.core :as insta :refer [defparser]]
               :cljs [instaparse.core :as insta :refer-macros [defparser]])))

Best regards,
David

Non-quoted attribute values

Thanks for making this a library!

First thing I noticed is missing non-quoted attribute values.

taipei-404.html> (html->hiccup "<script src=/foo/bar/baz.js></script>")
Execution error at taipei-404.html/html->hiccup$fn (html.cljc:51).
Invalid token: /foo/bar/baz.js

I'd like to use this library in cybermonday - so I'm planning on stress testing it. I can get to a PR in a bit when I have some time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.