private void AddSection(BookStructureManager bookStructureManager, SectionItem section, BaseXHTMLFileV3 navParent)
        {
            string docTitle = string.Empty;

            if (section.Title != null)
            {
                docTitle = section.Title.ToString();
            }
            Logger.Log.DebugFormat("Adding section : {0}", docTitle);
            BaseXHTMLFileV3 sectionDocument      = null;
            bool            firstDocumentOfSplit = true;
            var             converterSettings    = new ConverterOptionsV3
            {
                CapitalDrop       = _commonSettings.CapitalDrop,
                Images            = _images,
                MaxSize           = _v3Settings.HTMLFileMaxSize,
                ReferencesManager = _referencesManager,
            };
            var sectionConverter = new SectionConverterV3
            {
                LinkSection    = false,
                RecursionLevel = GetRecursionLevel(navParent),
                Settings       = converterSettings
            };

            foreach (var subitem in sectionConverter.Convert(section))
            {
                sectionDocument = new BaseXHTMLFileV3
                {
                    PageTitle            = docTitle,
                    FileEPubInternalPath = EPubInternalPath.GetDefaultLocation(DefaultLocations.DefaultTextFolder),
                    GuideRole            = (navParent == null) ? GuideTypeEnum.Text : navParent.GuideRole,
                    Content          = subitem,
                    NavigationParent = navParent,
                    FileName         = BuildSectionFileName()
                };

                if (!firstDocumentOfSplit ||
                    ((navParent != null) && navParent.NotPartOfNavigation))
                {
                    sectionDocument.NotPartOfNavigation = true;
                }
                firstDocumentOfSplit = false;
                bookStructureManager.AddBookPage(sectionDocument);
            }
            Logger.Log.Debug("Adding sub-sections");
            foreach (var subSection in section.SubSections)
            {
                AddSection(bookStructureManager, subSection, sectionDocument);
            }
        }
Esempio n. 2
0
        private List<FB2NotesPageSectionFile> AddSection(SectionItem section, BaseXHTMLFileV3 navParent)
        {
            List<FB2NotesPageSectionFile> documents = new List<FB2NotesPageSectionFile>();

            string docTitle = string.Empty;
            if (section.Title != null)
            {
                docTitle = section.Title.ToString();
            }
            Logger.Log.DebugFormat("Adding notes section : {0}", docTitle);
            FB2NotesPageSectionFile sectionDocument = null;
            bool firstDocumentOfSplit = true;
            var converterSettings = new ConverterOptionsV3
            {
                CapitalDrop = false,
                Images = _images,
                MaxSize = _v3Settings.HTMLFileMaxSize,
                ReferencesManager = _referencesManager,
            };
            var sectionConverter = new SectionConverterV3
            {
                LinkSection = true,
                RecursionLevel = GetRecursionLevel(navParent),
                Settings = converterSettings
            };
            foreach (var subitem in sectionConverter.Convert(section))
            {
                sectionDocument = new FB2NotesPageSectionFile
                {
                    PageTitle = docTitle,
                    FileEPubInternalPath = EPubInternalPath.GetDefaultLocation(DefaultLocations.DefaultTextFolder),
                    GuideRole = (navParent == null) ? GuideTypeEnum.Text : navParent.GuideRole,
                    Content = subitem,
                    NavigationParent = navParent,
                    FileName = BuildSectionFileName()
                };

                if (!firstDocumentOfSplit ||
                    ((navParent != null) && navParent.NotPartOfNavigation))
                {
                    sectionDocument.NotPartOfNavigation = true;
                }
                firstDocumentOfSplit = false;
                documents.Add(sectionDocument);
            }

            Logger.Log.Debug("Adding sub-sections");
            foreach (var subSection in section.SubSections)
            {
                documents.AddRange(AddSection(subSection, sectionDocument));
            }
            return documents;
        }
Esempio n. 3
0
 private void AddSection(EPubFileV3 epubFile, SectionItem section, BaseXHTMLFileV3 navParent, bool fbeNotesSection)
 {
     string docTitle = string.Empty;
     if (section.Title != null)
     {
         docTitle = section.Title.ToString();
     }
     Logger.Log.DebugFormat("Adding section : {0}", docTitle);
     BaseXHTMLFileV3 sectionDocument = null;
     bool firstDocumentOfSplit = true;
     var converterSettings = new ConverterOptionsV3
     {
         CapitalDrop = !fbeNotesSection && _commonSettings.CapitalDrop,
         Images = _images,
         MaxSize = _maxSize,
         ReferencesManager = _referencesManager,
     };
     var sectionConverter = new SectionConverterV3
     {
         LinkSection = fbeNotesSection,
         RecursionLevel = GetRecursionLevel(navParent),
         Settings = converterSettings
     };
     foreach (var subitem in sectionConverter.Convert(section))
     {
         sectionDocument = new BaseXHTMLFileV3
         {
             PageTitle = docTitle,
             FileEPubInternalPath = EPubInternalPath.GetDefaultLocation(DefaultLocations.DefaultTextFolder),
             GuideRole = (navParent == null) ? GuideTypeEnum.Text : navParent.GuideRole,
             Content = subitem,
             NavigationParent = navParent,
             FileName = string.Format("section{0}.xhtml", ++_sectionCounter)
         };
         if (!firstDocumentOfSplit || 
             ((navParent!= null) && navParent.NotPartOfNavigation))
         {
             sectionDocument.NotPartOfNavigation = true;
         }
         firstDocumentOfSplit = false;
         epubFile.AddXHTMLFile(sectionDocument);
     }
     Logger.Log.Debug("Adding sub-sections");
     foreach (var subSection in section.SubSections)
     {
         AddSection(epubFile, subSection, sectionDocument, fbeNotesSection);
     }
 }