From 6148a0e0379df62aaa8fd96b895021c9928a2a23 Mon Sep 17 00:00:00 2001 From: rebortg Date: Mon, 13 Jan 2025 20:12:23 +0000 Subject: T6342: formating and delete trailing whitespace --- src/reference_tree.ml | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'src/reference_tree.ml') diff --git a/src/reference_tree.ml b/src/reference_tree.ml index fc90bcc..874991d 100644 --- a/src/reference_tree.ml +++ b/src/reference_tree.ml @@ -21,16 +21,16 @@ type completion_help_type = [@@deriving yojson] type doc_hints = { - text: string; - hint_type: string; - } [@@deriving yojson] + text: string; + hint_type: string; +} [@@deriving yojson] type docs = { - headline: string; - text: string; - usageExample: string; - hints: doc_hints list; - } [@@deriving yojson] + headline: string; + text: string; + usageExample: string; + hints: doc_hints list; +} [@@deriving yojson] type ref_node_data = { node_type: node_type; @@ -188,23 +188,19 @@ let load_docs_hints d c = let load_docs_from_xml d x = let aux d x = match x with - | Xml.Element ("headline", _, [Xml.PCData s]) -> - let new_docs = {d.docs with headline = s} in + | Xml.Element ("headline", _, [Xml.PCData s]) -> + let new_docs = {d.docs with headline = s} in {d with docs = new_docs} - | Xml.Element ("text", _, [Xml.PCData s]) -> - let new_docs = {d.docs with text = s} in + | Xml.Element ("text", _, [Xml.PCData s]) -> + let new_docs = {d.docs with text = s} in {d with docs = new_docs} - | Xml.Element ("hints", _, _) -> + | Xml.Element ("hints", _, _) -> load_docs_hints d x - | Xml.Element ("usageExample", _, [Xml.PCData s]) -> - let new_docs = {d.docs with usageExample = s} in + | Xml.Element ("usageExample", _, [Xml.PCData s]) -> + let new_docs = {d.docs with usageExample = s} in {d with docs = new_docs} | _ -> d (* Ignore unknown elements instead of raising an error *) - in - match x with - | Xml.Element ("docs", _, children) -> - List.fold_left aux d children - | _ -> d + in Xml.fold aux d x let data_from_xml d x = let aux d x = -- cgit v1.2.3