StorytellerDocGen.Transformation.LinkToTransformHandler.ToAbsoluteKey C# (CSharp) Method

ToAbsoluteKey() public static method

public static ToAbsoluteKey ( string currentKey, string key ) : string
currentKey string
key string
return string
        public static string ToAbsoluteKey(string currentKey, string key)
        {
            if (key.StartsWith("./"))
            {
                var path = currentKey.Split('/').Reverse().Skip(1).Reverse().ToList();

                var parts = key.Split('/').Skip(1);
                foreach (var part in parts)
                {
                    if (part == "..")
                    {
                        path.RemoveAt(path.Count - 1);
                    }
                    else
                    {
                        path.Add(part);
                    }
                }

                return path.Join("/");
            }

            return key;
        }
    }