mirror of
https://github.com/TheRealOwenRees/pgn_to_tex.git
synced 2026-11-18 04:42:07 +00:00
ci: add CI and GitHub Pages documentation workflows
This commit is contained in:
@@ -36,8 +36,8 @@ let build_title_string event title subtitle =
|
||||
| event, "", "" -> "\\title{" ^ escape_tex event ^ "}"
|
||||
| _event, title, "" -> "\\title{" ^ escape_tex title ^ "}"
|
||||
| _event, title, subtitle ->
|
||||
"\\title{" ^ escape_tex title ^ "\\\\[2ex]\\large{"
|
||||
^ escape_tex subtitle ^ "}}"
|
||||
"\\title{" ^ escape_tex title ^ "\\\\[2ex]\\large{" ^ escape_tex subtitle
|
||||
^ "}}"
|
||||
|
||||
(* Date and Site string builder *)
|
||||
let build_date_site_string date site =
|
||||
|
||||
@@ -76,11 +76,11 @@ and read_comment_clock buf =
|
||||
| clock_val ->
|
||||
let time = Utf8.lexeme buf in
|
||||
begin match%sedlex buf with
|
||||
| ']' -> begin
|
||||
match%sedlex buf with
|
||||
| ']' ->
|
||||
begin match%sedlex buf with
|
||||
| Star white_space, '}' -> CLOCK time
|
||||
| _ -> failwith "Expected closing '}' after clock comment"
|
||||
end
|
||||
end
|
||||
| _ -> failwith "Malformed clock in comment: expected ']'"
|
||||
end
|
||||
| _ -> failwith "Malformed clock value"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
type diagram_data = Pgn_to_tex_internal.Ast.diagram_data
|
||||
|
||||
let empty_diagrams = Pgn_to_tex_internal.Ast.empty_diagrams
|
||||
|
||||
let parse_diagrams_json = Pgn_to_tex_internal.Converter.parse_diagrams_json
|
||||
|
||||
let to_tex ?(diagram_data = empty_diagrams) ?(clock = false) pgn =
|
||||
|
||||
+11
-12
@@ -1,33 +1,32 @@
|
||||
(** Convert chess PGN games to LaTeX.
|
||||
|
||||
[Pgn_to_tex] is the public entry point for the library. Open it to convert
|
||||
a PGN string without referring to any internal parsing or rendering
|
||||
modules:
|
||||
[Pgn_to_tex] is the public entry point for the library. Open it to convert a
|
||||
PGN string without referring to any internal parsing or rendering modules:
|
||||
|
||||
{[
|
||||
let tex = Pgn_to_tex.to_tex pgn
|
||||
let tex = Pgn_to_tex.to_tex pgn
|
||||
]}
|
||||
|
||||
Diagrams are optional and selected by passing {!diagram_data} built with
|
||||
{!empty_diagrams} or {!parse_diagrams_json}. *)
|
||||
|
||||
type diagram_data
|
||||
(** Diagram selection data.
|
||||
|
||||
The representation is intentionally abstract; construct values with
|
||||
{!empty_diagrams} or {!parse_diagrams_json}. *)
|
||||
type diagram_data
|
||||
|
||||
val empty_diagrams : diagram_data
|
||||
(** [empty_diagrams] selects no diagrams. It is the default used by
|
||||
{!to_tex}. *)
|
||||
(** [empty_diagrams] selects no diagrams. It is the default used by {!to_tex}.
|
||||
*)
|
||||
|
||||
val parse_diagrams_json : string -> diagram_data
|
||||
(** [parse_diagrams_json json] parses diagram selections from a JSON string.
|
||||
|
||||
The input is expected to be a JSON array of objects. Each object contains
|
||||
a [fen] string and either a legacy [ply] number, a [path] array of SAN
|
||||
moves, or both. A matching [path] takes precedence; [ply] is the fallback
|
||||
for mainline positions. Malformed JSON yields {!empty_diagrams} rather than
|
||||
The input is expected to be a JSON array of objects. Each object contains a
|
||||
[fen] string and either a legacy [ply] number, a [path] array of SAN moves,
|
||||
or both. A matching [path] takes precedence; [ply] is the fallback for
|
||||
mainline positions. Malformed JSON yields {!empty_diagrams} rather than
|
||||
raising. *)
|
||||
|
||||
val to_tex : ?diagram_data:diagram_data -> ?clock:bool -> string -> string
|
||||
@@ -38,4 +37,4 @@ val to_tex : ?diagram_data:diagram_data -> ?clock:bool -> string -> string
|
||||
@param clock
|
||||
when [true], render clock times alongside diagrams; defaults to [false].
|
||||
|
||||
@raise Failure "Parse error" if [pgn] is not a valid PGN game. *)
|
||||
Raises [Failure "Parse error"] if [pgn] is not a valid PGN game. *)
|
||||
|
||||
Reference in New Issue
Block a user