diff options
author | Sebastian Meric de Bellefon <Sebastian.MericdeBellefon@tritondigital.com> | 2016-05-15 01:12:28 -0400 |
---|---|---|
committer | Sebastian Meric de Bellefon <Sebastian.MericdeBellefon@tritondigital.com> | 2016-05-15 02:12:46 -0400 |
commit | f6e5d57bee5a7bf5d74d26982db64fa8a56f17bd (patch) | |
tree | a47da4108c055740b195d9b38352cef51f1185b0 | |
parent | 26e6b39de3213969d7de7f8bb3d4a849136866d1 (diff) |
Fix #280. Parsing of module header
The initial newlines were counted as indentation spaces, thus disturbing the parsing of next lines
-rw-r--r-- | haddock-api/src/Haddock/Interface/ParseModuleHeader.hs | 2 | ||||
-rw-r--r-- | html-test/ref/Bug280.html | 81 | ||||
-rw-r--r-- | html-test/src/Bug280.hs | 11 |
3 files changed, 93 insertions, 1 deletions
diff --git a/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs b/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs index e7d2a085..768a31ce 100644 --- a/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs +++ b/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs @@ -76,7 +76,7 @@ parseKey :: String -> String -> Maybe (String,String) parseKey key toParse0 = do let - (spaces0,toParse1) = extractLeadingSpaces toParse0 + (spaces0,toParse1) = extractLeadingSpaces (dropWhile (`elem` ['\r', '\n']) toParse0) indentation = spaces0 afterKey0 <- extractPrefix key toParse1 diff --git a/html-test/ref/Bug280.html b/html-test/ref/Bug280.html new file mode 100644 index 00000000..f154f300 --- /dev/null +++ b/html-test/ref/Bug280.html @@ -0,0 +1,81 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Bug280</title + ><link href="#" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_Bug280.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><a href="#" + >Contents</a + ></li + ><li + ><a href="#" + >Index</a + ></li + ></ul + ><p class="caption empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><table class="info" + ><tr + ><th + >Copyright</th + ><td + >Foo, + Bar, + Baz</td + ></tr + ><tr + ><th + >Safe Haskell</th + ><td + >Safe</td + ></tr + ></table + ><p class="caption" + >Bug280</p + ></div + ><div id="description" + ><p class="caption" + >Description</p + ><div class="doc" + ><p + >The module description</p + ></div + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><a id="v:x" class="def" + >x</a + > :: [<a href="#" + >Char</a + >] <a href="#" class="selflink" + >#</a + ></p + ></div + ></div + ></div + ><div id="footer" + ></div + ></body + ></html +> diff --git a/html-test/src/Bug280.hs b/html-test/src/Bug280.hs new file mode 100644 index 00000000..ac27e2e5 --- /dev/null +++ b/html-test/src/Bug280.hs @@ -0,0 +1,11 @@ +{-| +Copyright: Foo, + Bar, + Baz + +The module description +-} +-- The module header can start with newlines. They are not taken into account for the indentation level +module Bug280 where + +x = "" |