public ContentRendererBak (HTMLNode root,
List<HTMLNode> ignores, List<HTMLNode> wrappers, LinkChecker linkChecker) {
this.linkChecker = linkChecker;
StringBuilder builder = new StringBuilder();
NodeIterator iterator = root.iterator(ignores);
while(iterator.hasNext()) {
HTMLNode node = iterator.next();
switch (node.getName()) {
case CONTENT:
char [] chars = node.getValue();
if(!isEmpty(chars)) {
// if(isValid(contents, node, constain)) {
int start = builder.length();
for(int k = 0; k < chars.length; k++) {
builder.append(chars[k] == '\n' ? ' ' : chars[k]);
}
HTMLNode parent = node.getParent();
if(parent != null && parent.isNode(Name.SPAN)) builder.append(' ');
int end = builder.length();
positions.add(new NodePosition(node, start, end));
}
// }
break;
case IMG:
// positions.add(new NodePosition(node, -1, -1));
break;
case H1:
case H2:
case H3:
case H4:
case H5:
case H6:
case P:
case BR:
case LI:
if(!isEndWithNewLine(builder)) {
builder.append('\n');
}
break;
case IFRAME:
System.out.println(builder.length());
separateBlock(builder, 2);
// System.out.println("====>" + builder.length());
break;
case DIV:
separateBlock(builder, node, 2, wrappers);
break;
case TABLE:
separateBlock(builder, node, 4, wrappers);
break;
case TR:
separateBlock(builder, node, 2, wrappers);
break;
case TD:
separateBlock(builder, node, 2, wrappers);
break;
case SCRIPT:
case STYLE:
NodeImpl nodeImpl = (NodeImpl) node;
if(nodeImpl.getType() == TypeToken.TAG && iterator.hasNext()) iterator.next();
break;
default:
if(builder.length() > 0) {
char c = builder.charAt(builder.length()-1);
if(!(Character.isWhitespace(c)