Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 2
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);
                }
            }
        }