adapt to omd 2.0.0 alpha3, which adds a Table constructor
This commit is contained in:
parent
3bb8925bd3
commit
02dbe1af37
2 changed files with 25 additions and 1 deletions
|
@ -45,7 +45,7 @@ depends: [
|
||||||
"cmdliner" {>= "1.1.0"}
|
"cmdliner" {>= "1.1.0"}
|
||||||
"uri"
|
"uri"
|
||||||
"fmt" {>= "0.8.7"}
|
"fmt" {>= "0.8.7"}
|
||||||
"omd"
|
"omd" {>= "2.0.0~alpha3"}
|
||||||
"tar"
|
"tar"
|
||||||
"owee"
|
"owee"
|
||||||
"solo5-elftool" {>= "0.3.0"}
|
"solo5-elftool" {>= "0.3.0"}
|
||||||
|
|
24
lib/utils.ml
24
lib/utils.ml
|
@ -74,6 +74,30 @@ module Omd = struct
|
||||||
Some (Omd.Definition_list (attr, def_elts))
|
Some (Omd.Definition_list (attr, def_elts))
|
||||||
| Omd.Code_block _
|
| Omd.Code_block _
|
||||||
| Omd.Thematic_break _ as v -> Some v
|
| Omd.Thematic_break _ as v -> Some v
|
||||||
|
| Omd.Table (attr, inline_alignments, inlines) ->
|
||||||
|
let inline_alignments =
|
||||||
|
List.fold_left (fun acc (cell, alignment) ->
|
||||||
|
match acc with
|
||||||
|
| None -> None
|
||||||
|
| Some xs ->
|
||||||
|
Option.map (fun cell -> xs @ [ cell, alignment ])
|
||||||
|
(safe_inline cell))
|
||||||
|
(Some []) inline_alignments
|
||||||
|
in
|
||||||
|
Option.map
|
||||||
|
(fun inline_alignments ->
|
||||||
|
let inlines =
|
||||||
|
List.filter_map (fun row ->
|
||||||
|
List.fold_left (fun acc cell ->
|
||||||
|
match acc with
|
||||||
|
| None -> None
|
||||||
|
| Some xs -> Option.map (fun cell -> xs @ [ cell ])
|
||||||
|
(safe_inline cell))
|
||||||
|
(Some []) row)
|
||||||
|
inlines
|
||||||
|
in
|
||||||
|
Omd.Table (attr, inline_alignments, inlines))
|
||||||
|
inline_alignments
|
||||||
and safe_def_elts { term ; defs } =
|
and safe_def_elts { term ; defs } =
|
||||||
let defs = List.filter_map safe_inline defs in
|
let defs = List.filter_map safe_inline defs in
|
||||||
safe_inline term
|
safe_inline term
|
||||||
|
|
Loading…
Reference in a new issue