Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Charles Southerland
frama-c
Commits
a685b19a
Commit
a685b19a
authored
5 years ago
by
Loïc Correnson
Browse files
Options
Downloads
Patches
Plain Diff
[server] index by categories
parent
0035db92
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/server/doc.ml
+38
-12
38 additions, 12 deletions
src/plugins/server/doc.ml
with
38 additions
and
12 deletions
src/plugins/server/doc.ml
+
38
−
12
View file @
a685b19a
...
@@ -120,17 +120,42 @@ let table_of_contents () =
...
@@ -120,17 +120,42 @@ let table_of_contents () =
(
fun
p
->
table_of_chapter
(
`Plugin
p
))
(
fun
p
->
table_of_chapter
(
`Plugin
p
))
(
List
.
sort
String
.
compare
!
plugins
))
(
List
.
sort
String
.
compare
!
plugins
))
module
Cmap
=
Map
.
Make
(
struct
type
t
=
string
list
let
compare
=
Pervasives
.
compare
end
)
let
index_entry
(
title
,
href
)
=
text
@@
Markdown
.
href
~
text
:
(
plain
title
)
href
let
index
()
=
let
index
()
=
List
.
map
let
category
name
=
(
fun
(
title
,
entry
)
->
Markdown
.
href
~
text
:
(
plain
title
)
entry
)
match
List
.
rev
(
String
.
split_on_char
'.'
name
)
with
(
List
.
sort
|
[]
->
[]
(
fun
(
e1
,
_
)
(
e2
,
_
)
->
|
_
::
rpath
->
List
.
rev
rpath
in
let
entry
e
=
let
cmap
=
match
List
.
rev
(
String
.
split_on_char
'.'
e
)
with
List
.
fold_left
|
[]
->
[]
,
e
(
fun
cs
entry
->
|
a
::
rpath
->
List
.
rev
rpath
,
a
let
c
=
category
(
fst
entry
)
in
in
Pervasives
.
compare
(
entry
e1
)
(
entry
e2
))
let
es
=
try
Cmap
.
find
c
cs
with
Not_found
->
[]
in
!
entries
)
Cmap
.
add
c
(
entry
::
es
)
cs
)
Cmap
.
empty
!
entries
in
let
by_name
(
a
,_
)
(
b
,_
)
=
String
.
compare
a
b
in
let
categories
=
Cmap
.
fold
(
fun
c
es
ces
->
(
c
,
List
.
sort
by_name
es
)
::
ces
)
cmap
[]
in
begin
List
.
fold_left
(
fun
elements
(
c
,
es
)
->
let
entries
=
Block
(
list
@@
List
.
map
index_entry
es
)
::
elements
in
if
c
=
[]
then
entries
else
let
cname
=
String
.
concat
"."
c
in
let
title
=
Printf
.
sprintf
"Index of `%s`"
cname
in
H3
(
plain
title
,
None
)
::
entries
)
[]
categories
end
let
link
~
toc
~
title
~
href
:
json
=
let
link
~
toc
~
title
~
href
:
json
=
let
link
=
[
"title"
,
`String
title
;
"href"
,
`String
href
]
in
let
link
=
[
"title"
,
`String
title
;
"href"
,
`String
href
]
in
...
@@ -200,8 +225,9 @@ let dump ~root ?(meta=true) () =
...
@@ -200,8 +225,9 @@ let dump ~root ?(meta=true) () =
@
@
table_of_contents
()
table_of_contents
()
@
@
[
H2
(
plain
"Index"
,
None
);
[
H2
(
plain
"Index"
,
None
)]
Block
(
list
(
List
.
map
text
(
index
()
)))]
@
index
()
in
in
let
title
=
"Documentation"
in
let
title
=
"Documentation"
in
pp_one_page
~
root
~
page
:
"readme.md"
~
title
body
pp_one_page
~
root
~
page
:
"readme.md"
~
title
body
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment