Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trikko/parserino
A super-fast html5 parser and DOM editor, for D
https://github.com/trikko/parserino
dlang dlanguage dom html html5 parser
Last synced: about 1 month ago
JSON representation
A super-fast html5 parser and DOM editor, for D
- Host: GitHub
- URL: https://github.com/trikko/parserino
- Owner: trikko
- Created: 2022-05-22T17:05:42.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-10-22T20:20:35.000Z (over 1 year ago)
- Last Synced: 2023-10-22T21:21:36.709Z (over 1 year ago)
- Topics: dlang, dlanguage, dom, html, html5, parser
- Language: D
- Homepage:
- Size: 7.94 MB
- Stars: 16
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# parserino [![Build & Test](https://github.com/trikko/parserino/actions/workflows/d.yml/badge.svg)](https://github.com/trikko/parserino/actions/workflows/d.yml)
* HTML5 parser based on [Lexbor](https://github.com/lexbor/lexbor)
* Super-fast parsing & dom editing
* Lazy ranges to browse dom faster.
* Every method is unit-tested on Linux, MacOS, Windows# documentation
All docs are available [here](https://trikko.github.io/parserino/)# how it works
Check also the [examples](https://github.com/trikko/parserino/tree/master/examples) folder
```d
import parserino;void main()
{
// Parserino will fix your html5
Document doc = "my html";
assert(doc.toString() == "my html");// Set a title for your page
doc.title = "Hello world";
assert(doc.toString() == "Hello worldmy html");// Append a html fragment
doc.body.appendChild(`
first
`.asFragment // without .asFragment pure text is appended
);// Create and fill an html element
auto newElement = doc.createElement("a");
newElement.setAttribute("href", "third.html");
newElement.innerText("third");
doc.body.appendChild(newElement);// You can use selector to select an element
doc
.bySelector("div a") // Select all inside a
.frontOrThrow // Take the first element of the range or throw an exception
.innerText="changed!"; // Change the inner textassert(doc.body.byId("tochange").innerText == "changed!");
}
```