Skip to content

Bump OMD to 2.0.0~alpha1 #1321

Open
@patricoferris

Description

@patricoferris

This issue is to upgrade the OCaml scripts which use Omd to the latest version of Omd. This issue is not necessarily very straight forward, but would expose someone to a lot of OCaml code, compiler errors and working in harmony with the type checker.

The main change is in the omd abstract syntax tree (AST) -- for example in scripts/code.ml we have:

match Omd.of_string ("<pre>" ^ p ^ "</pre>") with
    | [ Omd.Html_block(_,_,o) ] -> o
    | _ -> assert false

But the AST has changed, and Omd.of_string now returns a doc type (https://github.com/ocaml/omd/blob/master/src/omd.mli#L66) so this pattern-matching with the latest Omd returns an error.

Error: This pattern matches values of type Omd.block_desc
       but a pattern was expected which matches values of type Omd.block

So we need to convert instances like this to the new AST. For most cases this isn't too bad because the new AST simply wraps most things in a block type which has a block_desc and some attributes. The fix for this line becomes:

match Omd.of_string ("<pre>" ^ p ^ "</pre>") with
    | Omd.[{ bl_desc = Html_block o; _ }] -> o
    | _ -> assert false

To start developing a solution be sure to update your version of omd i.e. opam install omd.2.0.0~alpha1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    mediumMore Complex Issues for Outreachyscripts

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions