public void SgmlTest1(HtmlProcessor filter, string blog, int topic) { ValueDictionary parameters = new ValueDictionary(); parameters["link-domain"] = "starcafe.ru"; parameters["link-redirect"] = "http://starcafe.ru/redirect"; parameters["url"] = String.Format("http://starcafe.ru/blog/{0}/{1}.html", blog, topic); using (StreamReader sr = new StreamReader( Path.Combine(Environment.CurrentDirectory, "sgml-test.htm"), Encoding.UTF8)) { using (StreamWriter sw = new StreamWriter(Path.Combine(Environment.CurrentDirectory, String.Format("html-test-{0}-{1}.htm", blog, topic)), false, Encoding.UTF8)) { sw.Write(filter.Execute(sr, parameters)); } } }
public HtmlProcessor SgmlSetup() { HtmlProcessor html = new HtmlProcessor(); html.Filter.Mode = HtmlFilteringMode.DenyByDefault; html.Filter.DefaultOptions = HtmlElementOptions.AllowContent | HtmlElementOptions.UseTypography; html.Filter.Treat(a => a.Attributes("xmlns", "ns").As(HtmlAttributeOptions.Denied)) .RegularContent().Links().Images().Abstract().Youtube(); html.Typographics.EncodeSpecialSymbols = false; html.Typographics.Replaces(); return html; }