Package com.google.collide.client.util.collections

Examples of com.google.collide.client.util.collections.StringMultiset


    index++;
    String tagName = token.getValue().substring(1).trim();

    HtmlTagWithAttributes result = new HtmlTagWithAttributes(tagName);

    StringMultiset tagAttributes = result.getAttributes();
    while (index < findTagResult.endTagIndex) {
      token = tokens.get(index);
      index++;
      TokenType tokenType = token.getType();
      if (TokenType.ATTRIBUTE == tokenType) {
        tagAttributes.add(token.getValue().toLowerCase());
      }
    }

    result.setDirty(false);
    return result;
View Full Code Here


      if (attributes == null) {
        newAttributes = true;
        attributes = JsonCollections.createArray();
      }

      StringMultiset tagAttributes = tag.getAttributes();

      while (index < size) {
        Token token = tokens.get(index);
        index++;
        TokenType tokenType = token.getType();
        if (ATTRIBUTE == tokenType) {
          String attribute = token.getValue();
          attribute = ignoreCase ? attribute.toLowerCase() : attribute;
          attributes.add(attribute);
          tagAttributes.add(attribute);
        } else if (TAG == tokenType) {
          // Tag closing token
          tag.setDirty(false);
          inTag = false;
          break;
        }
      }
      if (newAttributes && attributes.size() != 0) {
        line.putTag(TAG_ATTRIBUTES, attributes);
      } else if (!newAttributes && attributes.size() == 0) {
        line.putTag(TAG_ATTRIBUTES, null);
      }
    } else {
      line.putTag(TAG_ATTRIBUTES, null);
    }

    while (index < size) {
      Token token = tokens.get(index);
      index++;
      TokenType tokenType = token.getType();
      if (TAG == tokenType) {
        if (inTag) {
          if (">".equals(token.getValue()) || "/>".equals(token.getValue())) {
            // If type is "tag" and content is ">", this is HTML token.
            inTag = false;
          }
        } else {
          // Check that we are in html mode.
          if (CodeMirror2.HTML.equals(token.getMode())) {
            lastTagTokenIndex = index - 1;
            inTag = true;
          }
        }
      }
    }

    if (inTag) {
      if (lastTagTokenIndex != -1) {
        index = lastTagTokenIndex;
        Token token = tokens.get(index);
        index++;
        String tagName = token.getValue().substring(1).trim();
        tag = new HtmlTagWithAttributes(tagName);
        StringMultiset tagAttributes = tag.getAttributes();
        while (index < size) {
          token = tokens.get(index);
          index++;
          TokenType tokenType = token.getType();
          if (ATTRIBUTE == tokenType) {
            String attribute = token.getValue();
            tagAttributes.add(ignoreCase ? attribute.toLowerCase() : attribute);
          }
        }
      }

      // In case when document ends, but last tag is not closed we state that
View Full Code Here

TOP

Related Classes of com.google.collide.client.util.collections.StringMultiset

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.