Skip to content

Commit

Permalink
Merge pull request #86 from sebastian-nagel/cc-10-rel-attribute
Browse files Browse the repository at this point in the history
ExtractingParseObserver: extract rel, hreflang and type attributes
  • Loading branch information
ato authored Oct 25, 2019
2 parents 336a49e + 26b1e7a commit 4586a94
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public void extract(HTMLMetaData data, TagNode node, ExtractingParseObserver obs
l.add(makePath("A","href"));
l.add("url");
l.add(url);
for(String a : new String[] {"target","alt","title"}) {
for(String a : new String[] {"target","alt","title","rel","hreflang","type"}) {
String v = node.getAttribute(a);
if(v != null) {
l.add(a);
Expand All @@ -311,7 +311,22 @@ public void extract(HTMLMetaData data, TagNode node, ExtractingParseObserver obs

private static class AreaTagExtractor implements TagExtractor {
public void extract(HTMLMetaData data, TagNode node, ExtractingParseObserver obs) {
addBasicHrefs(data,node,"href");
String url = node.getAttribute("href");
if(url != null) {
ArrayList<String> l = new ArrayList<String>();
l.add(PATH);
l.add(makePath("AREA","href"));
l.add("url");
l.add(url);
for(String a : new String[] {"rel"}) {
String v = node.getAttribute(a);
if(v != null) {
l.add(a);
l.add(v);
}
}
data.addHref(l);
}
}
}

Expand Down

0 comments on commit 4586a94

Please sign in to comment.