Esempio n. 1
0
        public static string Render(CSSDocument css)
        {
            StringBuilder txt = new StringBuilder();

            //foreach (Import imp in css.Imports) {
            //    txt.AppendFormat("{0}\r\n", imp.ToString());
            //}
            //foreach (Media mtg in css.Medias) {
            //    txt.AppendFormat("@media{0} {{\r\n", mtg.Media != Media.None ? " " + mtg.Media.ToString() : "");
            //    foreach (Selector sel in mtg.Selectors) {
            //        txt.Append(Render(sel, 1));
            //        txt.Append("\r\n");
            //    }
            //    txt.Append("}\r\n");
            //}
            //foreach (Selector sel in css.Selectors) {
            //    txt.Append(Render(sel));
            //    txt.Append("\r\n");
            //}
            txt.Append(css.ToString());
            return(txt.ToString());
        }
Esempio n. 2
0
        public static string Render(CSSDocument css)
        {
            StringBuilder txt = new StringBuilder();

            txt.Append("<pre><span class=\"cssDoc\">");

            foreach (Directive dr in css.Directives)
            {
                txt.AppendFormat("<span class=\"directive\">{0}</span>\r\n", Render(dr));
            }
            if (txt.Length > 0)
            {
                txt.Append("\r\n");
            }
            foreach (RuleSet rules in css.RuleSets)
            {
                txt.AppendFormat("<span class=\"ruleset\">{0}</span>\r\n", Render(rules, 0));
            }

            txt.Append("</span></pre>");

            return(txt.ToString());
        }