Browse files

Implemented https://github.com/jgm/yst/issues#issue/13 .

  • Loading branch information...
1 parent 5453455 commit b7598ad4c67b8d665bc0715af1d0885d11d5cc06 Ohad Kammar committed with ohad Dec 25, 2010
Showing with 5 additions and 0 deletions.
  1. +4 −0 Yst/Data.hs
  2. +1 −0 Yst/Types.hs
View
4 Yst/Data.hs
@@ -73,6 +73,9 @@ filterTestPred TestGt = (>)
filterTestPred TestLt = (<)
filterTestPred TestGtEq = (>=)
filterTestPred TestLtEq = (<=)
+filterTestPred TestContains = \n1 n2 -> case n1 of
+ NList ns -> elem n2 ns
+ _ -> False
filterArgToNode :: FilterArg -> Node -> Node
filterArgToNode (AttrValue attr) (NMap ns) = fromMaybe NNil (lookup attr ns)
@@ -253,6 +256,7 @@ pFilterTest = do
, ("<=",TestLtEq)
, (">",TestGt)
, ("<",TestLt)
+ , ("contains",TestContains)
]
pSpace :: GenParser Char st ()
View
1 Yst/Types.hs
@@ -99,6 +99,7 @@ data FilterTest = TestEq
| TestLt
| TestGtEq
| TestLtEq
+ | TestContains
deriving (Show, Read, Eq)
data SortDirection = Ascending | Descending deriving (Show, Read, Eq)

0 comments on commit b7598ad

Please sign in to comment.