Example #1
0
        /// <inheritdoc />
        public void GenerateTableOfContents(TocEntryCollection toc, bool includeInvisibleItems)
        {
            TocEntry entry;

            foreach (Topic t in this)
            {
                if (t.Visible || includeInvisibleItems)
                {
                    entry = new TocEntry((t.TopicFile != null) ? t.TopicFile.ContentFile.BasePathProvider : null);

                    if (t.TopicFile != null)
                    {
                        entry.SourceFile      = new FilePath(t.TopicFile.FullPath, t.TopicFile.ContentFile.BasePathProvider);
                        entry.DestinationFile = "html\\" + t.Id + ".htm";
                    }

                    entry.Id             = t.Id;
                    entry.PreviewerTitle = !String.IsNullOrEmpty(t.Title) ? t.Title :
                                           Path.GetFileNameWithoutExtension(t.TopicFilename);
                    entry.LinkText       = String.IsNullOrEmpty(t.LinkText) ? t.DisplayTitle : t.LinkText;
                    entry.Title          = t.DisplayTitle;
                    entry.IsDefaultTopic = t.IsDefaultTopic;
                    entry.ApiParentMode  = t.ApiParentMode;
                    entry.IsExpanded     = t.IsExpanded;
                    entry.IsSelected     = t.IsSelected;

                    if (t.Subtopics.Count != 0)
                    {
                        t.Subtopics.GenerateTableOfContents(entry.Children, includeInvisibleItems);
                    }

                    toc.Add(entry);
                }
            }
        }
Example #2
0
 /// <inheritdoc />
 /// <remarks>The <paramref name="includeInvisibleItems"/> parameter is ignored as site maps do not
 /// support them.</remarks>
 public void GenerateTableOfContents(TocEntryCollection toc, bool includeInvisibleItems)
 {
     foreach (TocEntry t in this)
     {
         toc.Add(t);
     }
 }
Example #3
0
        /// <summary>
        /// Generate the table of contents for the conceptual topics
        /// </summary>
        /// <param name="toc">The table of contents collection</param>
        /// <param name="pathProvider">The base path provider</param>
        public void GenerateTableOfContents(TocEntryCollection toc,
                                            IBasePathProvider pathProvider)
        {
            TocEntry entry;

            foreach (Topic t in this)
            {
                if (t.Visible)
                {
                    entry = new TocEntry(pathProvider);

                    if (t.TopicFile != null)
                    {
                        entry.SourceFile = new FilePath(t.TopicFile.FullPath,
                                                        t.TopicFile.FileItem.ProjectElement.Project);
                        entry.DestinationFile = "html\\" + t.Id + ".htm";
                    }

                    entry.Id             = t.Id;
                    entry.Title          = t.DisplayTitle;
                    entry.IsDefaultTopic = t.IsDefaultTopic;
                    entry.ApiParentMode  = t.ApiParentMode;

                    if (t.Subtopics.Count != 0)
                    {
                        t.Subtopics.GenerateTableOfContents(entry.Children, pathProvider);
                    }

                    toc.Add(entry);
                }
            }
        }
Example #4
0
 /// <summary>
 /// This is used to merge this TOC with another one
 /// </summary>
 /// <param name="toc">The table of contents collection</param>
 /// <param name="pathProvider">The base path provider</param>
 public void GenerateTableOfContents(TocEntryCollection toc,
                                     IBasePathProvider pathProvider)
 {
     foreach (TocEntry t in this)
     {
         toc.Add(t);
     }
 }
Example #5
0
        /// <inheritdoc />
        /// <remarks>The <paramref name="includeInvisibleItems"/> parameter is ignored as site maps do not
        /// support them.</remarks>
        public void GenerateTableOfContents(TocEntryCollection toc, bool includeInvisibleItems)
        {
            if (toc == null)
            {
                throw new ArgumentNullException(nameof(toc));
            }

            foreach (TocEntry t in this)
            {
                toc.Add(t);
            }
        }
Example #6
0
        //=====================================================================

        /// <summary>
        /// This will load information about the entry from the node and will also load all child nodes
        /// </summary>
        /// <param name="site">The site map node to use for this entry</param>
        public void LoadSiteMapNode(XmlNode site)
        {
            TocEntry child;

            if (site != null)
            {
                this.Title = site.Attributes["title"].Value;

                if (site.Attributes["url"] == null)
                {
                    sourceFile = new FilePath(pathProvider);
                }
                else
                {
                    sourceFile = new FilePath(site.Attributes["url"].Value,
                                              pathProvider);
                }

                if (site.Attributes["isDefault"] != null)
                {
                    this.IsDefaultTopic = true;
                }

                if (site.Attributes["isExpanded"] != null)
                {
                    this.IsExpanded = true;
                }

                if (site.Attributes["isSelected"] != null)
                {
                    this.IsSelected = true;
                }

                // Site maps only support None or After
                if (site.Attributes["splitToc"] != null)
                {
                    this.ApiParentMode = ApiParentMode.InsertAfter;
                }

                if (site.ChildNodes.Count != 0)
                {
                    foreach (XmlNode childSite in site.ChildNodes)
                    {
                        child = new TocEntry(pathProvider);
                        child.LoadSiteMapNode(childSite);
                        children.Add(child);
                    }
                }
            }
        }
Example #7
0
        //=====================================================================

        /// <summary>
        /// This will load information about the entry from the node and will
        /// also load all child nodes.
        /// </summary>
        /// <param name="site">The site map node to use for this entry</param>
        public void LoadSiteMapNode(XmlNode site)
        {
            TocEntry child;

            if (site != null)
            {
                this.Title = site.Attributes["title"].Value;

                if (site.Attributes["url"] == null)
                {
                    sourceFile = new FilePath(pathProvider);
                }
                else
                {
                    sourceFile = new FilePath(site.Attributes["url"].Value,
                                              pathProvider);
                }

                if (site.Attributes["isDefault"] != null)
                {
                    this.IsDefaultTopic = true;
                }

                // This is legacy stuff so I'm not updating it to support anything else
                if (site.Attributes["splitToc"] != null)
                {
                    this.ApiParentMode = ApiParentMode.InsertAfter;
                }

                if (site.ChildNodes.Count != 0)
                {
                    foreach (XmlNode childSite in site.ChildNodes)
                    {
                        child = new TocEntry(pathProvider);
                        child.LoadSiteMapNode(childSite);
                        children.Add(child);
                    }
                }
            }
        }