No description
Find a file
2022-01-14 09:42:13 +07:00
.github Create FUNDING.yml 2021-10-01 08:02:43 +07:00
tests sibling combinators are working now 2015-06-11 02:03:32 +07:00
.gitignore support simple nested selectors 2015-06-03 18:48:42 +07:00
LICENSE Initial commit 2015-06-02 01:36:31 +07:00
q.nim make it gc-safe 2020-10-18 20:31:52 +07:00
q.nimble Update q.nimble 2022-01-14 09:42:13 +07:00
README.md Update README.md 2018-04-01 02:27:52 +07:00

q.nim

Simple package for query HTML/XML elements using a CSS3 or jQuery-like selector syntax for Nim.

This project is in alpha stage, some features are not supported yet.

Selectors

Installation

$ nimble install q

Changes

0.0.2 - supports sibling combinators and multiple class, attributes selectors
0.0.1 - initial release

Usage

import q
import xmltree

var html = """<html>
<head>
  <tile>Example</title>
</head>
<body>
  <nav>
    <ul class="menu">
      <li class="dropdown">
        <a href="#">Link 1</a>
      </li>
      <li>
        <a href="#">Link 2</a>
      </li>
    </ul>
  </nav
</body>
</html>"""


# Parse HTML document
var doc = q(html)

# Search for nodes by css selector
echo doc.select("nav ul.menu li a")
# @[<a href="#">Link 1</a>, <a href="#">Link 2</a>]