blob: a84ee6beb403b6b7220eba555785c95c51a370a9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
Index: src/tools/Xtract.hs
===================================================================
RCS file: /home/cvs/root/HaXml/src/tools/Xtract.hs,v
retrieving revision 1.3
diff -u -r1.3 Xtract.hs
--- src/tools/Xtract.hs 2 Oct 2002 10:24:06 -0000 1.3
+++ src/tools/Xtract.hs 27 Aug 2003 16:27:55 -0000
@@ -11,7 +11,7 @@
import Text.XML.HaXml.Parse (xmlParse)
import Text.XML.HaXml.Html.Parse (htmlParse)
import Text.XML.HaXml.Xtract.Parse (parseXtract)
-import Text.PrettyPrint.HughesPJ (render, vcat)
+import Text.PrettyPrint.HughesPJ (render, vcat, hcat, empty)
import Text.XML.HaXml.Pretty (content)
import Text.XML.HaXml.Html.Generate (htmlprint)
@@ -40,7 +40,7 @@
( if isHTML x then
hPutStrLn stdout . render . htmlprint .
dfilter htmlSelection . getElem . htmlParse x
- else hPutStrLn stdout . render . vcat . map content .
+ else hPutStrLn stdout . render . format .
dfilter xmlSelection . getElem . xmlParse x) c)
files
@@ -48,3 +48,8 @@
isHTML x = ".html" `isSuffixOf` x || ".htm" `isSuffixOf` x
dfilter f = \x-> f x x
+
+format [] = empty
+format cs@(CString _ _:_) = hcat . map content $ cs
+format cs@(CRef _:_) = hcat . map content $ cs
+format cs = vcat . map content $ cs
|