private void AddSection(BookStructureManager bookStructureManager, SectionItem section, BaseXHTMLFileV2 navParent, bool fbeNotesSection) { string docTitle = string.Empty; if (section.Title != null) { docTitle = section.Title.ToString(); } Logger.Log.DebugFormat("Adding section : {0}", docTitle); BaseXHTMLFileV2 sectionDocument = null; bool firstDocumentOfSplit = true; var converterSettings = new ConverterOptionsV2 { CapitalDrop = !fbeNotesSection && _commonSettings.CapitalDrop, Images = _images, MaxSize = _maxSize, ReferencesManager = _referencesManager, }; var sectionConverter = new SectionConverterV2 { LinkSection = fbeNotesSection, RecursionLevel = GetRecursionLevel(navParent), Settings = converterSettings }; foreach (var subitem in sectionConverter.Convert(section)) { sectionDocument = new BaseXHTMLFileV2 { PageTitle = docTitle, FileEPubInternalPath = EPubInternalPath.GetDefaultLocation(DefaultLocations.DefaultTextFolder), GuideRole = (navParent == null) ? GuideTypeEnum.Text : navParent.GuideRole, Type = (navParent == null) ? SectionTypeEnum.Text : navParent.Type, Content = subitem, NavigationParent = navParent, FileName = string.Format("section{0}.xhtml", ++_sectionCounter) }; if (!firstDocumentOfSplit || (sectionDocument.Type == SectionTypeEnum.Links)) { sectionDocument.NotPartOfNavigation = true; } firstDocumentOfSplit = false; bookStructureManager.AddBookPage(sectionDocument); } Logger.Log.Debug("Adding sub-sections"); foreach (var subSection in section.SubSections) { AddSection(bookStructureManager, subSection, sectionDocument, fbeNotesSection); } }
private void AddSection(EPubFileV2 epubFile, SectionItem section, BaseXHTMLFileV2 navParent, bool fbeNotesSection) { string docTitle = string.Empty; if (section.Title != null) { docTitle = section.Title.ToString(); } Logger.Log.DebugFormat("Adding section : {0}", docTitle); BaseXHTMLFileV2 sectionDocument = null; bool firstDocumentOfSplit = true; var converterSettings = new ConverterOptionsV2 { CapitalDrop = !fbeNotesSection && _commonSettings.CapitalDrop, Images = _images, MaxSize = _maxSize, ReferencesManager = _referencesManager, }; var sectionConverter = new SectionConverterV2 { LinkSection = fbeNotesSection, RecursionLevel = GetRecursionLevel(navParent), Settings = converterSettings }; foreach (var subitem in sectionConverter.Convert(section)) { sectionDocument = new BaseXHTMLFileV2 { PageTitle = docTitle, FileEPubInternalPath = EPubInternalPath.GetDefaultLocation(DefaultLocations.DefaultTextFolder), GuideRole = (navParent == null) ? GuideTypeEnum.Text : navParent.GuideRole, Type = (navParent == null) ? SectionTypeEnum.Text : navParent.Type, Content = subitem, NavigationParent = navParent, FileName = string.Format("section{0}.xhtml", ++_sectionCounter) }; if (!firstDocumentOfSplit || (sectionDocument.Type == SectionTypeEnum.Links)) { 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); } }