public static CSSCharsetRule ConvertToCSSCharsetRule(AntlrModel.CharSet charset) { var charsetRule = new CSSCharsetRule(); charsetRule.encoding = new Regex(@"['|""]").Replace(charset.Name, ""); charsetRule.cssText = charset.Serialize(); return(charsetRule); }
/// <summary> /// Creates a new @charset-rule from the given source. /// </summary> /// <param name="source">The token iterator.</param> /// <returns>The @charset-rule.</returns> CSSCharsetRule CreateCharsetRule(IEnumerator <CssToken> source) { var charset = new CSSCharsetRule(); charset.ParentStyleSheet = sheet; if (source.Current.Type == CssTokenType.String) { charset.Encoding = ((CssStringToken)source.Current).Data; } SkipToNextSemicolon(source); return(charset); }