haddocset icon indicating copy to clipboard operation
haddocset copied to clipboard

copyHtml seems break <a ...> tags in src/*.html

Open duke13137 opened this issue 8 years ago • 1 comments

Hi, thanks for developing such easy to use tool!

I ran into some strange "file not found" errors when navigating source (embedded) links in Dash. copy&paste those links to Browser, it appears they all have either /pkg/ or /src/ repeated twice in URL path.

I tried a quick hack like below (my understanding of code is limited). Nevertheless, everything works great after rebuilding doc set with that. FYI, I'm using ghc 8.0.2, and all haddock HTML pages are built with using "stack hoogle" or "stack haddock" command.

diff --git a/Documentation/Haddocset.hs b/Documentation/Haddocset.hs
index 2597ed4..919b430 100644
--- a/Documentation/Haddocset.hs
+++ b/Documentation/Haddocset.hs
@@ -207,14 +207,7 @@ copyHtml doc dst = do
     getAttr _             = error "copyHtml: call attr to !TagOpen."

     rebase :: FilePath -> FilePath
-    rebase p =
-        let file    = takeFileName p
-            isSrc   = "src" `elem` splitDirectories (parent p)
-            srcNize = if isSrc then ("src" </>) else id
-            pkgs    = filter packageLike . reverse $ splitDirectories (parent p)
-        in case pkgs of
-            []    -> file
-            pkg:_ -> ".." </> pkg </> srcNize file
+    rebase p = p

Cheers! Feng

duke13137 avatar Aug 15 '17 02:08 duke13137

Ok, only <a ...> in src/*.html are broken. For examples,

<a name="line-199"> to <a href="../req-0.4.0/src/Network.HTTP.Req.html#line-199" name="line-199"

<a href="Network.HTTP.Req.html#lbsResponse" to <a href="../req-0.4.0/Network.HTTP.Req.html#lbsResponse">

<a href="#local-6989586621679105550"> to <a href="../req-0.4.0/src/Network.HTTP.Req.html#local-6989586621679105550">

Shouldn't these cases be left as-is?

duke13137 avatar Aug 15 '17 05:08 duke13137