public void RemapAnchors(BookStructureManager structureManager) { var listToRemove = new List <string>(); foreach (var link in _references) { if (!ReferencesUtils.IsExternalLink(link.Key)) { if (IsIdUsed(link.Key)) { RemapInternalLink(structureManager, link); } else { listToRemove.Add(link.Key); RemoveInvalidAnchor(link); } } } // Remove the unused anchor (and their ID if they have one) // from the lists foreach (var toRemove in listToRemove) { _references.Remove(toRemove); } }
public LinkReMapperV2(KeyValuePair <string, List <Anchor> > link, Dictionary <string, IHTMLItem> ids, BookStructureManager structureManager) { _link = link; _structureManager = structureManager; _idString = ReferencesUtils.GetIdFromLink(link.Key); // Get ID of a link target; _linkTargetItem = ids[_idString]; // get object targeted by link _linkTargetDocument = GetIDParentDocument(structureManager, _linkTargetItem); // get parent document (file) containing targeted object if (_linkTargetDocument != null) { _linkParentContainer = DetectItemParentContainer(_linkTargetItem); // get parent container of link target item } }
public LinkReMapperV3(KeyValuePair <string, List <Anchor> > link, IDictionary <string, HTMLItem> ids, BookStructureManager structureManager, IEPubV3Settings v3Settings) { _link = link; _ids = ids; _v3Settings = v3Settings; _structureManager = structureManager; _idString = ReferencesUtils.GetIdFromLink(link.Key); // Get ID of a link target; _linkTargetItem = ids[_idString]; // get object targeted by link _linkTargetDocument = GetItemParentDocument(_linkTargetItem); // get parent document (file) containing targeted object if (_linkTargetDocument != null) // if link target container document (document containing item with ID we jump to) found { _linkParentContainer = DetectItemParentContainer(_linkTargetItem); // get parent container of link target item } }
private void RemapInternalLink(BookStructureManager structureManager, KeyValuePair <string, List <Anchor> > link) { var linkRemaper = new LinkReMapperV2(link, _ids, structureManager); linkRemaper.Remap(); }
private BaseXHTMLFileV2 GetIDParentDocument(BookStructureManager structureManager, IHTMLItem value) { return(structureManager.GetItemParentDocument(value) as BaseXHTMLFileV2); }