Merge "Include PRETTIFY_CSS_URL on repository index landing page when README is present"
diff --git a/javatests/com/google/gitiles/ThemeTest.java b/javatests/com/google/gitiles/ThemeTest.java
index 2be83c4..7e91a65 100644
--- a/javatests/com/google/gitiles/ThemeTest.java
+++ b/javatests/com/google/gitiles/ThemeTest.java
@@ -51,6 +51,23 @@
   }
 
   @Test
+  public void repositoryIndexWithReadmeIncludesPrettifyCss() throws Exception {
+    repo.branch("master")
+        .commit()
+        .add("README.md", "# Hello Gitiles\n```python\nprint('hello')\n```")
+        .create();
+    repo.getRepository().updateRef("HEAD").link("refs/heads/master");
+    String html = buildHtml("/" + REPO_NAME + "/", false);
+    assertThat(html).contains("prettify/prettify.css");
+  }
+
+  @Test
+  public void repositoryIndexWithoutReadmeOmitsPrettifyCss() throws Exception {
+    String html = buildHtml("/" + REPO_NAME + "/", false);
+    assertThat(html).doesNotContain("prettify/prettify.css");
+  }
+
+  @Test
   public void docPageIncludesThemeScriptAndToggle() throws Exception {
     repo.branch("master").commit().add("README.md", "# Hello Gitiles\nDark mode test.").create();
     String html = buildHtml("/" + REPO_NAME + "/+doc/master/README.md", false);
diff --git a/resources/com/google/gitiles/templates/RepositoryIndex.soy b/resources/com/google/gitiles/templates/RepositoryIndex.soy
index f069055..af286f1 100644
--- a/resources/com/google/gitiles/templates/RepositoryIndex.soy
+++ b/resources/com/google/gitiles/templates/RepositoryIndex.soy
@@ -41,7 +41,7 @@
     {param menuEntries: $menuEntries /}
     {param customVariant: $customVariant /}
     {param breadcrumbs: $breadcrumbs /}
-    {param css: [$staticUrls['DOC_CSS_URL']] /}
+    {param css: [$staticUrls.DOC_CSS_URL, $staticUrls.PRETTIFY_CSS_URL] /}
   {/call}
 {else}
   {call common.header}