private CSS GetCss() { var sheet = new CSS(); sheet.Analyze(DefaultEpubCss); var hrefs = _opfRoot .Elements(_opfns + "manifest") .Elements(_opfns + "item") .Where(e => { var mediaType = e.Attribute("media-type"); return(mediaType != null && mediaType.Value == "text/css"); }) .Attributes("href").Select(h => h.Value); foreach (var href in hrefs) { Stream stream = _zip.GetFileStream(_opfPath + href, false, true); if (stream != null) { sheet.Analyze(new StreamReader(stream).ReadToEnd()); } } return(sheet); }
private CSS GetCss() { CSS sheet = new CSS(); sheet.Analyze(DefaultFb2Css); return(sheet); }
public override IEnumerable <TokenBase> GetTokens() { _css = new CSS(); var html = new HtmlDocument { OptionOutputAsXml = true, OptionReadEncoding = false }; html.Load(_reader); var root = html.DocumentNode.SelectSingleNode("//body"); var cssNode = html.DocumentNode.SelectSingleNode("//style"); if (cssNode != null) { _css.Analyze(cssNode.InnerText); } var stack = new Stack <TextVisualProperties>(); var item = new TextVisualProperties(); stack.Push(item); return(ParseTokens(root, stack, new TokenIndex())); }