From db82e835785ac50e5cfda5f1fd8e871130869c59 Mon Sep 17 00:00:00 2001 From: Anton Bachin Date: Wed, 5 Oct 2016 16:51:24 -0500 Subject: [PATCH] Minimize markup in variand and field descriptions. ocsigen.org's styles and parser currently assume that variand and field descriptions are simple preformatted comment strings. Meanwhile, wikidoc, like ocamldoc, expects the descriptions to be table cells with full documentation styling and block content. This commit changes wikidoc to output the descriptions as text close to what is written in the source code, inserting much less markup. --- src/odoc_wiki/odoc_wiki.ml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/odoc_wiki/odoc_wiki.ml b/src/odoc_wiki/odoc_wiki.ml index 2827d2c..2e6f418 100644 --- a/src/odoc_wiki/odoc_wiki.ml +++ b/src/odoc_wiki/odoc_wiki.ml @@ -536,10 +536,16 @@ class virtual info = @param indent can be specified not to use the style of info comments; default is [true]. *) - method html_of_info ?(indent=true) b info_opt = + method html_of_info ?(no_markup=false) ?(indent=true) b info_opt = match info_opt with None -> () + | Some info when no_markup -> + ( + match info.Odoc_info.i_desc with + None -> () + | Some d -> bs b (self#escape (Odoc_text.Texter.string_of_text d)) + ) | Some info -> let module M = Odoc_info in if indent then bs b "<
bs b "<> <><>"; bs b ">>"; ); @@ -1263,7 +1269,7 @@ class wiki = | Some t -> bs b "<> <><>"; bs b ">>"; ); @@ -1490,7 +1496,7 @@ class wiki = if info then ( if complete then - self#html_of_info ~indent: false + self#html_of_info ?no_markup: None ~indent: false else self#html_of_info_first_sentence ) b m.m_info @@ -1521,7 +1527,7 @@ class wiki = if info then ( if complete then - self#html_of_info ~indent: false + self#html_of_info ?no_markup: None ~indent: false else self#html_of_info_first_sentence ) b mt.mt_info @@ -1678,7 +1684,7 @@ class wiki = bs b ">>" ; ( if complete then - self#html_of_info ~indent: false + self#html_of_info ?no_markup: None ~indent: false else self#html_of_info_first_sentence ) b c.cl_info @@ -1721,7 +1727,7 @@ class wiki = bs b ">>"; ( if complete then - self#html_of_info ~indent: false + self#html_of_info ?no_markup: None ~indent: false else self#html_of_info_first_sentence ) b ct.clt_info