[Git][ghc/ghc][wip/T24789_size_test] 3 commits: Add highlighting for inline-code snippets in haddock

Serge S. Gulin (@gulin.serge) gitlab at gitlab.haskell.org
Sun May 19 18:47:20 UTC 2024



Serge S. Gulin pushed to branch wip/T24789_size_test at Glasgow Haskell Compiler / GHC


Commits:
646d30ab by Jade at 2024-05-18T19:23:31+02:00
Add highlighting for inline-code snippets in haddock

- - - - -
64459a3e by Hécate Moonlight at 2024-05-19T08:42:27-04:00
haddock: Add a .readthedocs.yml file for online documentation

- - - - -
7d3d9bbf by Serge S. Gulin at 2024-05-19T18:47:05+00:00
Unicode: General Category size test (related #24789)

Added trivial size performance test which involves unicode general category usage via `read`.
The `read` itself uses general category to detect spaces.

The purpose for this test is to measure outcome of applying improvements at General Category representation in code discussed at #24789.

- - - - -


23 changed files:

- testsuite/tests/perf/size/all.T
- + testsuite/tests/perf/size/size_hello_unicode.hs
- + utils/haddock/.readthedocs.yaml
- utils/haddock/CHANGES.md
- utils/haddock/haddock-api/resources/html/Linuwial.std-theme/linuwial.css
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs
- utils/haddock/html-test/ref/Bug253.html
- utils/haddock/html-test/ref/Bug458.html
- utils/haddock/html-test/ref/Bug546.html
- utils/haddock/html-test/ref/Bug865.html
- utils/haddock/html-test/ref/BundledPatterns.html
- utils/haddock/html-test/ref/BundledPatterns2.html
- utils/haddock/html-test/ref/Hash.html
- utils/haddock/html-test/ref/Identifiers.html
- utils/haddock/html-test/ref/Math.html
- utils/haddock/html-test/ref/NamespacedIdentifiers.html
- utils/haddock/html-test/ref/PatternSyns.html
- utils/haddock/html-test/ref/PruneWithWarning.html
- utils/haddock/html-test/ref/Table.html
- utils/haddock/html-test/ref/Test.html
- utils/haddock/html-test/ref/Threaded.html
- utils/haddock/html-test/ref/Threaded_TH.html
- utils/haddock/html-test/ref/Unicode2.html


Changes:

=====================================
testsuite/tests/perf/size/all.T
=====================================
@@ -3,6 +3,8 @@ test('size_hello_obj', [collect_size(5, 'size_hello_obj.o')], compile, [''])
 test('size_hello_artifact', [collect_size(5, 'size_hello_artifact' + exe_extension())],
                              compile_artifact, [''])
 
+test('size_hello_unicode', [collect_size(5, 'size_hello_unicode' + exe_extension())], compile_artifact, [''])
+
 size_acceptance_threshold = 100
 
 test('array_dir'           ,[collect_size_ghc_pkg(size_acceptance_threshold , 'array')]           , static_stats , [] )


=====================================
testsuite/tests/perf/size/size_hello_unicode.hs
=====================================
@@ -0,0 +1,5 @@
+-- same as size_hello_artifact but we test the size of the resulting executable with unicode general category involved.
+module Main where
+
+-- read uses unicode general category to detect spaces
+main = print (read @Int "1337")


=====================================
utils/haddock/.readthedocs.yaml
=====================================
@@ -0,0 +1,14 @@
+# Documentation lives at https://haskell-haddock.readthedocs.io/latest/
+version: 2
+
+sphinx:
+  configuration: doc/conf.py
+
+build:
+  os: "ubuntu-22.04"
+  tools:
+    python: "3.8"
+
+python:
+  install:
+    - requirements: doc/requirements.txt


=====================================
utils/haddock/CHANGES.md
=====================================
@@ -1,3 +1,6 @@
+## Changes in 2.32.0
+ * add highlighting for inline-code-blocks (sections enclosed in @'s)
+
 ## Changes in 2.28.0
  * `hi-haddock` is integrated, which means docstrings are no longer extracted
    through typchecked module results. Instead, docstrings are taken from Haskell


=====================================
utils/haddock/haddock-api/resources/html/Linuwial.std-theme/linuwial.css
=====================================
@@ -47,7 +47,7 @@ dd {
 }
 
 a { text-decoration: none; }
-a[href]:link { color: #9E358F; }
+a[href]:link { color: #BE55AF; }
 a[href]:visited {color: #6F5F9C; }
 a[href]:hover { text-decoration:underline; }
 
@@ -733,6 +733,12 @@ table.info {
   margin-bottom: 1em;
 }
 
+.inline-code {
+  background-color: #f2f2f2;
+  border-radius: 5px;
+  padding: 1px 4px;
+}
+
 .warning {
   color: red;
 }


=====================================
utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs
=====================================
@@ -65,7 +65,7 @@ parHtmlMarkup qual insertAnchors ppId =
     , markupWarning = thediv ! [theclass "warning"]
     , markupEmphasis = emphasize
     , markupBold = strong
-    , markupMonospaced = thecode
+    , markupMonospaced = thecode ! [theclass "inline-code"]
     , markupUnorderedList = unordList
     , markupOrderedList = makeOrdList
     , markupDefList = defList


=====================================
utils/haddock/html-test/ref/Bug253.html
=====================================
@@ -58,7 +58,7 @@
 	    >
  identifier that's not in scope, we get an anchor as if it was a
  variable. Previous behaviour was to treat it as a type constructor
- so issue like #253 arose. Also see <code
+ so issue like #253 arose. Also see <code class="inline-code"
 	    >rename</code
 	    > function comments in
  source.</p
@@ -88,7 +88,7 @@
 	    ></p
 	  ><div class="doc"
 	  ><p
-	    >This link should generate <code
+	    >This link should generate <code class="inline-code"
 	      >#v</code
 	      > anchor: <code
 	      ><a href="DoesNotExist.html#v:fakeFakeFake" title="DoesNotExist"


=====================================
utils/haddock/html-test/ref/Bug458.html
=====================================
@@ -72,7 +72,7 @@
 	    ></p
 	  ><div class="doc"
 	  ><p
-	    >See the defn of <code
+	    >See the defn of <code class="inline-code"
 	      ><code
 		><a href="#" title="Bug458"
 		  >⊆</a


=====================================
utils/haddock/html-test/ref/Bug546.html
=====================================
@@ -87,7 +87,7 @@
 	    >Test:</p
 	    ><dl
 	    ><dt
-	      ><code
+	      ><code class="inline-code"
 		>[code with square \ brackets]</code
 		></dt
 	      ><dd
@@ -109,63 +109,63 @@
 	  ><div class="doc"
 	  ><dl
 	    ><dt
-	      ><code
+	      ><code class="inline-code"
 		>[..]</code
 		></dt
 	      ><dd
 	      >Matches any of the enclosed characters. Ranges of characters can
-            be specified by separating the endpoints with a <code
+            be specified by separating the endpoints with a <code class="inline-code"
 		>'-'</code
-		>. <code
+		>. <code class="inline-code"
 		>'-'</code
 		> or
-            <code
+            <code class="inline-code"
 		>']'</code
 		> can be matched by including them as the first character(s)
-            in the list. Never matches path separators: <code
+            in the list. Never matches path separators: <code class="inline-code"
 		>[/]</code
 		> matches
             nothing at all. Named character classes can also be matched:
-            <code
+            <code class="inline-code"
 		>[:x:]</code
-		> within <code
+		> within <code class="inline-code"
 		>[]</code
-		> specifies the class named <code
+		> specifies the class named <code class="inline-code"
 		>x</code
 		>, which matches
             certain predefined characters. See below for a full list.</dd
 	      ><dt
-	      ><code
+	      ><code class="inline-code"
 		>[^..]</code
-		> or <code
+		> or <code class="inline-code"
 		>[!..]</code
 		></dt
 	      ><dd
-	      >Like <code
+	      >Like <code class="inline-code"
 		>[..]</code
 		>, but matches any character <em
 		>not</em
 		> listed.
-                        Note that <code
+                        Note that <code class="inline-code"
 		>[^-x]</code
-		> is not the inverse of <code
+		> is not the inverse of <code class="inline-code"
 		>[-x]</code
 		>, but
-                        the range <code
+                        the range <code class="inline-code"
 		>[^-x]</code
 		>.</dd
 	      ><dt
-	      ><code
+	      ><code class="inline-code"
 		><m-n></code
 		></dt
 	      ><dd
 	      >Matches any integer in the range m to n, inclusive. The range may
-            be open-ended by leaving out either number: <code
+            be open-ended by leaving out either number: <code class="inline-code"
 		>"<->"</code
 		>, for
             instance, matches any integer.</dd
 	      ><dt
-	      ><code
+	      ><code class="inline-code"
 		>**/</code
 		></dt
 	      ><dd
@@ -176,99 +176,99 @@
 	    >Supported character classes:</p
 	    ><dl
 	    ><dt
-	      ><code
+	      ><code class="inline-code"
 		>[:alnum:]</code
 		></dt
 	      ><dd
-	      >Equivalent to <code
+	      >Equivalent to <code class="inline-code"
 		>"0-9A-Za-z"</code
 		>.</dd
 	      ><dt
-	      ><code
+	      ><code class="inline-code"
 		>[:alpha:]</code
 		></dt
 	      ><dd
-	      >Equivalent to <code
+	      >Equivalent to <code class="inline-code"
 		>"A-Za-z"</code
 		>.</dd
 	      ><dt
-	      ><code
+	      ><code class="inline-code"
 		>[:blank:]</code
 		></dt
 	      ><dd
-	      >Equivalent to <code
+	      >Equivalent to <code class="inline-code"
 		>"\t "</code
 		>.</dd
 	      ><dt
-	      ><code
+	      ><code class="inline-code"
 		>[:cntrl:]</code
 		></dt
 	      ><dd
-	      >Equivalent to <code
+	      >Equivalent to <code class="inline-code"
 		>"\0-\x1f\x7f"</code
 		>.</dd
 	      ><dt
-	      ><code
+	      ><code class="inline-code"
 		>[:digit:]</code
 		></dt
 	      ><dd
-	      >Equivalent to <code
+	      >Equivalent to <code class="inline-code"
 		>"0-9"</code
 		>.</dd
 	      ><dt
-	      ><code
+	      ><code class="inline-code"
 		>[:graph:]</code
 		></dt
 	      ><dd
-	      >Equivalent to <code
+	      >Equivalent to <code class="inline-code"
 		>"!-~"</code
 		>.</dd
 	      ><dt
-	      ><code
+	      ><code class="inline-code"
 		>[:lower:]</code
 		></dt
 	      ><dd
-	      >Equivalent to <code
+	      >Equivalent to <code class="inline-code"
 		>"a-z"</code
 		>.</dd
 	      ><dt
-	      ><code
+	      ><code class="inline-code"
 		>[:print:]</code
 		></dt
 	      ><dd
-	      >Equivalent to <code
+	      >Equivalent to <code class="inline-code"
 		>" -~"</code
 		>.</dd
 	      ><dt
-	      ><code
+	      ><code class="inline-code"
 		>[:punct:]</code
 		></dt
 	      ><dd
-	      >Equivalent to <code
+	      >Equivalent to <code class="inline-code"
 		>"!-/:-@[-`{-~"</code
 		>.</dd
 	      ><dt
-	      ><code
+	      ><code class="inline-code"
 		>[:space:]</code
 		></dt
 	      ><dd
-	      >Equivalent to <code
+	      >Equivalent to <code class="inline-code"
 		>"\t-\r "</code
 		>.</dd
 	      ><dt
-	      ><code
+	      ><code class="inline-code"
 		>[:upper:]</code
 		></dt
 	      ><dd
-	      >Equivalent to <code
+	      >Equivalent to <code class="inline-code"
 		>"A-Z"</code
 		>.</dd
 	      ><dt
-	      ><code
+	      ><code class="inline-code"
 		>[:xdigit:]</code
 		></dt
 	      ><dd
-	      >Equivalent to <code
+	      >Equivalent to <code class="inline-code"
 		>"0-9A-Fa-f"</code
 		>.</dd
 	      ></dl


=====================================
utils/haddock/html-test/ref/Bug865.html
=====================================
@@ -76,7 +76,7 @@
 	      >yes <em
 		>this</em
 		> is emphasized while this is
- <code
+ <code class="inline-code"
 		>monospaced</code
 		></a
 	      >. And here is an image:</p


=====================================
utils/haddock/html-test/ref/BundledPatterns.html
=====================================
@@ -152,7 +152,7 @@
 		>tor elements have an <strong
 		>ASCENDING</strong
 		> subscript starting from 0 and
-   ending at <code
+   ending at <code class="inline-code"
 		><code
 		  ><a href="#" title="Data.Foldable"
 		    >length</a
@@ -256,7 +256,7 @@
 		    >7
 </pre
 		  ><p
-		  >Also in conjunctions with (<code
+		  >Also in conjunctions with (<code class="inline-code"
 		    >:<</code
 		    >):</p
 		  ><pre class="screen"


=====================================
utils/haddock/html-test/ref/BundledPatterns2.html
=====================================
@@ -152,7 +152,7 @@
 		>tor elements have an <strong
 		>ASCENDING</strong
 		> subscript starting from 0 and
-   ending at <code
+   ending at <code class="inline-code"
 		><code
 		  ><a href="#" title="Data.Foldable"
 		    >length</a
@@ -238,7 +238,7 @@
 		    >7
 </pre
 		  ><p
-		  >Also in conjunctions with (<code
+		  >Also in conjunctions with (<code class="inline-code"
 		    >:<</code
 		    >):</p
 		  ><pre class="screen"


=====================================
utils/haddock/html-test/ref/Hash.html
=====================================
@@ -55,13 +55,13 @@
 	  ><ul
 	  ><li
 	    ><a href="#"
-	      >The <code
+	      >The <code class="inline-code"
 		>HashTable</code
 		> type</a
 	      ><ul
 	      ><li
 		><a href="#"
-		  >Operations on <code
+		  >Operations on <code class="inline-code"
 		    >HashTable</code
 		    >s</a
 		  ></li
@@ -69,7 +69,7 @@
 	      ></li
 	    ><li
 	    ><a href="#"
-	      >The <code
+	      >The <code class="inline-code"
 		>Hash</code
 		> class</a
 	      ></li
@@ -152,7 +152,7 @@
       ><div id="interface"
       ><a href="#" id="g:1"
 	><h1
-	  >The <code
+	  >The <code class="inline-code"
 	    >HashTable</code
 	    > type</h1
 	  ></a
@@ -167,12 +167,12 @@
 	    ></p
 	  ><div class="doc"
 	  ><p
-	    >A hash table with keys of type <code
+	    >A hash table with keys of type <code class="inline-code"
 	      >key</code
-	      > and values of type <code
+	      > and values of type <code class="inline-code"
 	      >val</code
 	      >.
- The type <code
+ The type <code class="inline-code"
 	      >key</code
 	      > should be an instance of <code
 	      ><a href="#" title="Data.Eq"
@@ -183,7 +183,7 @@
 	  ></div
 	><a href="#" id="g:2"
 	><h2
-	  >Operations on <code
+	  >Operations on <code class="inline-code"
 	    >HashTable</code
 	    >s</h2
 	  ></a
@@ -242,7 +242,7 @@
 	    ></p
 	  ><div class="doc"
 	  ><p
-	    >Looks up a key in the hash table, returns <code
+	    >Looks up a key in the hash table, returns <code class="inline-code"
 	      ><code
 		><a href="#" title="Data.Maybe"
 		  >Just</a
@@ -258,7 +258,7 @@
 	  ></div
 	><a href="#" id="g:3"
 	><h1
-	  >The <code
+	  >The <code class="inline-code"
 	    >Hash</code
 	    > class</h1
 	  ></a
@@ -290,7 +290,7 @@
 	      ></p
 	    ><div class="doc"
 	    ><p
-	      >hashes the value of type <code
+	      >hashes the value of type <code class="inline-code"
 		>a</code
 		> into an <code
 		><a href="#" title="Data.Int"


=====================================
utils/haddock/html-test/ref/Identifiers.html
=====================================
@@ -165,13 +165,13 @@
 		    ><a href="#" title="Data.List"
 		      >++</a
 		      ></code
-		    >, <code
+		    >, <code class="inline-code"
 		    >++</code
 		    >, <code
 		    ><a href="#" title="Data.Foldable"
 		      >elem</a
 		      ></code
-		    >, <code
+		    >, <code class="inline-code"
 		    >elem</code
 		    >, <code
 		    ><a href="#" title="Identifiers"
@@ -197,7 +197,7 @@
 		>Parenthesized:</p
 		><ul
 		><li
-		  >Unqualified: <code
+		  >Unqualified: <code class="inline-code"
 		    ><code
 		      ><a href="#" title="Data.List"
 			>(++)</a
@@ -205,7 +205,7 @@
 		      > [1,2,3] [4,5,6]</code
 		    ></li
 		  ><li
-		  >Qualified: <code
+		  >Qualified: <code class="inline-code"
 		    ><code
 		      ><a href="#" title="Data.List"
 			>(++)</a
@@ -217,7 +217,7 @@
 		    ><a href="#" title="Data.List"
 		      >(++)</a
 		      ></code
-		    >, <code
+		    >, <code class="inline-code"
 		    >++</code
 		    >, <code
 		    ><a href="#" title="Identifiers"
@@ -235,7 +235,7 @@
 		>Backticked:</p
 		><ul
 		><li
-		  >Unqualified: <code
+		  >Unqualified: <code class="inline-code"
 		    >1 <code
 		      ><a href="#" title="Data.Foldable"
 			>`elem`</a
@@ -243,7 +243,7 @@
 		      > [-3..3]</code
 		    ></li
 		  ><li
-		  >Qualified: <code
+		  >Qualified: <code class="inline-code"
 		    >1 <code
 		      ><a href="#" title="Data.List"
 			>`elem`</a
@@ -255,7 +255,7 @@
 		    ><a href="#" title="Data.Foldable"
 		      >`elem`</a
 		      ></code
-		    >, <code
+		    >, <code class="inline-code"
 		    >`elem`</code
 		    >, <code
 		    ><a href="#" title="Identifiers"
@@ -273,9 +273,9 @@
 		>Edge cases:</p
 		><ul
 		><li
-		  >Tuples: <code
+		  >Tuples: <code class="inline-code"
 		    >()</code
-		    >, <code
+		    >, <code class="inline-code"
 		    >(,,,)</code
 		    ></li
 		  ></ul


=====================================
utils/haddock/html-test/ref/Math.html
=====================================
@@ -53,7 +53,7 @@
 	>Description</p
 	><div class="doc"
 	><p
-	  >Math (display) for <code
+	  >Math (display) for <code class="inline-code"
 	    >normalDensity</code
 	    ></p
 	  ><p
@@ -96,7 +96,7 @@
 	    ></p
 	  ><div class="doc"
 	  ><p
-	    >Math (inline) for <code
+	    >Math (inline) for <code class="inline-code"
 	      >normalDensity</code
 	      >
  <span class="mathjax"


=====================================
utils/haddock/html-test/ref/NamespacedIdentifiers.html
=====================================
@@ -138,7 +138,7 @@
 	    ></p
 	  ><div class="doc"
 	  ><p
-	    >A link to the value <code
+	    >A link to the value <code class="inline-code"
 	      >Foo</code
 	      > (which shouldn't exist).</p
 	    ></div


=====================================
utils/haddock/html-test/ref/PatternSyns.html
=====================================
@@ -308,7 +308,7 @@
 	    ></p
 	  ><div class="doc"
 	  ><p
-	    >Doc for (<code
+	    >Doc for (<code class="inline-code"
 	      >><</code
 	      >)</p
 	    ></div


=====================================
utils/haddock/html-test/ref/PruneWithWarning.html
=====================================
@@ -57,7 +57,7 @@
 	  ><ul
 	  ><li
 	    >If a binding has a deprecation message but no documentation, it is pruned
-   when <code
+   when <code class="inline-code"
 	      >OPTIONS_HADDOCK prune</code
 	      > is used.</li
 	    ></ul


=====================================
utils/haddock/html-test/ref/Table.html
=====================================
@@ -105,7 +105,7 @@
 		><td
 		  >200</td
 		  ><td
-		  ><code
+		  ><code class="inline-code"
 		    >OK</code
 		    ></td
 		  ><td
@@ -115,7 +115,7 @@
 		><td
 		  >204</td
 		  ><td
-		  ><code
+		  ><code class="inline-code"
 		    >No Content</code
 		    ></td
 		  ><td
@@ -141,7 +141,7 @@
 		><td
 		  >200</td
 		  ><td
-		  ><code
+		  ><code class="inline-code"
 		    >OK</code
 		    ></td
 		  ><td
@@ -151,7 +151,7 @@
 		><td
 		  >204</td
 		  ><td
-		  ><code
+		  ><code class="inline-code"
 		    >No Content</code
 		    ></td
 		  ><td
@@ -161,7 +161,7 @@
 		><td
 		  >404</td
 		  ><td
-		  ><code
+		  ><code class="inline-code"
 		    >Not Found</code
 		    ></td
 		  ><td


=====================================
utils/haddock/html-test/ref/Test.html
=====================================
@@ -2248,7 +2248,7 @@ is at the beginning of the line).</pre
 		  >)</td
 		><td class="doc"
 		><p
-		  >This argument has type <code
+		  >This argument has type <code class="inline-code"
 		    >T3 Bool Bool -> T4 Float Float</code
 		    ></p
 		  ></td


=====================================
utils/haddock/html-test/ref/Threaded.html
=====================================
@@ -53,7 +53,7 @@
 	>Description</p
 	><div class="doc"
 	><p
-	  >Ensures haddock built with <code
+	  >Ensures haddock built with <code class="inline-code"
 	    >-threaded</code
 	    >.</p
 	  ></div
@@ -86,7 +86,7 @@
 	    ></p
 	  ><div class="doc"
 	  ><p
-	    ><code
+	    ><code class="inline-code"
 	      >$(forkTH)</code
 	      > fails at compile time if haddock isn't using the
  threaded RTS.</p


=====================================
utils/haddock/html-test/ref/Threaded_TH.html
=====================================
@@ -53,7 +53,7 @@
 	>Description</p
 	><div class="doc"
 	><p
-	  >Imported by <code
+	  >Imported by <code class="inline-code"
 	    >Threaded</code
 	    >, since a TH splice can't be used in the
  module where it is defined.</p
@@ -92,7 +92,7 @@
 	  ><div class="doc"
 	  ><p
 	    >forkOS requires the threaded RTS, so this TH fails if haddock was
- built without <code
+ built without <code class="inline-code"
 	      >-threaded</code
 	      >.</p
 	    ></div


=====================================
utils/haddock/html-test/ref/Unicode2.html
=====================================
@@ -79,7 +79,7 @@
 		>ü</em
 		></li
 	      ><li
-	      >inline code <code
+	      >inline code <code class="inline-code"
 		>ü</code
 		></li
 	      ><li



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f958601bdc39b1800122b6bcd0a1d42b60cf571e...7d3d9bbf13745751cb20882b86b148b8e98f77a7

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f958601bdc39b1800122b6bcd0a1d42b60cf571e...7d3d9bbf13745751cb20882b86b148b8e98f77a7
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240519/827d97af/attachment-0001.html>


More information about the ghc-commits mailing list