private void RemapLinkSecionReference() { switch (_v3Settings.FootnotesCreationMode) { case FootnotesGenerationMode.Combined: RemepLinkSectionV2Style(); if (_v3Settings.FootnotesCreationMode == FootnotesGenerationMode.Combined) { EPubV3VocabularyStyles linkStyles = new EPubV3VocabularyStyles(); linkStyles.SetType(EpubV3Vocabulary.NoteRef); _linkTargetItem.CustomAttributes.Add(linkStyles.GetAsCustomAttribute()); } break; case FootnotesGenerationMode.V2StyleSections: RemepLinkSectionV2Style(); break; case FootnotesGenerationMode.V3Footnotes: GenerateFootnotes(); break; } }
protected virtual void GenerateFootnotes() { if (_footnotes.Any()) { var group = new Div(Compatibility); EPubV3VocabularyStyles groupStyles = new EPubV3VocabularyStyles(); groupStyles.SetType(EpubV3Vocabulary.FootNotes); group.CustomAttributes.Add(groupStyles.GetAsCustomAttribute()); foreach (var footnote in _footnotes) { var aside = new Aside(Compatibility); aside.GlobalAttributes.ID.Value = footnote.Key; aside.GlobalAttributes.Class.Value = ElementStylesV3.Footnote; EPubV3VocabularyStyles attributeStyles = new EPubV3VocabularyStyles(); attributeStyles.SetType(EpubV3Vocabulary.FootNote); aside.CustomAttributes.Add(attributeStyles.GetAsCustomAttribute()); aside.Add(footnote.Value); group.Add(aside); } BodyElement.Add(group); } }
private void GenerateSingleFootnote(Anchor anchor,string targetID) { BaseXHTMLFileV3 anchorDocument = GetItemParentDocument(anchor); // get document containing anchor pointing to target ID if (anchorDocument == null) // if anchor not contained (not found) in any document { Logger.Log.Error(string.Format("Internal consistency error - anchor ({0}) for id ({1}) not contained (not found) in any document", anchor, _linkTargetItem)); return; } if (anchorDocument is FB2NotesPageSectionFile) // if anchor in FB2 Notes section (meaning link from FB2 notes to FB2 notes) no need to do anything as we do not save notes files in this mode { return; } // update reference link for an anchor, local one (without file name) anchor.HRef.Value = GenerateLocalLinkReference(targetID); // mark anchor (link reference) as note reference to make it pop-up able EPubV3VocabularyStyles linkStyles = new EPubV3VocabularyStyles(); linkStyles.SetType(EpubV3Vocabulary.NoteRef); anchor.CustomAttributes.Add(linkStyles.GetAsCustomAttribute()); // add footnote object to the same document that contains link ,so the pop up point and pop up content will be in a same document var footnoteToAdd = CreateFootnoteItemFromTargetNoteItem(targetID); anchorDocument.AddFootNote(targetID, footnoteToAdd); // if footnote target ID already exist it will not add it }