mirror of
https://github.com/TheRealOwenRees/pgn_to_tex.git
synced 2026-11-18 04:42:07 +00:00
feat: add public Pgn_to_tex entry point
Move parsing and rendering internals into the private pgn_to_tex_internal library and rename pgn2tex to converter. Expose only Pgn_to_tex with default to_tex arguments, abstract diagram_data, empty_diagrams, and parse_diagrams_json. Update tests, JS bridge, and README to the new names.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
## Usage
|
||||
|
||||
```ocaml
|
||||
open Pgn_logic
|
||||
open Pgn_to_tex
|
||||
|
||||
let diagrams_json_stringified =
|
||||
{| [
|
||||
@@ -18,9 +18,9 @@ let diagrams_json_stringified =
|
||||
{"ply":4,"fen":"rnbqkbnr/ppp1pppp/3p4/8/3PP3/8/PPP2PPP/RNBQKBNR b KQkq - 0 3","path":["d4","d5","e4","d6"]}
|
||||
] |}
|
||||
|
||||
let diagram_data = Pgn2tex.parse_diagrams_json diagrams_json_stringified
|
||||
let diagram_data = parse_diagrams_json diagrams_json_stringified
|
||||
|
||||
let game_tex = Pgn2tex.to_tex pgn ~diagram_data ~clock:false
|
||||
let game_tex = to_tex ~diagram_data ~clock:false pgn
|
||||
```
|
||||
|
||||
This will return a LaTex markdown representation of the PGN file along with chess board diagrams at the specified ply. Clock times can be rendered for both sides if you pass `~clock:true` to the `to_tex` function.
|
||||
|
||||
Reference in New Issue
Block a user