repos
/
Oh, Ducks!
/ annotate_shade
summary
|
shortlog
|
log
|
tree
|
commit
|
commitdiff
|
headdiff
|
annotate
|
headblob
|
headfilediff
|
filehistory
normal
|
plain
|
shade
|
zebra
implicit-element is a better name than root
Annotate for file tests.lisp
2009-11-18 pix
1
(in-package #:oh-ducks)
2009-11-16 pix
2
;; FIXME: the switch to chtml:pt nodes means our #'equalp no longer
08:14:42 '
3
;; works.
2009-11-13 pix
4
2010-02-10 pix
5
#.(set-dispatch-macro-character #\# #\T 'unify::|sharp-T-reader|)
08:26:25 '
6
2009-11-18 pix
7
#+(or) (setq *default-parser* 'pt)
10:23:05 '
8
2009-11-13 pix
9
(equalp '(:div ((:id "id")) "I " (:i () "like") " cheese.")
2009-11-21 pix
10
(match (#T(html (:model lhtml) ("#id" . ?div))
2010-02-10 pix
11
"<div id=\"id\">I <i>like</i> cheese.</div>")
2009-11-13 pix
12
;; FIXME: learn to distinguish between when there should only be one
01:43:02 '
13
;; result and when there should be many?
'
14
(car div)))
'
15
'
16
(equalp '((:div ((:class "red fish")) "one fish")
'
17
(:div ((:class "blue fish")) "two fish"))
2009-11-21 pix
18
(match (#T(html (:model lhtml)
16:12:13 '
19
(".fish" . ?divs)
2009-11-16 pix
20
(".pig" . ?pig))
2009-11-13 pix
21
"<div class='pig'>bricklayer</div><div class='red fish'>one fish</div><div class='blue fish'>two fish</div>")
01:43:02 '
22
;; pig doesn't affect the equalp...but does show separate things are separate
'
23
(values divs pig)))
'
24
'
25
(equalp '((:i () "not") (:i () "cheese"))
2010-01-04 pix
26
(match (#T(html ("div" ("i" . ?i)))
07:11:36 '
27
"<div>I do <i>not</i> like cheese.</div><div>I like <i>cheese</i>.</div>")
2009-11-13 pix
28
i))
01:43:02 '
29
'
30
(equalp '((:i () "not"))
2010-01-04 pix
31
(match (#T(html (:model dom)
2009-11-21 pix
32
("div>i" . ?i))
2010-01-04 pix
33
"<div>I do <i>not</i> like cheese.</div><div><span>I like <i>cheese</i>.</span></div>")
2009-11-13 pix
34
i))
01:43:02 '
35
'
36
(equalp '((:i () "not"))
2010-01-04 pix
37
(match (#T(html (:model dom)
2009-11-21 pix
38
("div" (">i" . ?i)
18:31:09 '
39
;("i" . #t(list ?j ?i))
'
40
("span>i" . ?span)))
2010-01-04 pix
41
"<div>I do <i>not</i> like cheese.</div><div><span>I like <i>cheese</i>.</span></div>")
2009-11-16 pix
42
(values i span)))
2010-02-10 pix
43
(match (#T(html (:model dom)
08:27:56 '
44
("i" . #t(list ?j ?i))
'
45
("span>i" . ?span))
'
46
"<div>I do <i>not</i> like cheese.</div><div><span>I like <i>cheese</i>.</span></div>")
'
47
(values i span))
2009-11-21 pix
48
2010-02-10 pix
49
(match (#T(html (:model dom)
08:27:56 '
50
("div:first-child" . ?div)
'
51
("i:nth-child(1)" . ?i))
'
52
"<div>I do <i>not</i> <i>like</i> cheese.</div><div><span>I like <i>cheese</i>.</span></div>")
'
53
(values div i))
2009-11-23 pix
54
2010-02-10 pix
55
;; throws 'unification-failure
2009-11-23 pix
56
(match (#T(html (:model dom)
13:14:45 '
57
("q" . ?div))
2010-02-10 pix
58
"<div>I do <i>not</i> <i>like</i> cheese.</div><div><span>I like <i>cheese</i>.</span></div>")
2009-11-23 pix
59
(values div))
13:14:45 '
60
2010-02-10 pix
61
(match (#T(html (:model dom)
08:27:56 '
62
("b + i" . ?i))
'
63
"<div>I <b>really</b> <i>like</i> cheese. Do you not <i>dislike</i> cheese?</div>")
'
64
(values i))
2009-12-03 pix
65
2010-02-10 pix
66
(match (#T(html (:model dom)
08:27:56 '
67
("b ~ i" . ?i))
'
68
"<div>I <i>really</i> <b>like</b> cheese. Do you not <i>dislike</i> cheese?</div>")
'
69
(values i))
2009-12-03 pix
70
2009-12-04 pix
71
;; Sometimes, you want to match a thing inside a thing, in which case
04:47:58 '
72
;; combinators should implicitly assume an unspecified right side means
'
73
;; "whatever element I gave you".
2010-02-10 pix
74
(match (#T(html (:model dom)
08:27:56 '
75
("q" . ?q))
'
76
"<div><i>ham</i> foo <q>bar <i>baz</i></q> quuz <i>spam</i></div>")
'
77
(match (#t(html ("> i" . ?i))
'
78
(first q))
'
79
i))
2009-12-04 pix
80
2009-12-05 pix
81
;; siblings will also match, thanks to a bit of ugly code
2010-02-10 pix
82
(match (#T(html (:model dom)
08:27:56 '
83
("q" . ?q))
2009-12-05 pix
84
"<div><i>ham</i> foo <q>bar <i>baz</i></q> quuz <i>spam</i><q></q><i>not match</i></div>")
2010-02-10 pix
85
(match (#t(html ("+ i" . ?i))
08:27:56 '
86
(first q))
'
87
i))
2009-12-04 pix
88
2009-12-05 pix
89
(match (#T(html (:model dom)
07:18:05 '
90
("q" . ?q))
'
91
"<div> foo <q>outer q <i>baz <q>inner q</q></i></q> quuz</div>")
'
92
(match (#t(html ("q" . ?i))
'
93
(first q))
'
94
i))
'
95
2009-12-03 pix
96
2009-11-23 pix
97
#+LATER?
2009-11-21 pix
98
(match (#t(html ("div::content" . #t(regexp+ "^f(o+)" (?o))))
2009-11-13 pix
99
"<div>barbaz</div><div>fooooooobar</div>")
08:32:55 '
100
(values o &rest))
'
101