示例#1
0
 private static void SetHref(LinkItem s, ApiReferenceModel index, string currentName, ResolverContext context)
 {
     if (s == null) return;
     if (!s.IsExternalPath)
     {
         s.Href = ResolveInternalLink(index, s.Name, currentName);
     }
     else
     {
         s.Href = ResolveExternalLink(s.Name, context);
     }
 }
示例#2
0
 public static string ResolveApiHrefRelativeToCurrentApi(ApiReferenceModel index, string name, string currentApiName)
 {
     if (string.IsNullOrEmpty(name) || index == null) return name;
     ApiIndexItemModel item;
     if (index.TryGetValue(name, out item))
     {
         ApiIndexItemModel currentApi;
         if (!index.TryGetValue(currentApiName, out currentApi)) return item.Href;
         var currentHref = currentApi.Href;
         if (string.IsNullOrEmpty(currentHref)) return item.Href;
         var directoryName = Path.GetDirectoryName(currentHref);
         return PathUtility.MakeRelativePath(directoryName, item.Href);
     }
     
     // If unable to resolve the Api, return null as href
     return null;
 }
示例#3
0
 private static string ResolveInternalLink(ApiReferenceModel index, string name, string currentName)
 {
     return MetadataModelUtility.ResolveApiHrefRelativeToCurrentApi(index, name, currentName);
 }