am e65daec6: Add doclava command line option to bypass copying of default doclava assets dir to output.

* commit 'e65daec66ebdf02baa00c0ee403321fa304f7ad5':
  Add doclava command line option to bypass copying of default doclava assets dir to output.
diff --git a/res/assets/templates/jd_lists.cs b/res/assets/templates/jd_lists.cs
new file mode 100644
index 0000000..e205032
--- /dev/null
+++ b/res/assets/templates/jd_lists.cs
@@ -0,0 +1,8 @@
+var JD_DATA = [
+<?cs
+each:page = docs.pages
+?>
+  { label:"<?cs var:page.label ?>", link:"<?cs var:page.link ?>",
+    tags:[<?cs var:page.tags ?>], type:"<?cs var:page.type ?>" }<?cs if:!last(page) ?>,<?cs /if ?><?cs
+/each ?>
+];
diff --git a/res/assets/templates/macros.cs b/res/assets/templates/macros.cs
index bc6e46d..867abcd 100644
--- a/res/assets/templates/macros.cs
+++ b/res/assets/templates/macros.cs
@@ -101,23 +101,31 @@
 
 <?cs # Show the short-form description of something.  These come from shortDescr and deprecated ?><?cs 
 def:short_descr(obj) ?><?cs
-  if:subcount(obj.deprecated) ?>
-      <em>This <?cs var:obj.kind ?> was deprecated
-      in API level <?cs var:obj.deprecatedsince ?>.
-      <?cs call:tag_list(obj.deprecated) ?></em><?cs
+  if:subcount(obj.deprecated) ?><em><?cs
+    if:obj.deprecatedsince ?>
+      This <?cs var:obj.kind ?> was deprecated
+      in API level <?cs var:obj.deprecatedsince ?>.<?cs
+    else ?>
+      This <?cs var:obj.kind ?> is deprecated.<?cs
+    /if ?>
+    <?cs call:tag_list(obj.deprecated) ?></em><?cs
   else ?><?cs call:tag_list(obj.shortDescr) ?><?cs
   /if ?><?cs
 /def ?>
 
 <?cs # Show the red box with the deprecated warning ?><?cs 
-def:deprecated_warning(obj) ?><?cs 
+def:deprecated_warning(obj) ?><?cs
   if:subcount(obj.deprecated) ?><p>
-  <p class="caution">
-      <strong>This <?cs var:obj.kind ?> was deprecated
-      in API level <?cs var:obj.deprecatedsince ?></strong>.<br/> <?cs
-      call:tag_list(obj.deprecated) ?>
-  </p><?cs 
-  /if ?><?cs 
+  <p class="caution"><strong><?cs
+    if:obj.deprecatedsince ?>
+      This <?cs var:obj.kind ?> was deprecated
+      in API level <?cs var:obj.deprecatedsince ?>.<?cs
+    else ?>
+      This <?cs var:obj.kind ?> is deprecated.<?cs
+    /if ?></strong><br/>
+    <?cs call:tag_list(obj.deprecated) ?>
+  </p><?cs
+  /if ?><?cs
 /def ?>
 
 <?cs # print the See Also: section ?><?cs 
diff --git a/src/com/google/doclava/ClearPage.java b/src/com/google/doclava/ClearPage.java
index 4a6d39a..ed1f069 100644
--- a/src/com/google/doclava/ClearPage.java
+++ b/src/com/google/doclava/ClearPage.java
@@ -223,8 +223,10 @@
 
   public static ArrayList<String> DROIDDOC_VALID_CONTENT_TYPES = new ArrayList<String>(Arrays.asList(".txt", ".css",
     ".js", ".html", ".ico", ".png", ".jpg", ".gif", ".svg", ".webm", ".ogv","mp4", ".java", ".xml", ".aidl", ".rs",".zip", ".yaml"));
-
-  public static ArrayList<String> DROIDDOC_EXCEPTED_CONTENT_TYPES = new ArrayList<String>(Arrays.asList(".pdf"));
+  /* Setting excepted types to allow everything. Leaving it this way in in case we want to explicitly
+   * specify file types later. This adds unneeded checking though since it lets everything through
+   */
+  public static ArrayList<String> DROIDDOC_EXCEPTED_CONTENT_TYPES = new ArrayList<String>(Arrays.asList(""));
 
   public static boolean isValidContentType(boolean allowExcepted, String s, ArrayList<String> list) {
     if(allowExcepted){
diff --git a/src/com/google/doclava/DocFile.java b/src/com/google/doclava/DocFile.java
index dd0a6bc..9e56235 100644
--- a/src/com/google/doclava/DocFile.java
+++ b/src/com/google/doclava/DocFile.java
@@ -24,8 +24,8 @@
 
 
 public class DocFile {
-  private static final Pattern LINE = Pattern.compile("(.*)[\r]?\n", Pattern.MULTILINE);
-  private static final Pattern PROP = Pattern.compile("([^=]+)=(.*)");
+  public static final Pattern LINE = Pattern.compile("(.*)[\r]?\n", Pattern.MULTILINE);
+  public static final Pattern PROP = Pattern.compile("([^=]+)=(.*)");
 
   public static String readFile(String filename) {
     try {
diff --git a/src/com/google/doclava/Doclava.java b/src/com/google/doclava/Doclava.java
index 168361d..30ef4da 100644
--- a/src/com/google/doclava/Doclava.java
+++ b/src/com/google/doclava/Doclava.java
@@ -27,6 +27,7 @@
 
 import java.util.*;
 import java.util.jar.JarFile;
+import java.util.regex.Matcher;
 import java.io.*;
 import java.lang.reflect.Proxy;
 import java.lang.reflect.Array;
@@ -797,7 +798,11 @@
     ClearPage.write(timedata, "timestamp.cs", "timestamp.js");
   }
 
+  /** Go through the docs and generate meta-data about each
+      page to use in search suggestions */
   public static void writeLists() {
+
+    // Write the lists for API references
     Data data = makeHDF();
 
     ClassInfo[] classes = Converter.rootClasses();
@@ -835,8 +840,96 @@
       }
       i++;
     }
-
     ClearPage.write(data, "lists.cs", javadocDir + "lists.js");
+
+
+    // Write the lists for JD documents
+    Data jddata = makeHDF();
+    Iterator counter = new Iterator();
+    for (String htmlDir : inputPathHtmlDirs) {
+      File dir = new File(htmlDir);
+      if (!dir.isDirectory()) {
+        continue;
+      }
+      writeJdDirList(dir, jddata, counter);
+    }
+    ClearPage.write(jddata, "jd_lists.cs", javadocDir + "jd_lists.js");
+  }
+
+  private static class Iterator {
+    int i = 0;
+  }
+
+  /** Write meta-data for a JD file, used for search suggestions */
+  private static void writeJdDirList(File dir, Data data, Iterator counter) {
+    File[] files = dir.listFiles();
+    int i, count = files.length;
+    // Loop all files in given directory
+    for (i = 0; i < count; i++) {
+      File f = files[i];
+      if (f.isFile()) {
+        String filePath = f.getAbsolutePath();
+        String templ = f.getName();
+        int len = templ.length();
+        // If it's a .jd file we want to process
+        if (len > 3 && ".jd".equals(templ.substring(len - 3))) {
+          // remove the directories below the site root
+          String webPath = filePath.substring(filePath.indexOf("docs/html/") + 10, filePath.length());
+          // replace .jd with .html
+          webPath = webPath.substring(0, webPath.length() - 3) + htmlExtension;
+          // Parse the .jd file for properties data at top of page
+          Data hdf = Doclava.makeHDF();
+          String filedata = DocFile.readFile(filePath);
+          Matcher lines = DocFile.LINE.matcher(filedata);
+          String line = null;
+          // Get each line to add the key-value to hdf
+          while (lines.find()) {
+            line = lines.group(1);
+            if (line.length() > 0) {
+              // Stop when we hit the body
+              if (line.equals("@jd:body")) {
+                break;
+              }
+              Matcher prop = DocFile.PROP.matcher(line);
+              if (prop.matches()) {
+                String key = prop.group(1);
+                String value = prop.group(2);
+                hdf.setValue(key, value);
+              } else {
+                break;
+              }
+            }
+          } // done gathering page properties
+
+          // Insert the goods into HDF data (title, link, tags, type)
+          String title = hdf.getValue("page.title", "");
+          title = title.replaceAll("\"", "'");
+          // if there's a <span> in the title, get rid of it
+          if (title.indexOf("<span") != -1) {
+            String[] splitTitle = title.split("<span(.*?)</span>");
+            title = splitTitle[0];
+            for (int j = 1; j < splitTitle.length; j++) {
+              title.concat(splitTitle[j]);
+            }
+          }
+          String tags = hdf.getValue("page.tags", "");
+          String dirName = (webPath.indexOf("/") != -1)
+                  ? webPath.substring(0, webPath.indexOf("/")) : "";
+
+          if (!"".equals(title) &&
+              !"intl".equals(dirName) &&
+              !hdf.getBooleanValue("excludeFromSuggestions")) {
+            data.setValue("docs.pages." + counter.i + ".label", title);
+            data.setValue("docs.pages." + counter.i + ".link", webPath);
+            data.setValue("docs.pages." + counter.i + ".tags", tags);
+            data.setValue("docs.pages." + counter.i + ".type", dirName);
+            counter.i++;
+          }
+        }
+      } else if (f.isDirectory()) {
+        writeJdDirList(f, data, counter);
+      }
+    }
   }
 
   public static void cantStripThis(ClassInfo cl, HashSet<ClassInfo> notStrippable) {