Skip to content

Query HTML/XML elements using a CSS3 or jQuery-like selector syntax

License

Notifications You must be signed in to change notification settings

OpenSystemsLab/q.nim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>]

About

Query HTML/XML elements using a CSS3 or jQuery-like selector syntax

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published