commit 8b13561ae6eb66cae48c3dfe64aa9995373fa8ba
parent debe5f4492cd65041598b05308a0e92c7e9a39e2
Author: Andrew Laack <andrew@laack.co>
Date: Sun, 6 Sep 2026 09:28:36 -0500
Started adding ocamldoc comments
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/learning/lib/parser.ml b/learning/lib/parser.ml
@@ -12,6 +12,7 @@ type line_format =
| Link
| ListItem
+(** [line_format_map format] returns a pair where the first element is the [format] as a string and the second element is the number of characters that format removes from the prefix of a line. *)
let line_format_map format =
match format with
| Normal -> ("Normal", 0)
@@ -25,15 +26,20 @@ let line_format_map format =
| Link -> ("Link", 3)
| ListItem -> ("ListItem", 2)
+(** [line_format_str format] takes as input a line format pair and returns the string element. *)
let line_format_str format = fst (line_format_map format)
+
+(** [line_format_char_cut format] takes as input a line format pair and returns the element describing how many characters to cut from the prefix of the line. *)
let line_format_char_cut format = snd (line_format_map format)
type page_line = { content : string; line_type : line_format }
+(** [permute_line line line_type] returns a copy of the [line] after applying the corresponding changes the [line_type] imparts on lines of that format. *)
let permute_line line line_type =
let cut = line_format_char_cut line_type in
String.sub line cut (String.length line - cut)
+(**[is_hidden line preformatted] checks if [line] is a hidden line type. *)
let is_hidden line preformatted =
if
(not preformatted)
@@ -44,6 +50,7 @@ let is_hidden line preformatted =
then true
else false
+(**[is_list line preformatted] checks if [line] is a list line type. *)
let is_list line preformatted =
if
(not preformatted)