@@ -58,9 +58,19 @@ type Help =
5858
5959let cleanupXmlContent ( s : string ) = s.Replace( " \n " , " \n " ) .Trim() // some stray whitespace from the XML
6060
61+ // remove any leading `X:` and trailing `N
62+ let trimDotNet ( s : string ) =
63+ let s = if s.Length > 2 && s[ 1 ] = ':' then s.Substring( 2 ) else s
64+ let idx = s.IndexOf( '`' )
65+ let s = if idx > 0 then s.Substring( 0 , idx) else s
66+ s
67+
6168let xmlDocCache = Collections.Generic.Dictionary< string, XmlDocument>()
6269
6370let getXmlDocument xmlPath =
71+ #if DEBUG
72+ printfn $" xml file: %s {xmlPath}"
73+ #endif
6474 match xmlDocCache.TryGetValue( xmlPath) with
6575 | true , value -> value
6676 | _ ->
@@ -70,6 +80,22 @@ let getXmlDocument xmlPath =
7080 xmlDocCache.Add( xmlPath, xmlDocument)
7181 xmlDocument
7282
83+ let getTexts ( node : Xml.XmlNode ) =
84+ seq {
85+ for child in node.ChildNodes do
86+ if child.Name = " #text" then
87+ yield child.Value
88+
89+ if child.Name = " c" then
90+ yield child.InnerText
91+
92+ if child.Name = " see" then
93+ let cref = child.Attributes.GetNamedItem( " cref" )
94+
95+ if not ( isNull cref) then
96+ yield cref.Value |> trimDotNet
97+ }
98+ |> String.concat " "
7399
74100let helpText ( xmlPath : string ) ( assembly : string ) ( modName : string ) ( implName : string ) ( sourceName : string ) =
75101 let sourceName = sourceName.Replace( '.' , '#' ) // for .ctor
@@ -103,13 +129,13 @@ let helpText (xmlPath: string) (assembly: string) (modName: string) (implName: s
103129 let summary =
104130 n.SelectSingleNode( " summary" )
105131 |> Option.ofObj
106- |> Option.map _. InnerText
132+ |> Option.map getTexts
107133 |> Option.map cleanupXmlContent
108134
109135 let remarks =
110136 n.SelectSingleNode( " remarks" )
111137 |> Option.ofObj
112- |> Option.map _. InnerText
138+ |> Option.map getTexts
113139 |> Option.map cleanupXmlContent
114140
115141 let parameters =
@@ -119,7 +145,9 @@ let helpText (xmlPath: string) (assembly: string) (modName: string) (implName: s
119145 |> List.ofSeq
120146
121147 let returns =
122- n.SelectSingleNode( " returns" ) |> Option.ofObj |> Option.map _. InnerText.Trim()
148+ n.SelectSingleNode( " returns" )
149+ |> Option.ofObj
150+ |> Option.map ( fun n -> getTexts( n) .Trim())
123151
124152 let exceptions =
125153 n.SelectNodes( " exception" )
0 commit comments