Tweak a patch

This commit is contained in:
Michael Snoyman 2013-12-04 19:40:12 +02:00
parent 9d4d6cc693
commit 9f46ad07ec

View File

@ -1,92 +1,3 @@
diff -ru orig/datadir/resources/search.xml new/datadir/resources/search.xml
--- orig/datadir/resources/search.xml 2013-12-04 19:36:25.391122832 +0200
+++ new/datadir/resources/search.xml 2013-12-04 19:36:25.000000000 +0200
@@ -11,8 +11,8 @@
<Url type="text/html" template="http://haskell.org/hoogle/?hoogle={searchTerms}"/>
<Url type="application/x-suggestions+json" template="http://haskell.org/hoogle/?hoogle={searchTerms}&amp;mode=suggest"/>
- <Image height="16" width="16" type="image/png">http://haskell.org/hoogle/datadir/resources/favicon.png</Image>
- <Image height="64" width="64" type="image/png">http://haskell.org/hoogle/datadir/resources/favicon64.png</Image>
+ <Image height="16" width="16" type="image/png">http://haskell.org/hoogle/res/favicon.png</Image>
+ <Image height="64" width="64" type="image/png">http://haskell.org/hoogle/res/favicon64.png</Image>
<Developer>Neil Mitchell</Developer>
<AdultContent>false</AdultContent>
<Language>en-us</Language>
diff -ru orig/hoogle.cabal new/hoogle.cabal
--- orig/hoogle.cabal 2013-12-04 19:36:25.395122833 +0200
+++ new/hoogle.cabal 2013-12-04 19:36:25.000000000 +0200
@@ -15,7 +15,7 @@
or by approximate type signature.
homepage: http://www.haskell.org/hoogle/
bug-reports: https://github.com/ndmitchell/hoogle/issues
-stability: Beta
+tested-with: GHC==7.6.3, GHC==7.4.2, GHC==7.2.2
extra-source-files: README.txt
datadir/*.txt
@@ -72,8 +72,8 @@
Hoogle.Language.Haskell
other-modules:
- Data.Heap
- Data.TypeMap
+ General.Heap
+ General.TypeMap
General.Base
General.System
General.Util
@@ -172,17 +172,9 @@
Web.Template
test-suite hoogle-test
- main-is: HoogleSpec.hs
- hs-source-dirs: test
+ main-is: Test.hs
+ hs-source-dirs: src
default-language: Haskell98
type: exitcode-stdio-1.0
- build-depends:
- base >=3,
- hoogle,
- conduit >= 0.2,
- system-fileio >= 0.3.11,
- transformers >= 0.2,
- HUnit >= 1.2.5,
- hspec >= 1.4.4,
- hspec-expectations >= 0.3
+ build-depends: base >= 3, process, directory, filepath
diff -ru orig/src/Console/All.hs new/src/Console/All.hs
--- orig/src/Console/All.hs 2013-12-04 19:36:25.387122831 +0200
+++ new/src/Console/All.hs 2013-12-04 19:36:25.000000000 +0200
@@ -29,10 +29,9 @@
action (Test files _) = do
testPrepare
fails <- fmap sum $ mapM (testFile action) files
- putStrLn $
- if fails == 0
- then "Tests passed"
- else "TEST FAILURES (" ++ show fails ++ ")"
+ if fails == 0 then putStrLn "Tests passed" else do
+ putStrLn $ "TEST FAILURES (" ++ show fails ++ ")"
+ exitFailure
action (Rank file) = rank file
diff -ru orig/src/Console/Test.hs new/src/Console/Test.hs
--- orig/src/Console/Test.hs 2013-12-04 19:36:25.387122831 +0200
+++ new/src/Console/Test.hs 2013-12-04 19:36:25.000000000 +0200
@@ -22,6 +22,7 @@
putStrLn "Converting testdata"
performGC -- clean up the databases
dat <- getDataDir
+ createDirectoryIfMissing True $ dat </> "databases"
src <- readFileUtf8 $ dat </> "testdata.txt"
let (errs, dbOld) = createDatabase Haskell [] src
unless (null errs) $ error $ unlines $ "Couldn't convert testdata database:" : map show errs
Only in orig/src: Data
Only in new/src/General: Heap.hs
Only in new/src/General: TypeMap.hs
diff -ru orig/src/General/Web.hs new/src/General/Web.hs
--- orig/src/General/Web.hs 2013-12-04 19:36:25.387122831 +0200
+++ new/src/General/Web.hs 2013-12-04 19:36:25.000000000 +0200
@ -123,85 +34,6 @@ diff -ru orig/src/General/Web.hs new/src/General/Web.hs
responseEvaluate :: Response -> IO ()
diff -ru orig/src/Hoogle/DataBase/TypeSearch/Graphs.hs new/src/Hoogle/DataBase/TypeSearch/Graphs.hs
--- orig/src/Hoogle/DataBase/TypeSearch/Graphs.hs 2013-12-04 19:36:25.387122831 +0200
+++ new/src/Hoogle/DataBase/TypeSearch/Graphs.hs 2013-12-04 19:36:25.000000000 +0200
@@ -11,7 +11,7 @@
import Hoogle.Store.All
import qualified Data.IntMap as IntMap
-import qualified Data.Heap as Heap
+import qualified General.Heap as Heap
import General.Base
import General.Util
import Control.Monad.Trans.State
diff -ru orig/src/Recipe/Download.hs new/src/Recipe/Download.hs
--- orig/src/Recipe/Download.hs 2013-12-04 19:36:25.383122832 +0200
+++ new/src/Recipe/Download.hs 2013-12-04 19:36:25.000000000 +0200
@@ -47,8 +47,8 @@
, (inputs <.> "txt", inputs <.> "tar.gz", "http://old.hackage.haskell.org/packages/archive/00-hoogle.tar.gz")
]
withDownloader opt downloader items
- extractTarball cabals
- extractTarball inputs
+ doesFileExist (cabals <.> "tar.gz") >>= \b -> when b $ extractTarball cabals
+ doesFileExist (inputs <.> "tar.gz") >>= \b -> when b $ extractTarball inputs
check :: String -> IO (Maybe FilePath)
diff -ru orig/src/Recipe/Keyword.hs new/src/Recipe/Keyword.hs
--- orig/src/Recipe/Keyword.hs 2013-12-04 19:36:25.383122832 +0200
+++ new/src/Recipe/Keyword.hs 2013-12-04 19:36:25.000000000 +0200
@@ -13,10 +13,9 @@
translate :: String -> String
translate src = unlines $ keywordPrefix ++ items
- where items = concatMap keywordFormat $ drop 1 $ partitions (~== "<a name>") $
+ where items = concatMap keywordFormat $ partitions (~== "<span class='mw-headline' id>") $
takeWhile (~/= "<div class=printfooter>") $ parseTags src
-
keywordPrefix =
["-- Hoogle documentation, generated by Hoogle"
,"-- From http://www.haskell.org/haskellwiki/Keywords"
@@ -33,17 +32,16 @@
noUnderscore "_" = "_"
noUnderscore xs = map (\x -> if x == '_' then ' ' else x) xs
- name = words $ f $ fromAttrib "name" (head x)
+ name = words $ f $ fromAttrib "id" (head x)
docs = zipWith (++) ("-- | " : repeat "-- ") $
intercalate [""] $
- map (docFormat . takeWhile (~/= "<div class=editsection>")) $
+ map docFormat $
partitions isBlock x
g x | isAlpha x || x `elem` "_-:" = [x]
| otherwise = '.' : map toUpper (showHex (ord x) "")
-
- isBlock (TagOpen x _) = x `elem` ["p","pre"]
+ isBlock (TagOpen x _) = x `elem` ["p","pre","ul"]
isBlock _ = False
f ('.':'2':'C':'_':xs) = ' ' : f xs
@@ -56,7 +54,7 @@
docFormat :: [Tag String] -> [String]
docFormat (TagOpen "pre" _:xs) = ["<pre>"] ++ map (drop n) ys ++ ["</pre>"]
where
- ys = lines $ innerText xs
+ ys = lines $ reverse $ dropWhile isSpace $ reverse $ innerText xs
n = minimum $ map (length . takeWhile isSpace) ys
docFormat (TagOpen "p" _:xs) = g 0 [] $ words $ f xs
@@ -73,3 +71,6 @@
h (TagText x) = unwords (lines x)
h _ = ""
+
+docFormat (TagOpen "ul" _:xs) =
+ ["<ul><li>"] ++ intercalate ["</li><li>"] [docFormat (TagOpen "p" []:x) | x <- partitions (~== "<li>") xs] ++ ["</li></ul>"]
Only in new/src: Test.hs
diff -ru orig/src/Web/Server.hs new/src/Web/Server.hs
--- orig/src/Web/Server.hs 2013-12-04 19:36:25.379122832 +0200
+++ new/src/Web/Server.hs 2013-12-04 19:36:25.000000000 +0200