Пример #1
0
 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
     }
 }
 protected void SetClassType(HTMLItem item, string elementClassName)
 {
     item.GlobalAttributes.Class.Value = elementClassName;
 }
Пример #3
0
 /// <summary>
 /// Add item to the list of footnotes
 /// </summary>
 /// <param name="newItemId">ID item will be added (referenced) with</param>
 /// <param name="item">item to add</param>
 public void AddFootNote(string newItemId, HTMLItem item)
 {
     if (!_footnotes.ContainsKey(newItemId))
     {
         _footnotes.Add(newItemId,item);
     }
 }
Пример #4
0
 /// <summary>
 /// Add used ID to the list
 /// </summary>
 /// <param name="id">Id to list as used</param>
 /// <param name="item">item that ID belong to</param>
 /// <returns>returns and registers the id if available, empty string if ID already exists</returns>
 public string AddIdUsed(string id, HTMLItem item)
 {
     if (string.IsNullOrEmpty(id))
     {
         return id;
     }
     string newid = EnsureGoodId(id);
     if (_ids.ContainsKey(newid))
     {
         // we get here if in file same ID used twice
         // The assumption here that since the text located in FB2 main body we should not have same ID used more than once
         // otherwise we would not know how (and where to) go back
         Logger.Log.InfoFormat("item with ID {0} already defined, ignoring to avoid inconsistences", newid);
         return string.Empty;
     }
     _ids.Add(newid, item);
     return newid;
 }