コード例 #1
0
        public static string Render(CSS css)
        {
            StringBuilder txt = new StringBuilder();

            foreach (Import imp in css.Imports)
            {
                txt.AppendFormat("{0}\r\n", imp.ToString());
            }
            foreach (MediaTag mtg in css.MediaTags)
            {
                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");
            }
            return(txt.ToString());
        }
コード例 #2
0
ファイル: CSSRenderer.cs プロジェクト: krikelin/SpiderView
 public static string Render(CSS css)
 {
     StringBuilder txt = new StringBuilder();
     foreach (Import imp in css.Imports) {
         txt.AppendFormat("{0}\r\n", imp.ToString());
     }
     foreach (MediaTag mtg in css.MediaTags) {
         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");
     }
     return txt.ToString();
 }