Skip to content

Commit e849f64

Browse files
committed
Merge pull request #2 from andrewor14/annotations
Generalize jQuery matching for non Spark-core API docs
2 parents a01c076 + 982a473 commit e849f64

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

docs/css/api-docs.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
background-color: #257080;
99
}
1010

11+
.alphaComponent {
12+
background-color: #bb0000;
13+
}
14+
1115
.badge {
1216
font-family: Arial, san-serif;
1317
float: right;

docs/js/api-docs.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22

33
$(document).ready(function() {
44
var annotations = $("dt:contains('Annotations')").next("dd").children("span.name");
5-
addBadges(annotations, "AlphaComponent", ":: AlphaComponent ::", "<span class='experimental badge'>ALPHA COMPONENT</span>");
5+
addBadges(annotations, "AlphaComponent", ":: AlphaComponent ::", "<span class='alphaComponent badge'>Alpha Component</span>");
66
addBadges(annotations, "DeveloperApi", ":: DeveloperApi ::", "<span class='developer badge'>Developer API</span>");
77
addBadges(annotations, "Experimental", ":: Experimental ::", "<span class='experimental badge'>Experimental</span>");
88
});
99

1010
function addBadges(allAnnotations, name, tag, html) {
11-
var fullName = "org.apache.spark.annotations." + name;
12-
var annotations = allAnnotations.children("a[name='" + fullName + "']");
13-
var tags = $("p.comment:contains(" + tag + ")").add(
14-
$("div.comment p:contains(" + tag + ")"));
11+
var annotations = allAnnotations.filter(":contains('" + name + "')")
12+
var tags = $(".cmt:contains(" + tag + ")")
1513

1614
// Remove identifier tags from comments
1715
tags.each(function(index) {
@@ -21,7 +19,8 @@ function addBadges(allAnnotations, name, tag, html) {
2119
});
2220

2321
// Add badges to all containers
24-
tags.prevAll("h4.signature").prepend(html);
25-
annotations.closest("div.fullcomment").prevAll("h4.signature").prepend(html);
26-
annotations.closest("div.fullcommenttop").prepend(html);
22+
tags.prevAll("h4.signature")
23+
.add(annotations.closest("div.fullcommenttop"))
24+
.add(annotations.closest("div.fullcomment").prevAll("h4.signature"))
25+
.prepend(html);
2726
}

0 commit comments

Comments
 (0)