Exemplo n.º 1
0
 private XElement GenerateXmlPort(Topic t)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 2
0
        private XElement GenerateArticle(Topic t)
        {
            Article article = Data.Articles.Find(m => m.ID == t.ID);
            if (article == null)
            {
                // Create placeholder
                article = new Article();
                article.Title = "TODO: Needs an article about " + t.ID;
                article.Text = "TODO: Needs text in article " + t.ID;
            }
            XElement node = GetNode(Configuration.Parms.projectname + "_" + t.ID, article.Title, Configuration.Parms.projectname + "_" + t.ID + ".htm");

            StringBuilder topic = new StringBuilder(File.ReadAllText(Configuration.Parms.helppage_html));
            topic.Replace("$1$", article.Title);
            topic.Replace("$1$", article.Title);
            topic.Replace("$2$", ConvertMarkdown(article.Text, "html"));
            File.WriteAllText(Configuration.Parms.output_path_helpserver + @"\" +
                Configuration.Parms.projectname + "_" + t.ID + ".htm", topic.ToString());

            GenerateSubTopics(t,node);
            return node;
        }
Exemplo n.º 3
0
 private XElement GenerateExternal(Topic t)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 4
0
 public XElement GenerateTopic(Topic t)
 {
     Console.WriteLine("Generate Topic {0} ({1})", t.ID, t.Type);
     switch (t.Type)  // Table,Page,Report,XmlPort,Article,External
     {
         case "Table":
             return GenerateTable(t);
         case "Article":
             return GenerateArticle(t);
         case "Page":
             return GeneratePage(t);
         case "Report":
             return GenerateReport(t);
         case "XmlPort":
             return GenerateXmlPort(t);
         case "External":
             return GenerateExternal(t);
     }
     return null;
 }
Exemplo n.º 5
0
        public XElement GenerateTable(Topic t)
        {
            Content table = Data.Contents.Find(m => m.ID == t.ID);
            List<Content> fields = Data.Contents.FindAll(m => m.ParentType == "Table" && m.ParentID == t.ID);

            if (table == null)
            {
                // Create placeholder
                table = new Content();
                table.ID = t.ID;
                table.Caption = "TODO: Needs caption for table " + t.ID;
                table.Description = "TODO: Needs description for table " + t.ID;
            }
            XElement node = GetNode(Configuration.Parms.projectname + "_" + t.ID, table.Caption, "T_" + table.ID + ".htm");

            StringBuilder topic = new StringBuilder(File.ReadAllText(Configuration.Parms.helppage_html));
            topic.Replace("$1$", table.Caption);
            topic.Replace("$1$", table.Caption);
            StringBuilder fieldlist = new StringBuilder();
            foreach (var field in fields)
            {
                // <a href="./T_250.htm" xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
                string Fieldstr = "<a href=\"T_" + table.ID + "_" + field.ID +
                               ".htm\" xmlns=\"http://ddue.schemas.microsoft.com/authoring/2003/5\">";
                Fieldstr += field.Caption + "</a><br>";
                fieldlist.Append(Fieldstr);
                StringBuilder FieldPage = new StringBuilder(File.ReadAllText(Configuration.Parms.helppage_html));
                FieldPage.Replace("$1$", field.Caption);
                FieldPage.Replace("$1$", field.Caption);
                FieldPage.Replace("$2$", ConvertMarkdown(field.Description,"html"));
                File.WriteAllText(Configuration.Parms.output_path_helpserver + @"\" +
                "T_" + table.ID + "_" + field.ID + ".htm", FieldPage.ToString());
            }
            topic.Replace("$2$", ConvertMarkdown(table.Description, "html") + fieldlist);

            File.WriteAllText(Configuration.Parms.output_path_helpserver + @"\" +
                "T_" + table.ID + ".htm", topic.ToString());

            GenerateSubTopics(t, node);
            return node;
        }
Exemplo n.º 6
0
 public bool GenerateSubTopics(Topic t,XElement ParentNode)
 {
     if (t.SubTopics == null || t.SubTopics.Count == 0)
         return false;
     StringBuilder s = new StringBuilder();
     foreach (var sub in t.SubTopics)
     {
         Console.WriteLine("Generate SubTopic {0} ({1})", sub.ID, sub.Type);
         switch (sub.Type)  // Table,Page,Report,XmlPort,Article,External
         {
             case "Table":
                 ParentNode.Add(GenerateTable(sub));
                 break;
             case "Article":
                 ParentNode.Add(GenerateArticle(sub));
                 break;
             case "Page":
                 ParentNode.Add(GeneratePage(sub));
                 break;
             case "Report":
                 ParentNode.Add(GenerateReport(sub));
                 break;
             case "XmlPort":
                 ParentNode.Add(GenerateXmlPort(sub));
                 break;
             case "External":
                 ParentNode.Add(GenerateExternal(sub));
                 break;
         }
     }
     return true;
 }
Exemplo n.º 7
0
 public string GenerateTopic(Topic t)
 {
     Console.WriteLine("Generate Topic {0} ({1})", t.ID,t.Type);
     switch (t.Type)  // Table,Page,Report,XmlPort,Article,External
     {
         case "File":
             return GenerateFile(t.ID, "section",t.FileTitle) + GenerateSubTopics(t);
         case "Table":
             return GenerateTable(t.ID,"section") + GenerateSubTopics(t);
         case "Article":
             return GenerateArticle(t.ID, "section") + GenerateSubTopics(t);
         case "Page":
             return GeneratePage(t.ID, "section") + GenerateSubTopics(t);
         case "Report":
             return GenerateReport(t.ID, "section") + GenerateSubTopics(t);
         case "XmlPort":
             return GenerateXmlPort(t.ID, "section") + GenerateSubTopics(t);
         case "External":
             return GenerateExternal(t.ID, "section") + GenerateSubTopics(t);
     }
     return "TODO:";
 }
Exemplo n.º 8
0
 public string GenerateSubTopics(Topic t)
 {
     StringBuilder s = new StringBuilder();
     foreach (var sub in t.SubTopics)
     {
         Console.WriteLine("Generate SubTopic {0} ({1})", sub.ID, sub.Type);
         switch (sub.Type)  // Table,Page,Report,XmlPort,Article,External
         {
             case "File":
                 s.Append(GenerateFile(t.ID, "section", t.FileTitle));
                 break;
             case "Table":
                 s.Append(GenerateTable(sub.ID,"subsection"));
                 break;
             case "Article":
                 s.Append(GenerateArticle(sub.ID, "subsection"));
                 break;
             case "Page":
                 s.Append(GeneratePage(sub.ID,"subsection"));
                 break;
             case "Report":
                 s.Append(GenerateReport(sub.ID, "subsection"));
                 break;
             case "XmlPort":
                 s.Append(GenerateXmlPort(sub.ID, "subsection"));
                 break;
             case "External":
                 s.Append(GenerateExternal(sub.ID, "subsection"));
                 break;
         }
     }
     return s.ToString();
 }