-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tracks the source range of attributes (name and value) when source tr…
…acking is on (#2057) When source tracking is enabled, the source position for attribute names and values is now available.`Attribute#sourceRange()` provides the ranges.
- Loading branch information
Showing
16 changed files
with
392 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.jsoup.internal; | ||
|
||
/** | ||
jsoup constants used between packages. Do not use as they may change without warning. Users will not be able to see | ||
this package when modules are enabled. | ||
*/ | ||
public final class SharedConstants { | ||
// Indicates a jsoup internal key. Can't be set via HTML. (It could be set via accessor, but not too worried about | ||
// that. Suppressed from list, iter. | ||
public static final char InternalPrefix = '/'; | ||
public static final String PrivatePrefix = "/jsoup."; | ||
|
||
public static final String AttrRange = PrivatePrefix + "attrRange."; | ||
|
||
private SharedConstants() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,8 @@ | |
import java.util.stream.Stream; | ||
|
||
/** | ||
The base, abstract Node model. Elements, Documents, Comments etc are all Node instances. | ||
The base, abstract Node model. {@link Element}, {@link Document}, {@link Comment}, {@link TextNode}, et al., | ||
are instances of Node. | ||
@author Jonathan Hedley, [email protected] */ | ||
public abstract class Node implements Cloneable { | ||
|
@@ -757,11 +758,14 @@ public <T extends Appendable> T html(T appendable) { | |
} | ||
|
||
/** | ||
Get the source range (start and end positions) in the original input source that this node was parsed from. Position | ||
tracking must be enabled prior to parsing the content. For an Element, this will be the positions of the start tag. | ||
@return the range for the start of the node. | ||
Get the source range (start and end positions) in the original input source from which this node was parsed. | ||
Position tracking must be enabled prior to parsing the content. For an Element, this will be the positions of the | ||
start tag. | ||
@return the range for the start of the node, or {@code untracked} if its range was not tracked. | ||
@see org.jsoup.parser.Parser#setTrackPosition(boolean) | ||
@see Range#isImplicit() | ||
@see Element#endSourceRange() | ||
@see Attributes#nameRange(String name) | ||
@since 1.15.2 | ||
*/ | ||
public Range sourceRange() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.