/// <summary> /// Passes FB2 info to the EPub file to be added at the end of the book /// </summary> /// <param name="epubFile">destination epub object</param> /// <param name="fb2File">source fb2 object</param> private void PassFb2InfoToEpub(EPubFileV3 epubFile, FB2File fb2File) { if (!Settings.ConversionSettings.Fb2Info) { return; } var infoDocument = new BaseXHTMLFileV3 { PageTitle = "FB2 Info", FileEPubInternalPath = EPubInternalPath.GetDefaultLocation(DefaultLocations.DefaultTextFolder), FileName = "fb2info.xhtml", GuideRole = GuideTypeEnum.Notes, NotPartOfNavigation = true }; var converterSettings = new ConverterOptionsV3 { CapitalDrop = false, Images = Images, MaxSize = Settings.V3Settings.HTMLFileMaxSize, ReferencesManager = _referencesManager, }; var infoConverter = new Fb2EpubInfoConverterV3(); infoDocument.Content = infoConverter.Convert(fb2File, converterSettings); epubFile.AddXHTMLFile(infoDocument); }
private void ConvertAnnotation(ItemTitleInfo titleInfo, EPubFileV3 epubFile) { if (titleInfo.Annotation != null) { epubFile.BookInformation.Description = new Description { DescInfo = titleInfo.Annotation.ToString() }; var converterSettings = new ConverterOptionsV3 { CapitalDrop = Settings.CommonSettings.CapitalDrop, Images = Images, MaxSize = Settings.V3Settings.HTMLFileMaxSize, ReferencesManager = _referencesManager, }; var annotationConverter = new AnnotationConverterV3(); var annotationPage = new AnnotationPageFileV3 { BookAnnotation = (Div)annotationConverter.Convert(titleInfo.Annotation, new AnnotationConverterParamsV3 { Settings = converterSettings, Level = 1 }) }; StructureManager.AddAnnotationPage(annotationPage); } }
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); }
private List <FB2NotesPageSectionFile> AddV2StyleFbeNotesBody(BodyItem bodyItem) { List <FB2NotesPageSectionFile> documents = new List <FB2NotesPageSectionFile>(); string docTitle = bodyItem.Name; Logger.Log.DebugFormat("Adding notes section : {0}", docTitle); var sectionDocument = new FB2NotesPageSectionFile { PageTitle = docTitle, FileEPubInternalPath = EPubInternalPath.GetDefaultLocation(DefaultLocations.DefaultTextFolder), GuideRole = GuideTypeEnum.Glossary, Content = new Div(HTMLElementType.HTML5), NavigationParent = null, NotPartOfNavigation = true, FileName = BuildSectionFileName() }; if (bodyItem.Title != null) { var converterSettings = new ConverterOptionsV3 { CapitalDrop = false, Images = _images, MaxSize = _v3Settings.HTMLFileMaxSize, ReferencesManager = _referencesManager, }; var titleConverter = new TitleConverterV3(); sectionDocument.Content.Add(titleConverter.Convert(bodyItem.Title, new TitleConverterParamsV3 { Settings = converterSettings, TitleLevel = 1 })); } documents.Add(sectionDocument); Logger.Log.Debug("Adding sub-sections"); foreach (var section in bodyItem.Sections) { documents.AddRange(AddSection(section, sectionDocument)); } return(documents); }