forked from sirthias/pegdown
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve link 'rel=nofollow' enabling logic, closes sirthias#29
- Loading branch information
Showing
11 changed files
with
95 additions
and
36 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,41 @@ | ||
package org.pegdown; | ||
|
||
import org.pegdown.ast.AutoLinkNode; | ||
import org.pegdown.ast.ExpLinkNode; | ||
import org.pegdown.ast.RefLinkNode; | ||
|
||
public interface NoFollow { | ||
|
||
/** | ||
* Determines whether the given link node should receive a "rel=nofollow" attribute when generated as HTML. | ||
* @param node | ||
* @return true if the given link node should receive a "rel=nofollow" attribute | ||
*/ | ||
boolean noFollow(AutoLinkNode node); | ||
|
||
/** | ||
* Determines whether the given link node should receive a "rel=nofollow" attribute when generated as HTML. | ||
* @param node | ||
* @return true if the given link node should receive a "rel=nofollow" attribute | ||
*/ | ||
boolean noFollow(ExpLinkNode node); | ||
|
||
/** | ||
* Determines whether the given link node should receive a "rel=nofollow" attribute when generated as HTML. | ||
* @param node | ||
* @return true if the given link node should receive a "rel=nofollow" attribute | ||
*/ | ||
boolean noFollow(RefLinkNode node); | ||
|
||
static NoFollow NEVER = new NoFollow() { | ||
public boolean noFollow(AutoLinkNode node) { return false; } | ||
public boolean noFollow(ExpLinkNode node) { return false; } | ||
public boolean noFollow(RefLinkNode node) { return false; } | ||
}; | ||
|
||
static NoFollow ALWAYS = new NoFollow() { | ||
public boolean noFollow(AutoLinkNode node) { return true; } | ||
public boolean noFollow(ExpLinkNode node) { return true; } | ||
public boolean noFollow(RefLinkNode node) { return true; } | ||
}; | ||
} |
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
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
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