Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–141 unchanged (141 lines)
142 addChildToParent(child, isEmptyElement);
143
144 // pc data only tags (textarea, script): chomp to end tag, add content as text node
145 if (tag.isData()) {
146 String data = tq.chompTo("</" + tagName);
147 tq.chompTo(">");
148
149 Node dataNode;
150 if (tag.equals(titleTag) || tag.equals(textareaTag)) // want to show as text, but not contain inside tags (so not a data tag?)
151 dataNode = TextNode.createFromEncoded(data, baseUri);
152 else
153 dataNode = new DataNode(data, baseUri); // data not encoded but raw (for " in script)
154 child.appendChild(dataNode);
…lines 155–291 unchanged (137 lines)

After

…lines 1–141 unchanged (141 lines)
142 addChildToParent(child, isEmptyElement);
143
144 // pc data only tags (textarea, script): chomp to end tag, add content as text node
145 if (tag.isData()) {
146 String data = tq.chompTo("</" + tagName);
147 tq.chompTo(">");
148 popStackToClose(tag);
149
150 Node dataNode;
151 if (tag.equals(titleTag) || tag.equals(textareaTag)) // want to show as text, but not contain inside tags (so not a data tag?)
152 dataNode = TextNode.createFromEncoded(data, baseUri);
153 else
154 dataNode = new DataNode(data, baseUri); // data not encoded but raw (for " in script)
…lines 155–292 unchanged (138 lines)

Before

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "parser"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "lang"
. "."
identifier "Validate"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
asterisk
* "*"
; ";"
import_declaration
import "import"
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
asterisk
* "*"
; ";"
block_comment "/**\n Parses HTML into a {@link Document}. Generally best to "...
class_declaration
modifiers
public "public"
class "class"
identifier "Parser"
class_body
{ "{"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "SQ"
= "="
string_literal
" "\""
string_fragment "'"
" "\""
; ";"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "DQ"
= "="
string_literal
" "\""
escape_sequence "\\\""
" "\""
; ";"
field_declaration (+21 nodes collapsed)
field_declaration (+21 nodes collapsed)
field_declaration (+21 nodes collapsed)
field_declaration (+21 nodes collapsed)
field_declaration (+21 nodes collapsed)
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "LinkedList"
type_arguments
< "<"
type_identifier "Element"
> ">"
variable_declarator
identifier "stack"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "TokenQueue"
variable_declarator
identifier "tq"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Document"
variable_declarator
identifier "doc"
; ";"
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "baseUri"
; ";"
constructor_declaration (+142 nodes collapsed)
block_comment "/**\n Parse HTML into a Document.\n @param html HTML t"...
method_declaration (+46 nodes collapsed)
block_comment "/**\n Parse a fragment of HTML into the {@code body} of a"...
method_declaration (+46 nodes collapsed)
method_declaration (+196 nodes collapsed)
method_declaration (+111 nodes collapsed)
method_declaration (+109 nodes collapsed)
method_declaration (+90 nodes collapsed)
method_declaration
modifiers
private "private"
void_type "void"
identifier "parseStartTag"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "tq"
. "."
identifier "consume"
argument_list
( "("
string_literal
" "\""
string_fragment "<"
" "\""
) ")"
; ";"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "tagName"
= "="
method_invocation
identifier "tq"
. "."
identifier "consumeWord"
argument_list
( "("
) ")"
; ";"
if_statement (+42 nodes collapsed)
local_variable_declaration
type_identifier "Attributes"
variable_declarator
identifier "attributes"
= "="
object_creation_expression
new "new"
type_identifier "Attributes"
argument_list
( "("
) ")"
; ";"
while_statement (+72 nodes collapsed)
local_variable_declaration
type_identifier "Tag"
variable_declarator
identifier "tag"
= "="
method_invocation
identifier "Tag"
. "."
identifier "valueOf"
argument_list
( "("
identifier "tagName"
) ")"
; ";"
local_variable_declaration
type_identifier "Element"
variable_declarator
identifier "child"
= "="
object_creation_expression
new "new"
type_identifier "Element"
argument_list
( "("
identifier "tag"
, ","
identifier "baseUri"
, ","
identifier "attributes"
) ")"
; ";"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "isEmptyElement"
= "="
method_invocation
identifier "tag"
. "."
identifier "isEmpty"
argument_list
( "("
) ")"
; ";"
line_comment "// empty element if empty tag (e.g. img) or self-closed el ("...
if_statement (+43 nodes collapsed)
expression_statement
method_invocation
identifier "addChildToParent"
argument_list
( "("
identifier "child"
, ","
identifier "isEmptyElement"
) ")"
; ";"
line_comment "// pc data only tags (textarea, script): chomp to end tag, a"...
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "tag"
. "."
identifier "isData"
argument_list
( "("
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "data"
= "="
method_invocation
identifier "tq"
. "."
identifier "chompTo"
argument_list
( "("
binary_expression
string_literal
" "\""
string_fragment "</"
" "\""
+ "+"
identifier "tagName"
) ")"
; ";"
expression_statement
method_invocation
identifier "tq"
. "."
identifier "chompTo"
argument_list
( "("
string_literal
" "\""
string_fragment ">"
" "\""
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "dataNode"
; ";"
if_statement (+54 nodes collapsed)
line_comment "// data not encoded but raw (for \" in script)"
expression_statement
method_invocation
identifier "child"
. "."
identifier "appendChild"
argument_list
( "("
identifier "dataNode"
) ")"
; ";"
} "}"
line_comment "// <base href>: update the base uri"
if_statement (+78 nodes collapsed)
} "}"
method_declaration (+291 nodes collapsed)
method_declaration (+58 nodes collapsed)
method_declaration (+71 nodes collapsed)
method_declaration (+228 nodes collapsed)
method_declaration (+127 nodes collapsed)
method_declaration (+76 nodes collapsed)
method_declaration (+198 nodes collapsed)
method_declaration (+21 nodes collapsed)
} "}"

After

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "parser"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "lang"
. "."
identifier "Validate"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
asterisk
* "*"
; ";"
import_declaration
import "import"
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
asterisk
* "*"
; ";"
block_comment "/**\n Parses HTML into a {@link Document}. Generally best to "...
class_declaration
modifiers
public "public"
class "class"
identifier "Parser"
class_body
{ "{"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "SQ"
= "="
string_literal
" "\""
string_fragment "'"
" "\""
; ";"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "DQ"
= "="
string_literal
" "\""
escape_sequence "\\\""
" "\""
; ";"
field_declaration (+21 nodes collapsed)
field_declaration (+21 nodes collapsed)
field_declaration (+21 nodes collapsed)
field_declaration (+21 nodes collapsed)
field_declaration (+21 nodes collapsed)
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "LinkedList"
type_arguments
< "<"
type_identifier "Element"
> ">"
variable_declarator
identifier "stack"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "TokenQueue"
variable_declarator
identifier "tq"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Document"
variable_declarator
identifier "doc"
; ";"
field_declaration
modifiers
private "private"
type_identifier "String"
variable_declarator
identifier "baseUri"
; ";"
constructor_declaration (+142 nodes collapsed)
block_comment "/**\n Parse HTML into a Document.\n @param html HTML t"...
method_declaration (+46 nodes collapsed)
block_comment "/**\n Parse a fragment of HTML into the {@code body} of a"...
method_declaration (+46 nodes collapsed)
method_declaration (+196 nodes collapsed)
method_declaration (+111 nodes collapsed)
method_declaration (+109 nodes collapsed)
method_declaration (+90 nodes collapsed)
method_declaration
modifiers
private "private"
void_type "void"
identifier "parseStartTag"
formal_parameters
( "("
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "tq"
. "."
identifier "consume"
argument_list
( "("
string_literal
" "\""
string_fragment "<"
" "\""
) ")"
; ";"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "tagName"
= "="
method_invocation
identifier "tq"
. "."
identifier "consumeWord"
argument_list
( "("
) ")"
; ";"
if_statement (+42 nodes collapsed)
local_variable_declaration
type_identifier "Attributes"
variable_declarator
identifier "attributes"
= "="
object_creation_expression
new "new"
type_identifier "Attributes"
argument_list
( "("
) ")"
; ";"
while_statement (+72 nodes collapsed)
local_variable_declaration
type_identifier "Tag"
variable_declarator
identifier "tag"
= "="
method_invocation
identifier "Tag"
. "."
identifier "valueOf"
argument_list
( "("
identifier "tagName"
) ")"
; ";"
local_variable_declaration
type_identifier "Element"
variable_declarator
identifier "child"
= "="
object_creation_expression
new "new"
type_identifier "Element"
argument_list
( "("
identifier "tag"
, ","
identifier "baseUri"
, ","
identifier "attributes"
) ")"
; ";"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "isEmptyElement"
= "="
method_invocation
identifier "tag"
. "."
identifier "isEmpty"
argument_list
( "("
) ")"
; ";"
line_comment "// empty element if empty tag (e.g. img) or self-closed el ("...
if_statement (+43 nodes collapsed)
expression_statement
method_invocation
identifier "addChildToParent"
argument_list
( "("
identifier "child"
, ","
identifier "isEmptyElement"
) ")"
; ";"
line_comment "// pc data only tags (textarea, script): chomp to end tag, a"...
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "tag"
. "."
identifier "isData"
argument_list
( "("
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "data"
= "="
method_invocation
identifier "tq"
. "."
identifier "chompTo"
argument_list
( "("
binary_expression
string_literal
" "\""
string_fragment "</"
" "\""
+ "+"
identifier "tagName"
) ")"
; ";"
expression_statement
method_invocation
identifier "tq"
. "."
identifier "chompTo"
argument_list
( "("
string_literal
" "\""
string_fragment ">"
" "\""
) ")"
; ";"
expression_statement
method_invocation
identifier "popStackToClose"
argument_list
( "("
identifier "tag"
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "dataNode"
; ";"
if_statement (+54 nodes collapsed)
line_comment "// data not encoded but raw (for \" in script)"
expression_statement
method_invocation
identifier "child"
. "."
identifier "appendChild"
argument_list
( "("
identifier "dataNode"
) ")"
; ";"
} "}"
line_comment "// <base href>: update the base uri"
if_statement (+78 nodes collapsed)
} "}"
method_declaration (+291 nodes collapsed)
method_declaration (+58 nodes collapsed)
method_declaration (+71 nodes collapsed)
method_declaration (+228 nodes collapsed)
method_declaration (+127 nodes collapsed)
method_declaration (+76 nodes collapsed)
method_declaration (+198 nodes collapsed)
method_declaration (+21 nodes collapsed)
} "}"