Skip to content

Commit a0ee638

Browse files
committed
Render man page links with labels.
1 parent d59e659 commit a0ee638

File tree

3 files changed

+1009
-1008
lines changed

3 files changed

+1009
-1008
lines changed

RegistryProcessor/src/Main.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,12 @@ showCommand api c =
234234
([showSignatureElement withComment False t | t <- paramTypes c] ++
235235
[showSignatureElement withComment True (resultType c)])
236236
urls = M.findWithDefault [] (api, CommandName name) manPageURLs
237-
links = L.intercalate ", " (map renderURL urls) ++ "\n"
237+
links = L.intercalate " or " (map renderURL urls) ++ "\n"
238238
man = case urls of
239239
[] -> ""
240-
[_] -> "-- | Manual page: " ++ links
241-
_ -> "-- | Manual pages: " ++ links
242-
renderURL u = "<" ++ u ++ ">"
240+
[_] -> "-- | Manual page for " ++ links
241+
_ -> "-- | Manual pages for " ++ links
242+
renderURL (u, l) = "<" ++ u ++ " " ++ l ++ ">"
243243

244244
showSignatureElement :: Bool -> Bool -> SignatureElement -> String
245245
showSignatureElement withComment isResult sigElem = el ++ comment

RegistryProcessor/src/ManPages.hs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ import MangledRegistry ( API(..), CommandName(..) )
77

88
type ManPageKey = (API, CommandName)
99
type URL = String
10+
type Label = String
1011

11-
assocsGL2 :: [(ManPageKey, [URL])]
12+
assocsGL2 :: [(ManPageKey, [(URL, Label)])]
1213
assocsGL2 =
13-
entriesFor "gl" "https://www.opengl.org/sdk/docs/man2/xhtml/" ".xml" [
14+
entriesFor "gl" "OpenGL 2.x" "https://www.opengl.org/sdk/docs/man2/xhtml/" ".xml" [
1415
("glAccum", "glAccum"),
1516
("glActiveTexture", "glActiveTexture"),
1617
("glAlphaFunc", "glAlphaFunc"),
@@ -655,9 +656,9 @@ assocsGL2 =
655656
("glWindowPos3dv", "glWindowPos")
656657
]
657658

658-
assocsGLX1 :: [(ManPageKey, [URL])]
659+
assocsGLX1 :: [(ManPageKey, [(URL, Label)])]
659660
assocsGLX1 =
660-
entriesFor "glx" "https://www.opengl.org/sdk/docs/man2/xhtml/" ".xml" [
661+
entriesFor "glx" "GLX 1.x" "https://www.opengl.org/sdk/docs/man2/xhtml/" ".xml" [
661662
("glXChooseFBConfig", "glXChooseFBConfig"),
662663
("glXChooseVisual", "glXChooseVisual"),
663664
("glXCopyContext", "glXCopyContext"),
@@ -703,9 +704,9 @@ assocsGLX1 =
703704
("glXWaitX", "glXWaitX")
704705
]
705706

706-
assocsGL3 :: [(ManPageKey, [URL])]
707+
assocsGL3 :: [(ManPageKey, [(URL, Label)])]
707708
assocsGL3 =
708-
entriesFor "gl" "https://www.opengl.org/sdk/docs/man3/xhtml/" ".xml" [
709+
entriesFor "gl" "OpenGL 3.x" "https://www.opengl.org/sdk/docs/man3/xhtml/" ".xml" [
709710
("glActiveTexture", "glActiveTexture"),
710711
("glAttachShader", "glAttachShader"),
711712
("glBeginConditionalRender", "glBeginConditionalRender"),
@@ -1080,9 +1081,9 @@ assocsGL3 =
10801081
("glWaitSync", "glWaitSync")
10811082
]
10821083

1083-
assocsGL4 :: [(ManPageKey, [URL])]
1084+
assocsGL4 :: [(ManPageKey, [(URL, Label)])]
10841085
assocsGL4 =
1085-
entriesFor "gl" "https://www.opengl.org/sdk/docs/man4/html/" ".xhtml" [
1086+
entriesFor "gl" "OpenGL 4.x" "https://www.opengl.org/sdk/docs/man4/html/" ".xhtml" [
10861087
("glActiveShaderProgram", "glActiveShaderProgram"),
10871088
("glActiveTexture", "glActiveTexture"),
10881089
("glAttachShader", "glAttachShader"),
@@ -1696,12 +1697,12 @@ assocsGL4 =
16961697
("glWaitSync", "glWaitSync")
16971698
]
16981699

1699-
entriesFor :: String -> String -> String -> [(String, String)] -> [(ManPageKey, [URL])]
1700-
entriesFor api baseURL extension assocs =
1701-
[ ((API api, CommandName n), [baseURL ++ u ++ extension])
1700+
entriesFor :: String -> Label -> String -> String -> [(String, String)] -> [(ManPageKey, [(URL, Label)])]
1701+
entriesFor api label baseURL extension assocs =
1702+
[ ((API api, CommandName n), [(baseURL ++ u ++ extension, label)])
17021703
| (n, u) <- assocs ]
17031704

1704-
manPageURLs :: M.Map ManPageKey [URL]
1705+
manPageURLs :: M.Map ManPageKey [(URL, Label)]
17051706
manPageURLs =
17061707
M.fromListWith (++) .
17071708
concat $

0 commit comments

Comments
 (0)