internalId = null;
context = null;
+ if (url == "root:") {
+ context = new Dictionary<string, string> { {"specialpage", "master-root"} };
+ internalId = url;
+ node = null;
+ // We return the first help source available since the generator will simply fetch this RootTree instance through it
+ return helpSources.FirstOrDefault ();
+ }
if (url.StartsWith (RootNamespace, StringComparison.OrdinalIgnoreCase)) {
context = new Dictionary<string, string> { {"specialpage", "root"} };
return this.GetHelpSourceAndIdFromName (url.Substring (RootNamespace.Length), out internalId, out node);
public string Generate (HelpSource hs, string id, Dictionary<string, string> context)
{
+ string specialPage;
+ if (context != null && context.TryGetValue ("specialpage", out specialPage) && specialPage == "master-root")
+ return GenerateMasterRootPage (hs != null ? hs.RootTree : null);
+
if (hs == null || string.IsNullOrEmpty (id))
return MakeHtmlError (string.Format ("Your request has found no candidate provider [hs=\"{0}\", id=\"{1}\"]",
hs == null ? "(null)" : hs.Name, id ?? "(null)"));
return sb.ToString ();
}
+ string GenerateMasterRootPage (RootTree rootTree)
+ {
+ if (rootTree == null)
+ return string.Empty;
+ var assembly = System.Reflection.Assembly.GetAssembly (typeof (HtmlGenerator));
+ var hpStream = assembly.GetManifestResourceStream ("home.html");
+ var home = new StreamReader (hpStream).ReadToEnd ();
+ var links = string.Join (Environment.NewLine,
+ rootTree.RootNode.ChildNodes.Select (n => string.Format ("<li><a href=\"{0}\">{1}</a></li>", n.Element, n.Caption)));
+ return home.Replace ("@@API_DOCS@@", links);
+ }
+
public static string InlineCss {
get {
if (css_code != null)
+<html>
<head>
-<style type="text/css">
-/* GENERAL */
-
-body, table {
- font-family: @@FONT_FAMILY@@, sans-serif;
- font-size: @@FONT_SIZE@@%;
-}
-
-/* ECMA BLOCK */
-#docs {
- margin-bottom: 1em;
-}
-
-/* CONTRIBUTIONS */
-#contrib {
- margin-top: 2em;
- width: 98%;
- margin-left: 1%;
- color: black;
- background: #fff3f3;
- border: 1px solid #ffc9c9;
- @@EDITING_ENABLED@@
- }
-#contribTitle {
- text-align: left;
- font-weight: bold;
- padding: .4em;
- font-size: 110%;
- @@CONTRIB_DISP@@
-}
-#contrib #content {
- padding: .4em;
-}
-#some-contrib {
- @@CONTRIB_DISP@@
-}
-#no-contrib {
- @@NO_CONTRIB_DISP@@
-}
-#contrib p {
- text-indent: 1em;
- text-align: justify;
- }
-</style>
<link type="text/css" rel="stylesheet" href="mono-ecma.css"/>
</head>
-<div class="Content">
- <p>The following documentation collections are available:
+<body>
+ <div class="Content">
+ <p>The following documentation collections are available:</p>
- <div id="docs">
- <ul>
+ <div id="docs">
+ <ul>
@@API_DOCS@@
- </ul>
- </div>
-
- <div id="contrib">
- <div id="contribTitle">Contributions</div>
- <div id="content">
- <div id="some-contrib">
- @@CONTRIBS@@
- </div>
- <div id="no-contrib">
- <p><b>You have not made any contributions yet.</b></p>
- <p>The Documentation of the libraries is not complete and your contributions would be greatly appreciated. The procedure is easy, browse to the part of the documentation you want to contribute to and click on the <font color="blue">[Edit]</font> link to start writing documentation.</p>
- <p>When you are happy with your changes, use the Contributing--> Upload Contribution--> menu to send your contributions to our server.</p></div> </div>
+ </ul>
+ </div>
</div>
-</div>
+</body>
+</html>