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–8 unchanged (8 lines)
9 * A {@code <!DOCTYPE>} node.
10 */
11public class DocumentType extends Node {
12 public static final String PUBLIC_KEY = "PUBLIC";
13 public static final String SYSTEM_KEY = "SYSTEM";
14 private static final String NAME = "name";
15 private static final String PUBLIC_ID = "publicId";
16 private static final String SYSTEM_ID = "systemId";
17 // todo: quirk mode from publicId and systemId
18
19 /**
20 * Create a new doctype element.
21 * @param name the doctype's name
22 * @param publicId the doctype's public ID
23 * @param systemId the doctype's system ID
24 * @param baseUri the doctype's base URI
25 */
26 public DocumentType(String name, String publicId, String systemId, String baseUri) {
27 super(baseUri);
28
29 attr(NAME, name);
30 attr(PUBLIC_ID, publicId);
31 attr(SYSTEM_ID, systemId);
32 }
33
34 /**
35 * Create a new doctype element.
36 * @param name the doctype's name
37 * @param publicId the doctype's public ID
38 * @param systemId the doctype's system ID
39 * @param baseUri the doctype's base URI
40 */
41
42
43 @Override
44 public String nodeName() {
45 return "#doctype";
46 }
47
…lines 48–51 unchanged (4 lines)
52 accum.append("<!doctype");
53 } else {
54 accum.append("<!DOCTYPE");
55 }
56 if (has(NAME))
57 accum.append(" ").append(attr(NAME));
58 if (has(PUBLIC_ID))
59 accum.append(" PUBLIC \"").append(attr(PUBLIC_ID)).append('"');
60 if (has(SYSTEM_ID))
61 accum.append(" \"").append(attr(SYSTEM_ID)).append('"');
62 accum.append('>');
63 }
64
65 @Override
…lines 66–73 unchanged (8 lines)

After

…lines 1–8 unchanged (8 lines)
9 * A {@code <!DOCTYPE>} node.
10 */
11public class DocumentType extends Node {
12 public static final String PUBLIC_KEY = "PUBLIC";
13 public static final String SYSTEM_KEY = "SYSTEM";
14 private static final String NAME = "name";
15 private static final String PUB_SYS_KEY = "pubSysKey"; // PUBLIC or SYSTEM
16 private static final String PUBLIC_ID = "publicId";
17 private static final String SYSTEM_ID = "systemId";
18 // todo: quirk mode from publicId and systemId
19
20 /**
21 * Create a new doctype element.
…lines 22–25 unchanged (4 lines)
26 */
27 public DocumentType(String name, String publicId, String systemId, String baseUri) {
28 super(baseUri);
29
30 attr(NAME, name);
31 attr(PUBLIC_ID, publicId);
32 if (has(PUBLIC_ID)) {
33 attr(PUB_SYS_KEY, PUBLIC_KEY);
34 }
35 attr(SYSTEM_ID, systemId);
36 }
37
38 /**
39 * Create a new doctype element.
40 * @param name the doctype's name
41 * @param publicId the doctype's public ID
42 * @param systemId the doctype's system ID
43 * @param baseUri the doctype's base URI
44 */
45 public DocumentType(String name, String pubSysKey, String publicId, String systemId, String baseUri) {
46 super(baseUri);
47
48 attr(NAME, name);
49 if (pubSysKey != null) {
50 attr(PUB_SYS_KEY, pubSysKey);
51 }
52 attr(PUBLIC_ID, publicId);
53 attr(SYSTEM_ID, systemId);
54 }
55
56 @Override
57 public String nodeName() {
58 return "#doctype";
59 }
60
…lines 61–64 unchanged (4 lines)
65 accum.append("<!doctype");
66 } else {
67 accum.append("<!DOCTYPE");
68 }
69 if (has(NAME))
70 accum.append(" ").append(attr(NAME));
71 if (has(PUB_SYS_KEY))
72 accum.append(" ").append(attr(PUB_SYS_KEY));
73 if (has(PUBLIC_ID))
74 accum.append(" \"").append(attr(PUBLIC_ID)).append('"');
75 if (has(SYSTEM_ID))
76 accum.append(" \"").append(attr(SYSTEM_ID)).append('"');
77 accum.append('>');
78 }
79
80 @Override
…lines 81–88 unchanged (8 lines)

Before

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "IOException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
. "."
identifier "StringUtil"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
identifier "Document"
. "."
identifier "OutputSettings"
. "."
asterisk
* "*"
; ";"
block_comment "/**\n * A {@code <!DOCTYPE>} node.\n */"
class_declaration
modifiers
public "public"
class "class"
identifier "DocumentType"
superclass
extends "extends"
type_identifier "Node"
class_body
{ "{"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "PUBLIC_KEY"
= "="
string_literal
" "\""
string_fragment "PUBLIC"
" "\""
; ";"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "SYSTEM_KEY"
= "="
string_literal
" "\""
string_fragment "SYSTEM"
" "\""
; ";"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "NAME"
= "="
string_literal
" "\""
string_fragment "name"
" "\""
; ";"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "PUBLIC_ID"
= "="
string_literal
" "\""
string_fragment "publicId"
" "\""
; ";"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "SYSTEM_ID"
= "="
string_literal
" "\""
string_fragment "systemId"
" "\""
; ";"
line_comment "// todo: quirk mode from publicId and systemId"
block_comment "/**\n * Create a new doctype element.\n * @param name "...
constructor_declaration
modifiers
public "public"
identifier "DocumentType"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "name"
, ","
formal_parameter
type_identifier "String"
identifier "publicId"
, ","
formal_parameter
type_identifier "String"
identifier "systemId"
, ","
formal_parameter
type_identifier "String"
identifier "baseUri"
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
super "super"
argument_list
( "("
identifier "baseUri"
) ")"
; ";"
expression_statement
method_invocation
identifier "attr"
argument_list
( "("
identifier "NAME"
, ","
identifier "name"
) ")"
; ";"
expression_statement
method_invocation
identifier "attr"
argument_list
( "("
identifier "PUBLIC_ID"
, ","
identifier "publicId"
) ")"
; ";"
expression_statement
method_invocation
identifier "attr"
argument_list
( "("
identifier "SYSTEM_ID"
, ","
identifier "systemId"
) ")"
; ";"
} "}"
block_comment "/**\n * Create a new doctype element.\n * @param name "...
method_declaration (+21 nodes collapsed)
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
void_type "void"
identifier "outerHtmlHead"
formal_parameters
( "("
formal_parameter
type_identifier "Appendable"
identifier "accum"
, ","
formal_parameter
integral_type
int "int"
identifier "depth"
, ","
formal_parameter
scoped_type_identifier
type_identifier "Document"
. "."
type_identifier "OutputSettings"
identifier "out"
) ")"
throws
throws "throws"
type_identifier "IOException"
block
{ "{"
if_statement (+72 nodes collapsed)
if_statement (+36 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "has"
argument_list
( "("
identifier "PUBLIC_ID"
) ")"
) ")"
expression_statement
method_invocation
method_invocation
method_invocation
identifier "accum"
. "."
identifier "append"
argument_list
( "("
string_literal
" "\""
string_fragment " PUBLIC "
escape_sequence "\\\""
" "\""
) ")"
. "."
identifier "append"
argument_list
( "("
method_invocation
identifier "attr"
argument_list
( "("
identifier "PUBLIC_ID"
) ")"
) ")"
. "."
identifier "append"
argument_list
( "("
character_literal "'\"'"
) ")"
; ";"
if_statement (+44 nodes collapsed)
expression_statement
method_invocation
identifier "accum"
. "."
identifier "append"
argument_list
( "("
character_literal "'>'"
) ")"
; ";"
} "}"
method_declaration (+28 nodes collapsed)
method_declaration (+34 nodes collapsed)
} "}"

After

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "IOException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
. "."
identifier "StringUtil"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
identifier "Document"
. "."
identifier "OutputSettings"
. "."
asterisk
* "*"
; ";"
block_comment "/**\n * A {@code <!DOCTYPE>} node.\n */"
class_declaration
modifiers
public "public"
class "class"
identifier "DocumentType"
superclass
extends "extends"
type_identifier "Node"
class_body
{ "{"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "PUBLIC_KEY"
= "="
string_literal
" "\""
string_fragment "PUBLIC"
" "\""
; ";"
field_declaration
modifiers
public "public"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "SYSTEM_KEY"
= "="
string_literal
" "\""
string_fragment "SYSTEM"
" "\""
; ";"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "NAME"
= "="
string_literal
" "\""
string_fragment "name"
" "\""
; ";"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "PUB_SYS_KEY"
= "="
string_literal
" "\""
string_fragment "pubSysKey"
" "\""
; ";"
line_comment "// PUBLIC or SYSTEM"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "PUBLIC_ID"
= "="
string_literal
" "\""
string_fragment "publicId"
" "\""
; ";"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "SYSTEM_ID"
= "="
string_literal
" "\""
string_fragment "systemId"
" "\""
; ";"
line_comment "// todo: quirk mode from publicId and systemId"
block_comment "/**\n * Create a new doctype element.\n * @param name "...
constructor_declaration
modifiers
public "public"
identifier "DocumentType"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "name"
, ","
formal_parameter
type_identifier "String"
identifier "publicId"
, ","
formal_parameter
type_identifier "String"
identifier "systemId"
, ","
formal_parameter
type_identifier "String"
identifier "baseUri"
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
super "super"
argument_list
( "("
identifier "baseUri"
) ")"
; ";"
expression_statement
method_invocation
identifier "attr"
argument_list
( "("
identifier "NAME"
, ","
identifier "name"
) ")"
; ";"
expression_statement
method_invocation
identifier "attr"
argument_list
( "("
identifier "PUBLIC_ID"
, ","
identifier "publicId"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "has"
argument_list
( "("
identifier "PUBLIC_ID"
) ")"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "attr"
argument_list
( "("
identifier "PUB_SYS_KEY"
, ","
identifier "PUBLIC_KEY"
) ")"
; ";"
} "}"
expression_statement
method_invocation
identifier "attr"
argument_list
( "("
identifier "SYSTEM_ID"
, ","
identifier "systemId"
) ")"
; ";"
} "}"
block_comment "/**\n * Create a new doctype element.\n * @param name "...
constructor_declaration
modifiers
public "public"
identifier "DocumentType"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "name"
, ","
formal_parameter
type_identifier "String"
identifier "pubSysKey"
, ","
formal_parameter
type_identifier "String"
identifier "publicId"
, ","
formal_parameter
type_identifier "String"
identifier "systemId"
, ","
formal_parameter
type_identifier "String"
identifier "baseUri"
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
super "super"
argument_list
( "("
identifier "baseUri"
) ")"
; ";"
expression_statement
method_invocation
identifier "attr"
argument_list
( "("
identifier "NAME"
, ","
identifier "name"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "pubSysKey"
!= "!="
null_literal "null"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "attr"
argument_list
( "("
identifier "PUB_SYS_KEY"
, ","
identifier "pubSysKey"
) ")"
; ";"
} "}"
expression_statement
method_invocation
identifier "attr"
argument_list
( "("
identifier "PUBLIC_ID"
, ","
identifier "publicId"
) ")"
; ";"
expression_statement
method_invocation
identifier "attr"
argument_list
( "("
identifier "SYSTEM_ID"
, ","
identifier "systemId"
) ")"
; ";"
} "}"
method_declaration (+21 nodes collapsed)
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
void_type "void"
identifier "outerHtmlHead"
formal_parameters
( "("
formal_parameter
type_identifier "Appendable"
identifier "accum"
, ","
formal_parameter
integral_type
int "int"
identifier "depth"
, ","
formal_parameter
scoped_type_identifier
type_identifier "Document"
. "."
type_identifier "OutputSettings"
identifier "out"
) ")"
throws
throws "throws"
type_identifier "IOException"
block
{ "{"
if_statement (+72 nodes collapsed)
if_statement (+36 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "has"
argument_list
( "("
identifier "PUB_SYS_KEY"
) ")"
) ")"
expression_statement
method_invocation
method_invocation
identifier "accum"
. "."
identifier "append"
argument_list
( "("
string_literal
" "\""
string_fragment " "
" "\""
) ")"
. "."
identifier "append"
argument_list
( "("
method_invocation
identifier "attr"
argument_list
( "("
identifier "PUB_SYS_KEY"
) ")"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "has"
argument_list
( "("
identifier "PUBLIC_ID"
) ")"
) ")"
expression_statement
method_invocation
method_invocation
method_invocation
identifier "accum"
. "."
identifier "append"
argument_list
( "("
string_literal
" "\""
string_fragment " "
escape_sequence "\\\""
" "\""
) ")"
. "."
identifier "append"
argument_list
( "("
method_invocation
identifier "attr"
argument_list
( "("
identifier "PUBLIC_ID"
) ")"
) ")"
. "."
identifier "append"
argument_list
( "("
character_literal "'\"'"
) ")"
; ";"
if_statement (+44 nodes collapsed)
expression_statement
method_invocation
identifier "accum"
. "."
identifier "append"
argument_list
( "("
character_literal "'>'"
) ")"
; ";"
} "}"
method_declaration (+28 nodes collapsed)
method_declaration (+34 nodes collapsed)
} "}"