yuuko 2009.10.23.2 → 2010.1.23
raw patch · 7 files changed
+51/−31 lines, 7 filesdep −haskell98dep −utf8-preludedep ~hxt
Dependencies removed: haskell98, utf8-prelude
Dependency ranges changed: hxt
Files
- Nemesis +6/−0
- changelog.md +7/−0
- readme.md +5/−1
- src/Main.hs +0/−11
- src/Text/HTML/Yuuko.hs +22/−10
- src/Text/HTML/Yuuko/Cookbook.hs +8/−0
- yuuko.cabal +3/−9
Nemesis view
@@ -17,6 +17,12 @@ desc "start main" task "main" (sh "ghci -isrc -Wall src/Main.hs")++ desc "start cookbook"+ task "c" (sh "ghci -isrc -Wall src/Text/HTML/Yuuko/Cookbook.hs")+ + desc "test utf8"+ task "test-utf8" (sh "runghc -isrc src/Main.hs '//div' < test/utf8.html") desc "put all .hs files in manifest" task "manifest" $ do
changelog.md view
@@ -1,3 +1,10 @@+2009.1.23+---------++### Fix++* use hxt < 8.5, not enough time to upgrade+ 2009.10.23.2 ------------
readme.md view
@@ -32,6 +32,10 @@ * [XPath](http://www.w3.org/TR/xpath) * [XML related libraries on Hackage](http://hackage.haskell.org/packages/archive/pkg-list.html#cat:xml) -<br/>+Who is Yuuko?+============= ++* [Yūko Ichihara](http://en.wikipedia.org/wiki/Y%C5%ABko_Ichihara#Y.C5.ABko_Ichihara)+* [xxxHolic](http://en.wikipedia.org/wiki/XxxHolic )
− src/Main.hs
@@ -1,11 +0,0 @@-module Main where--import Text.HTML.Yuuko-import System--main :: IO ()-main = do- args <- getArgs- case args of- [] -> putStrLn "\n usage: echo '<div>hi</div>' | yuuko //div\n"- expr:_ -> interact $ concatMap (++ "\n") . (yuuko expr)
src/Text/HTML/Yuuko.hs view
@@ -4,14 +4,31 @@ import qualified Text.XML.HXT.Arrow.XPathSimple as XS import System.IO.Unsafe +in_html :: [(String, String)]+in_html = [(a_parse_html, v_1)]++in_xml :: [(String, String)]+in_xml = [(a_ignore_none_xml_contents, v_1)]+ yuuko :: String -> String -> [String]-yuuko = yuuko_base [(a_parse_html, v_1)]+yuuko = yuuko_base in_html show_tree yuuko_xml :: String -> String -> [String]-yuuko_xml = yuuko_base [(a_ignore_none_xml_contents, v_1)]+yuuko_xml = yuuko_base in_xml show_tree -yuuko_base :: [(String, String)] -> String -> String -> [String]-yuuko_base args expr s = unsafePerformIO $+yuuko_for_text :: String -> String -> [String]+yuuko_for_text = yuuko_base in_html getText++show_tree :: IOStateArrow () XmlTree String+show_tree = writeDocumentToString write_args+ where+ write_args = + [ (a_no_xml_pi, v_0)+ , (a_output_xml, v_0)+ ]++yuuko_base :: [(String, String)] -> (IOStateArrow () XmlTree String) -> String -> String -> [String]+yuuko_base args formatter expr s = unsafePerformIO $ runX process where@@ -21,13 +38,8 @@ ] ++ args - write_args = - [ (a_encoding, utf8)- , (a_no_xml_pi, v_0 )- ]- process = readString read_args s >>> XS.getXPathTreesInDoc expr- >>> writeDocumentToString write_args+ >>> formatter
+ src/Text/HTML/Yuuko/Cookbook.hs view
@@ -0,0 +1,8 @@+module Text.HTML.Yuuko.Cookbook where++import Text.HTML.Yuuko++type S = String -> [String]++all_text :: S+all_text = yuuko_for_text "descendant-or-self::text()"
yuuko.cabal view
@@ -1,5 +1,5 @@ Name: yuuko-Version: 2009.10.23.2+Version: 2010.1.23 Build-type: Simple Synopsis: A transcendental HTML parser gently wrapping the HXT library Description:@@ -22,16 +22,10 @@ homepage: http://github.com/nfjinjing/yuuko data-files: readme.md, changelog.md, known-issues.md, Nemesis -Executable yuuko- ghc-options: -Wall- build-depends: base >= 4 && < 5, hxt, haskell98, utf8-prelude- hs-source-dirs: src/- main-is: Main.hs- other-modules: Text.HTML.Yuuko- library ghc-options: -Wall- build-depends: base >= 4 && < 5, hxt+ build-depends: base >= 4 && < 5, hxt >= 8.3.2.3 && < 8.5 hs-source-dirs: src/ exposed-modules: Text.HTML.Yuuko+ Text.HTML.Yuuko.Cookbook