Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/galargh/data.html
https://github.com/galargh/data.html
Last synced: 17 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/galargh/data.html
- Owner: galargh
- License: mit
- Created: 2021-03-30T06:40:09.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-04-20T19:05:13.000Z (over 3 years ago)
- Last Synced: 2024-12-20T03:11:14.897Z (23 days ago)
- Language: Clojure
- Size: 70.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# data.html [![Clojars Project](https://img.shields.io/clojars/v/org.clojars.gfjalar/data.html.svg)](https://clojars.org/org.clojars.gfjalar/data.html)
A Clojure library designed to tokenize HTML data.
The tokenization algorithm implemented by this library closely follows the specification given [here](https://html.spec.whatwg.org/multipage/parsing.html#tokenization).
The implementation of `tokenize` in this library returns a lazy sequence of tokens.
## Usage
```clojure
data.html=> (require 'org.clojars.gfjalar/data.html)
nil
data.html=> (data.html/tokenize "")
({:type :start-tag, :data "html"} {:type :EOF})
data.html=> (data.html/tokenize "")
({:type :start-tag, :data "html"} {:type :end-tag, :data "html"} {:type :EOF})
data.html=> (data.html/tokenize "data.html
")
({:type :start-tag, :data "html"} {:type :start-tag, :data "body"} {:type :start-tag, :data "h1"} {:type :character, :data \d} {:type :character, :data \a} {:type :character, :data \t} {:type :character, :data \a} {:type :character, :data \.} {:type :character, :data \h} {:type :character, :data \t} {:type :character, :data \m} {:type :character, :data \l} {:type :end-tag, :data "h1"} {:type :end-tag, :data "body"} {:type :end-tag, :data "html"} {:type :EOF})
```## [License](LICENSE)