Q.nim
Query HTML/XML elements using a CSS3 or jQuery-like selector syntax
Install / Use
/learn @OpenSystemsLab/Q.nimREADME
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
- [x] Type selectors
- [x] Class selectors
- [x] ID selectors
- [x] Descendant combinator
- [x] Universal selector
- [x] Attribute selectors
- [x] Child combinator
- [x] Adjacent sibling combinator
- [x] General sibling combinator
- [ ] Structural pseudo-classes
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>]
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
