diff options
author | Alec Theriault <alec.theriault@gmail.com> | 2019-02-06 01:01:41 -0800 |
---|---|---|
committer | Alec Theriault <alec.theriault@gmail.com> | 2019-02-25 00:42:46 -0800 |
commit | a5199600c39d25d7b71dcb2328000c1c49ad95a2 (patch) | |
tree | 787057c0315d1adf98cab3769ad47b63cb3c0a94 /html-test | |
parent | dd47029cb29c80b1ab4db520c9c2ce4dca37f833 (diff) |
Better identifier parsing
* '(<|>)' and '`elem`' now get parsed and rendered properly as links
* 'DbModule'/'DbUnitId' now properly get split apart into two links
* tuple names now get parsed properly
* some more small niceties...
The identifier parsing code is more precise and more efficient (although to be
fair: it is also longer and in its own module). On the rendering side, we need
to pipe through information about backticks/parens/neither all the way through
from renaming to the backends.
In terms of impact: a total of 35 modules in the entirety of the bootlib + ghc
lib docs change. The only "regression" is things like '\0'. These should be
changed to @\\0@ (the path by which this previously worked seems accidental).
Diffstat (limited to 'html-test')
-rw-r--r-- | html-test/ref/Identifiers.html | 286 | ||||
-rw-r--r-- | html-test/ref/Test.html | 2 | ||||
-rw-r--r-- | html-test/src/Identifiers.hs | 35 |
3 files changed, 322 insertions, 1 deletions
diff --git a/html-test/ref/Identifiers.html b/html-test/ref/Identifiers.html new file mode 100644 index 00000000..1a0a18a5 --- /dev/null +++ b/html-test/ref/Identifiers.html @@ -0,0 +1,286 @@ +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><meta name="viewport" content="width=device-width, initial-scale=1" + /><title + >Identifiers</title + ><link href="#" rel="stylesheet" type="text/css" title="NewOcean" + /><link rel="stylesheet" type="text/css" href="#" + /><link rel="stylesheet" type="text/css" href="#" + /><script src="haddock-bundle.min.js" async="async" type="text/javascript" + ></script + ><script type="text/x-mathjax-config" + >MathJax.Hub.Config({ tex2jax: { processClass: "mathjax", ignoreClass: ".*" } });</script + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script + ></head + ><body + ><div id="package-header" + ><span class="caption empty" + > </span + ><ul class="links" id="page-menu" + ><li + ><a href="#" + >Contents</a + ></li + ><li + ><a href="#" + >Index</a + ></li + ></ul + ></div + ><div id="content" + ><div id="module-header" + ><table class="info" + ><tr + ><th + >Safe Haskell</th + ><td + >Safe</td + ></tr + ></table + ><p class="caption" + >Identifiers</p + ></div + ><div id="synopsis" + ><details id="syn" + ><summary + >Synopsis</summary + ><ul class="details-toggle" data-details-id="syn" + ><li class="src short" + ><span class="keyword" + >data</span + > <a href="#" + >Id</a + > = <a href="#" + >Id</a + ></li + ><li class="src short" + ><span class="keyword" + >data</span + > a <a href="#" + >:*</a + > b = a <a href="#" + >:*</a + > b</li + ><li class="src short" + ><a href="#" + >foo</a + > :: ()</li + ></ul + ></details + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a id="t:Id" class="def" + >Id</a + > <a href="#" class="selflink" + >#</a + ></p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a id="v:Id" class="def" + >Id</a + ></td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > a <a id="t::-42-" class="def" + >:*</a + > b <a href="#" class="selflink" + >#</a + ></p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + >a <a id="v::-42-" class="def" + >:*</a + > b</td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><a id="v:foo" class="def" + >foo</a + > :: () <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><ul + ><li + ><p + >Unadorned:</p + ><ul + ><li + >Unqualified: <code + ><a href="#" title="GHC.List" + >++</a + ></code + >, <code + ><a href="#" title="Data.Foldable" + >elem</a + ></code + ></li + ><li + >Qualified: <code + ><a href="#" title="GHC.List" + >++</a + ></code + >, <code + ><a href="#" title="Data.Lis" + >elem</a + ></code + ></li + ><li + >Namespaced: <code + ><a href="#" title="GHC.List" + >++</a + ></code + >, <code + >++</code + >, <code + ><a href="#" title="Data.Foldable" + >elem</a + ></code + >, <code + >elem</code + >, <code + ><a href="#" title="Identifiers" + >Id</a + ></code + >, <code + ><a href="#" title="Identifiers" + >Id</a + ></code + >, <code + ><a href="#" title="Identifiers" + >:*</a + ></code + >, <code + ><a href="#" title="Identifiers" + >:*</a + ></code + ></li + ></ul + ></li + ><li + ><p + >Parenthesized:</p + ><ul + ><li + >Unqualified: <code + ><code + ><a href="#" title="GHC.List" + >(++)</a + ></code + > [1,2,3] [4,5,6]</code + ></li + ><li + >Qualified: <code + ><code + ><a href="#" title="GHC.List" + >(++)</a + ></code + > [1,2,3] [4,5,6]</code + ></li + ><li + >Namespaced: <code + ><a href="#" title="GHC.List" + >(++)</a + ></code + >, <code + >++</code + >, <code + ><a href="#" title="Identifiers" + >(:*)</a + ></code + >, <code + ><a href="#" title="Identifiers" + >(:*)</a + ></code + ></li + ></ul + ></li + ><li + ><p + >Backticked:</p + ><ul + ><li + >Unqualified: <code + >1 <code + ><a href="#" title="Data.Foldable" + >`elem`</a + ></code + > [-3..3]</code + ></li + ><li + >Qualified: <code + >1 <code + ><a href="#" title="Data.Foldable" + >`elem`</a + ></code + > [-3..3]</code + ></li + ><li + >Namespaced: <code + ><a href="#" title="Data.Foldable" + >`elem`</a + ></code + >, <code + >`elem`</code + >, <code + ><a href="#" title="Identifiers" + >`Id`</a + ></code + >, <code + ><a href="#" title="Identifiers" + >`Id`</a + ></code + ></li + ></ul + ></li + ><li + ><p + >Edge cases:</p + ><ul + ><li + >Tuples: <code + >()</code + >, <code + >(,,,)</code + ></li + ></ul + ></li + ></ul + ></div + ></div + ></div + ></div + ><div id="footer" + ></div + ></body + ></html +> diff --git a/html-test/ref/Test.html b/html-test/ref/Test.html index b76622e7..aefc4d14 100644 --- a/html-test/ref/Test.html +++ b/html-test/ref/Test.html @@ -2364,7 +2364,7 @@ is at the beginning of the line).</pre >f'</a ></code > - but f' doesn't get link'd 'f\''</p + but f' doesn't get link'd 'f''</p ></div ></div ><div class="top" diff --git a/html-test/src/Identifiers.hs b/html-test/src/Identifiers.hs new file mode 100644 index 00000000..75f12109 --- /dev/null +++ b/html-test/src/Identifiers.hs @@ -0,0 +1,35 @@ +{-# LANGUAGE TypeOperators #-} +module Identifiers where + +import Data.List (elem, (++)) + +data Id = Id +data a :* b = a :* b + +{-| + + * Unadorned: + + - Unqualified: '++', 'elem' + - Qualified: 'Data.List.++', 'Data.Lis.elem' + - Namespaced: v'++', t'++', v'elem', t'elem', v'Id', t'Id', v':*', t':*' + + * Parenthesized: + + - Unqualified: @'(++)' [1,2,3] [4,5,6]@ + - Qualified: @'(Data.List.++)' [1,2,3] [4,5,6]@ + - Namespaced: v'(++)', t'++', v'(:*)', t'(:*)' + + * Backticked: + + - Unqualified: @1 '`elem`' [-3..3]@ + - Qualified: @1 '`Data.List.elem`' [-3..3]@ + - Namespaced: v'`elem`', t'`elem`', v'`Id`', t'`Id`' + + * Edge cases: + + - Tuples: '()', '(,,,)' + +-} +foo :: () +foo = () |