@Override public void nodeAddedWithChildren(Node node) { validateLinked(node); myNodeClassifier.add(node); addNodes(node.getChildren()); if (myHost != null) myHost.nodeAddedWithChildren(node); }
@Override public void process(NodeTracker state, Node node) { if (node instanceof Link) { Node previous = node.getPrevious(); if (previous instanceof Text) { final BasedSequence chars = previous.getChars(); if (chars.endsWith("@") && chars.isContinuedBy(node.getChars())) { int prevBackslash = chars.subSequence(0, chars.length() - 1).countTrailing('\\'); if ((prevBackslash & 1) == 0) { // trim previous chars to remove '@' previous.setChars(chars.subSequence(0, chars.length() - 1)); YouTubeLink youTubeLink = new YouTubeLink((Link) node); youTubeLink.takeChildren(node); node.unlink(); previous.insertAfter(youTubeLink); state.nodeRemoved(node); state.nodeAddedWithChildren(youTubeLink); } } } } }
node.insertBefore(linkNode); state.nodeAddedWithChildren(linkNode);
state.nodeRemoved(node); previous.insertAfter(mediaLink); state.nodeAddedWithChildren(mediaLink); previous.setChars(chars.subSequence(0, chars.length() - mediaLink.getPrefix().length())); if (previous.getChars().length() == 0) {
@Override public void nodeAddedWithChildren(Node node) { validateLinked(node); myNodeClassifier.add(node); addNodes(node.getChildren()); if (myHost != null) myHost.nodeAddedWithChildren(node); }
state.nodeAddedWithChildren(textBase); attributeOwner = textBase; } else if (previous instanceof AttributesDelimiter) {
@Override public void process(NodeTracker state, Node node) { if (node instanceof Link) { Node previous = node.getPrevious(); if (previous instanceof Text) { final BasedSequence chars = previous.getChars(); if (chars.endsWith("@") && chars.isContinuedBy(node.getChars())) { int prevBackslash = chars.subSequence(0, chars.length() - 1).countTrailing('\\'); if ((prevBackslash & 1) == 0) { // trim previous chars to remove '@' previous.setChars(chars.subSequence(0, chars.length() - 1)); YouTubeLink youTubeLink = new YouTubeLink((Link) node); youTubeLink.takeChildren(node); node.unlink(); previous.insertAfter(youTubeLink); state.nodeRemoved(node); state.nodeAddedWithChildren(youTubeLink); } } } } }
node.insertBefore(linkNode); state.nodeAddedWithChildren(linkNode);
state.nodeAddedWithChildren(textBase); attributeOwner = textBase; } else if (previous instanceof AttributesDelimiter) {