5 using System.Collections.Generic;
9 namespace Monodoc.Generators
12 /// This generators returns the raw content of the HelpSource without any transformation
14 public class RawGenerator : IDocGenerator<string>
16 public string Generate (HelpSource hs, string id, Dictionary<string, string> context)
18 if (hs == null || string.IsNullOrEmpty (id))
21 IEnumerable<string> parts;
22 if (hs.IsMultiPart (id, out parts))
23 return GenerateMultiPart (hs, parts, id, context);
25 if (hs.IsRawContent (id))
26 return hs.GetText (id) ?? string.Empty;
28 var result = hs.IsGeneratedContent (id) ? hs.GetCachedText (id) : new StreamReader (hs.GetCachedHelpStream (id)).ReadToEnd ();
33 string GenerateMultiPart (HelpSource hs, IEnumerable<string> ids, string originalId, Dictionary<string, string> context)
35 var sb = new StringBuilder ();
36 foreach (var id in ids)
37 sb.AppendLine (Generate (hs, id, context));
38 return sb.ToString ();