Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the list of opened elements to report #75

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

craff
Copy link

@craff craff commented Jul 17, 2023

This could help with issue #74.

@craff
Copy link
Author

craff commented Jul 17, 2023

We could use report/detailed_report to avoid mapping the list of open_elements at each report if detailed_report is not demanded by the user ?

@craff
Copy link
Author

craff commented Jul 17, 2023

Here is an example of use!

let parse_html ~dynamic ~filename s =
  let detailed_report opens (line,col) err =
    match opens, err with
    | ((_,"ml"), _, _)::_, (`Bad_token _ | `Bad_content _) -> ()
    | _ ->
       Printf.eprintf "File %S, line %d, characters %d:\n %s\n%!"
         filename line col (Error.to_string err);
       exit 1;
  in
  let element = element ~dynamic ~filename in
  let context = if dynamic then Some `Document else None in
  s |> parse_html ~detailed_report ?context |>
    trees_with_loc ~element ~text ~comment ~pi ~xml ~doctype

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant