OSDN Git Service

Show annotation information in generated documentation
authorJeff Arneson <jarneson@google.com>
Fri, 22 Aug 2014 22:40:47 +0000 (15:40 -0700)
committerJeff Arneson <jarneson@google.com>
Fri, 5 Sep 2014 22:28:59 +0000 (22:28 +0000)
Display the annotations used to override @hide for classes in packages
and methods in classes.

Bug: 16848303
Change-Id: I5599e6593613edbbe6a002d5d46a0a6561dec55a

tools/droiddoc/templates-sdk/assets/css/default.css
tools/droiddoc/templates-sdk/class.cs
tools/droiddoc/templates-sdk/macros_override.cs [new file with mode: 0644]
tools/droiddoc/templates-sdk/package.cs

index 3b647c2..b3ee207 100644 (file)
@@ -7330,3 +7330,8 @@ a.home-new-cta-btn:hover,
   line-height: 54px;
   text-align: center;
 }
+
+.annotation-message {
+    display: block;
+    font-style: italic;
+}
\ No newline at end of file
index 0461af6..1a770b3 100644 (file)
@@ -1,5 +1,6 @@
 <?cs include:"doctype.cs" ?>
 <?cs include:"macros.cs" ?>
+<?cs include:"macros_override.cs" ?>
 <html<?cs if:devsite ?> devsite<?cs /if ?>>
 <?cs include:"head_tag.cs" ?>
 <body class="gc-documentation <?cs if:(reference.gms || reference.gcm) ?>google<?cs /if ?>
@@ -123,6 +124,7 @@ Summary:
   <?cs /if ?>
   <?cs set:colspan = colspan-1 ?>
 <?cs /each ?>
+<?cs call:show_annotations_list(class, "<span class='annotation-message'>Included in documentation by the annotations: ", "</span>") ?>
 
 </div><!-- end header -->
 
@@ -193,7 +195,10 @@ Summary:
         <td class="jd-linkcol" width="100%"><nobr>
         <span class="sympad"><?cs call:cond_link(method.name, toroot, method.href, included) ?></span>(<?cs call:parameter_list(method.params) ?>)</nobr>
         <?cs if:subcount(method.shortDescr) || subcount(method.deprecated) ?>
-        <div class="jd-descrdiv"><?cs call:short_descr(method) ?></div>
+        <div class="jd-descrdiv">
+          <?cs call:short_descr(method) ?>
+          <?cs call:show_annotations_list(method, "<span class='annotation-message'>Included in documentation by the annotations: ", "</span>") ?>
+        </div>
   <?cs /if ?>
   </td></tr>
 <?cs set:count = count + #1 ?>
@@ -546,6 +551,7 @@ From <?cs var:cl.kind ?>
         <?cs call:federated_refs(method) ?>
       </div>
     <div class="jd-details-descr">
+      <?cs call:show_annotations_list(method, "<span class='annotation-message'>Included in documentation by the annotations: ", "</span>") ?>
       <?cs call:description(method) ?>
     </div>
 </div>
diff --git a/tools/droiddoc/templates-sdk/macros_override.cs b/tools/droiddoc/templates-sdk/macros_override.cs
new file mode 100644 (file)
index 0000000..6ff8f58
--- /dev/null
@@ -0,0 +1,35 @@
+<?cs # Create a comma separated list of annotations on obj that were in showAnnotations in Doclava ?>
+<?cs # pre is an HTML string to start the list, post is an HTML string to close the list ?>
+<?cs # for example call:show_annotations_list(cl, "<td>Annotations: ", "</td>") ?>
+<?cs # if obj has nothing on obj.showAnnotations, nothing will be output ?>
+<?cs def:show_annotations_list(obj, pre, post) ?>
+    <?cs each:anno = obj.showAnnotations ?>
+      <?cs if:first(anno) ?>
+        <?cs var:pre ?>
+      <?cs /if ?>
+      @<?cs var:anno.type.label ?>
+      <?cs if:last(anno) == 0 ?>
+        , &nbsp;
+      <?cs /if ?>
+      <?cs if:last(anno)?>
+        <?cs var:post ?>
+      <?cs /if ?>
+    <?cs /each ?>
+<?cs /def ?>
+
+<?cs # Override default class_link_table to display annotations ?>
+<?cs def:class_link_table(classes) ?>
+  <?cs set:count = #1 ?>
+  <table class="jd-sumtable-expando">
+    <?cs each:cl=classes ?>
+      <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:cl.type.since ?>" >
+        <td class="jd-linkcol"><?cs call:type_link(cl.type) ?></td>
+        <td class="jd-descrcol" width="100%">
+          <?cs call:short_descr(cl) ?>&nbsp;
+          <?cs call:show_annotations_list(cl, "<span class='annotation-message'>Included in documentation by the annotations: ", "</span>") ?>
+        </td>
+      </tr>
+      <?cs set:count = count + #1 ?>
+    <?cs /each ?>
+  </table>
+<?cs /def ?>
\ No newline at end of file
index abd49f1..acb4ee9 100644 (file)
@@ -1,5 +1,6 @@
 <?cs include:"doctype.cs" ?>
 <?cs include:"macros.cs" ?>
+<?cs include:"macros_override.cs" ?>
 <html<?cs if:devsite ?> devsite<?cs /if ?>>
 <?cs include:"head_tag.cs" ?>