Example #1
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;
        }
Example #2
0
        public string GenerateTable(string ID,string SectionType)
        {
            Content table = Data.Contents.Find(m => m.ID == ID);
            List<Content> fields = Data.Contents.FindAll(m => m.ParentType == "Table" && m.ParentID == ID);

            if (table == null)
            {
                // Create placeholder
                table = new Content();
                table.Caption = "TODO: Needs caption for table " + ID;
                table.Description = "TODO: Needs description for table " + ID;
            }

            StringBuilder topic = new StringBuilder();
            topic.Append(Templates.TableTopicHead);
            topic.Replace("$2$", SectionType);
            topic.Replace("$1$", table.Caption.Replace("%", @"\%"));
            topic.Append(Templates.TableTopicIntro);
            topic.Replace("$1$", ConvertMarkdown(table.Description, "latex"));

            StringBuilder fieldlist = new StringBuilder();
            foreach (var field in fields)
            {
                var f = new StringBuilder(Templates.Field);
                f.Replace("$1$", field.Caption.Replace("%",@"\%"));
                f.Replace("$2$", ConvertMarkdown(field.Description, "latex"));
                f.Replace("$3$", field.Caption.Replace("%", @"\%"));
                var fieldentry = new StringBuilder(Templates.FieldEntry);
                fieldentry.Replace("$1$", f.ToString());
                fieldlist.Append(fieldentry);
            }
            var fieldlistsection = new StringBuilder(Templates.TableTopicFields);
            fieldlistsection.Replace("$1$", fieldlist.ToString());

            topic.Append(fieldlistsection);

            return topic.ToString();
        }