internal UrlPostProcessorContext(ParsingContext context, LinkReference reference, SiteInfo siteInfo, Uri url) { Context = context; SiteInfo = siteInfo; Reference = reference; // Proxy internal fields Label = reference.Label; IsImage = reference.IsImage; IsCleanUrl = reference.IsCleanUrl; IsAutoLink = reference.IsAutoLink; IsNamedReferenceLink = reference.IsNamedReferenceLink; Url = new CleanUrl(url); UrlFragment = url.Fragment; Configuration = Context.Configuration; WebIO = Context.WebIO; }
public static bool TryGetRawUserContentUrl(CleanUrl url, out Uri rawContentUrl) { rawContentUrl = null; string path = url.Url.AbsolutePath; if (path.Length < 11) { return(false); } int repositoryNameIndex = path.IndexOf('/', 1); if (repositoryNameIndex == -1) { return(false); } int linkTypeIndex = path.IndexOf('/', repositoryNameIndex + 1); if (linkTypeIndex == -1) { return(false); } if (path.Length < linkTypeIndex - 8) { return(false); } linkTypeIndex++; if (!path.OrdinalEqualsAtIndex("blob", linkTypeIndex)) { return(false); } rawContentUrl = new Uri(string.Concat("https://raw.githubusercontent.com", path.Substring(0, linkTypeIndex), path.Substring(linkTypeIndex + 5))); return(true); }
private bool IsDocumentationUrl(CleanUrl url) { return(url.AbsoluteUrlWithoutFragment.EndsWith("core.telegram.org/bots/api", StringComparison.OrdinalIgnoreCase)); }