Last active
August 29, 2015 14:02
-
-
Save michaelhidalgo/6f6c1c2c80c586fb7b84 to your computer and use it in GitHub Desktop.
WikiText issue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var url = @"https://vulnerabilities.teammentor.net/html/c4914e51-2609-4edc-8133-31491f1b03c0"; | |
| string response; | |
| using(var client = new WebClient()) | |
| { | |
| response = client.DownloadString(url); | |
| } | |
| if (String.IsNullOrEmpty(response)) return; | |
| response = response.Replace("<HEAD>",string.Format("<HEAD><base href='{0}' target='_blank'>", | |
| @"https://vulnerabilities.teammentor.net")); | |
| var doc = new HtmlDocument {OptionUseIdAttribute = true}; | |
| doc.LoadHtml(response); | |
| var parser = new CreoleParser(); | |
| var transformedHtml =parser.Parse(doc.GetElementbyId("rawContent") | |
| .InnerHtml); | |
| doc.GetElementbyId("guidanceItem").InnerHtml = transformedHtml; | |
| //Removing scripts and rawContent . | |
| doc.DocumentNode.Descendants() | |
| .Where(n => n.Name == "script" || n.Id == "rawContent") | |
| .ToList() | |
| .ForEach(n => n.Remove()); | |
| var rawHtml = doc.DocumentNode.OuterHtml; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment