diff options
author | Leorize <leorize+oss@disroot.org> | 2019-03-02 01:51:38 +0700 |
---|---|---|
committer | Leorize <leorize+oss@disroot.org> | 2019-03-02 01:51:38 +0700 |
commit | 78d7ecae90ea277a6950565739ec93a45385d49f (patch) | |
tree | fe36043b7789672cc7092c80e6cbb275b1cda1e2 | |
parent | e1d17ece5b79cd142248162c964604cd0ba5ca3f (diff) | |
download | Nim-78d7ecae90ea277a6950565739ec93a45385d49f.tar.gz |
htmlparser: update example
This update htmlparser example to compile with the current stdlib.
-rw-r--r-- | lib/pure/htmlparser.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/pure/htmlparser.nim b/lib/pure/htmlparser.nim index 2d24050f2..a3683fdb2 100644 --- a/lib/pure/htmlparser.nim +++ b/lib/pure/htmlparser.nim @@ -30,6 +30,7 @@ ## ending with the extension ``.rst`` and convert them to ``.html``. ## ## .. code-block:: Nim +## :test: ## ## import htmlparser ## import xmltree # To use '$' for XmlNode @@ -41,9 +42,8 @@ ## let html = loadHTML("input.html") ## ## for a in html.findAll("a"): -## let href = a.attrs["href"] -## if not href.isNil: -## let (dir, filename, ext) = splitFile(href) +## if a.attrs.hasKey "href": +## let (dir, filename, ext) = splitFile(a.attrs["href"]) ## if cmpIgnoreCase(ext, ".rst") == 0: ## a.attrs["href"] = dir / filename & ".html" ## |