protected void extractTag(String tag, BeardTemplateReferences ref) {

        if (tag.equals("")) {
            return;
        }

        char token = tag.charAt(0);

        if (token == COMMENT_TOKEN || token == ESCAPE_TOKEN) {
            return;
        }

        String identifier = tag.substring(1).trim();

        if (token == ELEMENT_TOKEN) {
            ref.addElement(identifier);
        } else if (token == VARIABLE_TOKEN) {

            if (identifier.contains("|")) {
                identifier = identifier.substring(0, identifier.indexOf("|")).trim();
            }

            ref.addVariable(identifier);
        }
    }