[OCaml] Mobile-friendly clone of cgit.
1
(** The repository pages: summary, commit list, file tree, blob, and commit
2
detail.
3
4
Each page is a description: it names the parts it is made of and hands them
5
to {!Layout}. Markup lives in {!Ui}, ogit's page parts in {!Components},
6
language guessing in {!Syntax}, and date formatting in {!Time_format}. *)
7
8
(** {1 Context} *)
9
10
type context
11
(** What every repository page needs to know about its subject. *)
12
13
val context : site:Layout.site -> repo:string -> description:string -> context
14
(** Build a page context from site settings and repository metadata. *)
15
16
(** {1 Commit messages} *)
17
18
type commit_message = { summary : string; body : string }
19
(** A commit message split into its first-line summary and remaining body. *)
20
21
val parse_commit_message : string option -> commit_message
22
(** Split a raw commit message into summary and body. *)
23
24
val parse_conventional : string -> string option * string
25
(** [parse_conventional summary] returns [(Some type, title)] if the summary
26
follows Conventional Commits, or [(None, summary)] otherwise. *)
27
28
(** {1 Pages} *)
29
30
val summary :
31
context -> ?readme:Resolvers.Readme.t -> unit -> Dream.response Dream.promise
32
(** The repository summary page, optionally showing a README. *)
33
34
val commits :
35
?filter_type:string ->
36
?author:string ->
37
?committer:string ->
38
?truncated:bool ->
39
page_number:int ->
40
has_prev:bool ->
41
has_next:bool ->
42
context ->
43
Resolvers.Commit.t list ->
44
Dream.response Dream.promise
45
(** The paginated commit list, with optional type/author/committer filters.
46
[truncated] adds a notice that the history walk stopped before the oldest
47
commits, so older matches may be missing. *)
48
49
val files :
50
context ->
51
(string * string) list ->
52
Resolvers.Tree.tree_node list ->
53
Dream.response Dream.promise
54
(** The file tree page. The trail is the path from root to the current
55
directory. *)
56
57
val file :
58
context ->
59
(string * string) list ->
60
Resolvers.Blob.t ->
61
Dream.response Dream.promise
62
(** A single file view with syntax highlighting or prose rendering. *)
63
64
val commit :
65
context ->
66
Resolvers.Commit.t ->
67
Resolvers.Diff.file list ->
68
Dream.response Dream.promise
69
(** The commit detail page showing metadata and a diff. *)
70