From 7c7b4b2f42b3886316fb923bc96b53451945c767 Mon Sep 17 00:00:00 2001 From: Wouter Scherphof Date: Fri, 5 Apr 2013 20:03:04 +0200 Subject: [PATCH] Removed tests from sample.lua --- README.md | 5 ++++- doc/sample.lua | 52 -------------------------------------------------- 2 files changed, 4 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index da0887e..808949d 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,10 @@ Selectors can be combined; e.g. `".class:not([attribute]) element.class"` - The HTML text is not validated in any way; tag and attribute names and the nesting of different tags is completely arbitrary. The only HTML-specific part of the parser is that it knows which tags are void elements ##Examples -See `./doc/samples.lua` +See `./doc/sample.lua` + +##Tests +See `./tst/init.lua` ##Element type All tree elements provide, apart from `:select` and `()`, the following accessors: diff --git a/doc/sample.lua b/doc/sample.lua index 5c85bdb..9431784 100644 --- a/doc/sample.lua +++ b/doc/sample.lua @@ -23,58 +23,6 @@ local function p(n) end p(root) -local function select( s ) - print "" - print("->", s) - local sel = root:select(s) - for element in pairs(sel) do - print(element.name) - end - print(sel:len()) -end - -select("*") -select("link") -select("#/contacts/4711") -select(".chapters") -select("[href]") -select("span.firstname") -select("ul[id]") - -select("#/contacts/4711") -select("#/contacts/4711 *") -select("#/contacts/4711 .lastname") -select("body li[id]") - -select("ul") -select("ul *") -select("ul > *") -select("body [class]") -select("body > [class]") - -select(".contacts span:not(.firstname)") -select(":not(a)[href]") -select("[itemscope]:not([itemprop])") - -select("link[rel='alternate']") -select("[test2=\"val='2'\"]") -select("[test5='val5']") -select("[test6='val\"\"6']") -select("[itemscope='']") -select("[itemscope=]") -select("[itemscope]") - -select("[itemscope][itemprop='address']") -select("[itemscope][itemprop!='address']") -select("[itemscope][itemprop!='adres']") -select("[itemscope][itemprop!='']") -select("[hreflang|='en']") -select("[itemprop*='address']") -select("[words~='two']") -select("[words~='three']") -select("[itemprop$='ion']") -select("[hreflang^='en']") - print("\nchapters") local sel, chapters = root("ol.chapters > li"), {} for e in pairs(sel) do