Esempio n. 1
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. 2
0
        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);
        }
Esempio n. 3
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. 4
0
        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;
        }