Esempio n. 1
0
 public void accept(Token token, Token lastToken)
 {
     if (token.type == HtmlTokenType.UNESCAPED)
     {
         sb.Append(CssRewriter.rewrite(token.toString(), source, linkRewriter));
     }
     else
     {
         sb.Append(HtmlRewriter.producePreTokenSeparator(token, lastToken));
         sb.Append(token.toString());
         sb.Append(HtmlRewriter.producePostTokenSeparator(token, lastToken));
     }
 }
Esempio n. 2
0
        public void accept(Token token,
                           Token lastToken)
        {
            if (token.type == HtmlTokenType.TAGBEGIN)
            {
                tagAttributeTargets.TryGetValue(token.toString().Substring(1).ToLower(), out currentTagAttrs);
            }

            if (currentTagAttrs != null &&
                lastToken != null &&
                lastToken.type == HtmlTokenType.ATTRNAME &&
                currentTagAttrs.Contains(lastToken.toString().ToLower()))
            {
                String link = stripQuotes(token.toString());
                builder.Append("=\"");
                builder.Append(linkRewriter.rewrite(link, relativeBase));
                builder.Append('\"');
                return;
            }
            builder.Append(HtmlRewriter.producePreTokenSeparator(token, lastToken));
            builder.Append(token.toString());
            builder.Append(HtmlRewriter.producePostTokenSeparator(token, lastToken));
        }