diff options
Diffstat (limited to 'DocTools.cs')
-rw-r--r-- | DocTools.cs | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/DocTools.cs b/DocTools.cs index 39521c2..32f40f6 100644 --- a/DocTools.cs +++ b/DocTools.cs @@ -4,11 +4,15 @@ using System; using Monodoc; +using Monodoc.Generators; using System.IO; namespace macdoc { - public class DocTools { + public class DocTools + { + static IDocGenerator<string> generator = new HtmlGenerator (null); + public static string GetHtml (string url, HelpSource helpSource) { Node _; @@ -21,17 +25,16 @@ namespace macdoc match = null; if (helpSource != null) - htmlContent = helpSource.GetText (url, out match); - if (htmlContent == null){ + htmlContent = AppDelegate.Root.RenderUrl (url, generator, out match, helpSource); + if (htmlContent == null) { // the displayed url have a lower case type code (e.g. t: instead of T:) which confuse monodoc if (url.Length > 2 && url[1] == ':') url = char.ToUpperInvariant (url[0]) + url.Substring (1); // It may also be url encoded so decode it url = Uri.UnescapeDataString (url); - htmlContent = AppDelegate.Root.RenderUrl (url, out match); - if (htmlContent != null && match != null && match.tree != null){ - helpSource = match.tree.HelpSource; - } + htmlContent = AppDelegate.Root.RenderUrl (url, generator, out match, helpSource); + if (htmlContent != null && match != null && match.Tree != null) + helpSource = match.Tree.HelpSource; } if (htmlContent == null) return null; @@ -39,11 +42,11 @@ namespace macdoc var html = new StringWriter (); html.Write ("<html>\n<head><title>{0}</title>", url); - if (helpSource != null){ - if (helpSource.InlineCss != null) - html.Write (" <style type=\"text/css\">{0}</style>\n", helpSource.InlineCss); - if (helpSource.InlineJavaScript != null) - html.Write ("<script type=\"text/JavaScript\">{0}</script>\n", helpSource.InlineJavaScript); + if (helpSource != null) { + if (HtmlGenerator.InlineCss != null) + html.Write (" <style type=\"text/css\">{0}</style>\n", HtmlGenerator.InlineCss); + /*if (helpSource.InlineJavaScript != null) + html.Write ("<script type=\"text/JavaScript\">{0}</script>\n", helpSource.InlineJavaScript);*/ } html.Write ("</head><body>"); |