Update gitiles for Soy template import syntax

Soy is in the process of removing FQN template calls.

PiperOrigin-RevId: 355221102
Change-Id: If03b567b1c23a5151fbafff1c1c6d4f44dc42b7b
diff --git a/WORKSPACE b/WORKSPACE
index 453894b..a762de1 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -126,8 +126,8 @@
 
 maven_jar(
     name = "soy",
-    artifact = "com.google.template:soy:2019-10-08",
-    sha1 = "4518bf8bac2dbbed684849bc209c39c4cb546237",
+    artifact = "com.google.template:soy:2021-02-01",
+    sha1 = "8e833744832ba88059205a1e30e0898f925d8cb5",
 )
 
 maven_jar(
diff --git a/java/com/google/gitiles/DebugRenderer.java b/java/com/google/gitiles/DebugRenderer.java
index 5e35e57..83ddd9e 100644
--- a/java/com/google/gitiles/DebugRenderer.java
+++ b/java/com/google/gitiles/DebugRenderer.java
@@ -55,7 +55,7 @@
       } catch (URISyntaxException e) {
         throw new IllegalStateException(e);
       }
-      builder.add(template);
+      builder.add(template, toSoySrcPath(template));
     }
     return builder.build().compileTemplates();
   }
diff --git a/java/com/google/gitiles/DefaultRenderer.java b/java/com/google/gitiles/DefaultRenderer.java
index 0307862..0599034 100644
--- a/java/com/google/gitiles/DefaultRenderer.java
+++ b/java/com/google/gitiles/DefaultRenderer.java
@@ -47,7 +47,7 @@
         siteTitle);
     SoyFileSet.Builder builder = SoyFileSet.builder().setCompileTimeGlobals(this.globals);
     for (URL template : templates.values()) {
-      builder.add(template);
+      builder.add(template, toSoySrcPath(template));
     }
     sauce = builder.build().compileTemplates();
   }
diff --git a/java/com/google/gitiles/Renderer.java b/java/com/google/gitiles/Renderer.java
index dbd5590..780ee90 100644
--- a/java/com/google/gitiles/Renderer.java
+++ b/java/com/google/gitiles/Renderer.java
@@ -225,4 +225,14 @@
   }
 
   protected abstract SoySauce getSauce();
+
+  /**
+   * Give a resource URL of a soy template file, returns the import path for use in a Soy import
+   * statement.
+   */
+  protected String toSoySrcPath(URL templateUrl) {
+    String filePath = templateUrl.getPath();
+    String fileName = filePath.substring(filePath.lastIndexOf('/') + 1);
+    return "com/google/gitiles/templates/" + fileName;
+  }
 }
diff --git a/resources/com/google/gitiles/templates/BlameDetail.soy b/resources/com/google/gitiles/templates/BlameDetail.soy
index fa68ac7..e495093 100644
--- a/resources/com/google/gitiles/templates/BlameDetail.soy
+++ b/resources/com/google/gitiles/templates/BlameDetail.soy
@@ -13,10 +13,13 @@
 // limitations under the License.
 {namespace gitiles}
 
+import * as common from 'com/google/gitiles/templates/Common.soy';
+import * as objDetail from 'com/google/gitiles/templates/ObjectDetail.soy';
+
 /**
  * Detail page showing blame info for a file.
  */
-{template .blameDetail stricthtml="false"}
+{template blameDetail stricthtml="false"}
   {@param title: ?}  /** human-readable revision name. */
   {@param repositoryName: ?}  /** name of this repository. */
   {@param? menuEntries: ?}  /** menu entries. */
@@ -36,12 +39,12 @@
       */
   {@inject staticUrls: ?}
 {if $regions}
-  {call .header data="all"}
+  {call common.header data="all"}
     {param css: [$staticUrls.PRETTIFY_CSS_URL] /}
     {param containerClass: 'Container--fullWidth' /}
   {/call}
 
-  {call .blobHeader data="$data" /}
+  {call objDetail.blobHeader data="$data" /}
 
   <table class="Blame">
     {for $line in $data.lines}
@@ -72,8 +75,8 @@
     {/for}
   </table>
 {else}
-  {call .header data="all" /}
-  {call .blobDetail data="$data" /}
+  {call common.header data="all" /}
+  {call objDetail.blobDetail data="$data" /}
   <div class="FileContents-binary">
     {msg desc="blame not available for binary file"}
       No blame information available
@@ -81,7 +84,7 @@
   </div>
 {/if}
 
-{call .footer}
+{call common.footer}
   {param customVariant: $customVariant /}
 {/call}
 {/template}
diff --git a/resources/com/google/gitiles/templates/Common.soy b/resources/com/google/gitiles/templates/Common.soy
index 82c77ba..af1c49e 100644
--- a/resources/com/google/gitiles/templates/Common.soy
+++ b/resources/com/google/gitiles/templates/Common.soy
@@ -16,7 +16,7 @@
 /**
  * Common header for Gitiles.
  */
-{template .header stricthtml="false"}
+{template header stricthtml="false"}
   {@param title: ?}  /** title for this page. Always suffixed with repository name and a sitewide
       title. */
   {@param? repositoryName: ?}  /** repository name for this page, if applicable. */
@@ -148,7 +148,7 @@
  * The footer tag part can be customized by creating a customFooter
  * variant template.
  */
-{template .footer stricthtml="false"}
+{template footer stricthtml="false"}
   {@param? customVariant: ?}  /** variant name for custom styling. */
     </div> <!-- Container -->
   </div> <!-- Site-content -->
@@ -163,6 +163,6 @@
  * Insert this in a template to use with
  * Renderer#renderStreaming(HttpServletResponse, String).
  */
-{template .streamingPlaceholder}
+{template streamingPlaceholder}
 <br id="STREAMED_OUTPUT_BLOCK">
 {/template}
diff --git a/resources/com/google/gitiles/templates/DiffDetail.soy b/resources/com/google/gitiles/templates/DiffDetail.soy
index 38e483b..782d006 100644
--- a/resources/com/google/gitiles/templates/DiffDetail.soy
+++ b/resources/com/google/gitiles/templates/DiffDetail.soy
@@ -13,10 +13,13 @@
 // limitations under the License.
 {namespace gitiles}
 
+import * as common from 'com/google/gitiles/templates/Common.soy';
+import * as objDetail from 'com/google/gitiles/templates/ObjectDetail.soy';
+
 /**
  * Detail page showing diffs for a single commit.
  */
-{template .diffDetail stricthtml="false"}
+{template diffDetail stricthtml="false"}
   {@param title: ?}  /** human-readable revision name. */
   {@param repositoryName: ?}  /** name of this repository. */
   {@param? menuEntries: ?}  /** menu entries. */
@@ -24,14 +27,14 @@
   {@param breadcrumbs: ?}  /** breadcrumbs for this page. */
   {@param? commit: ?}  /** optional commit for which diffs are displayed, with keys corresponding to
       the gitiles.commitDetail template (minus "diffTree"). */
-{call .header data="all" /}
+  {call common.header data="all" /}
 
 {if $commit}
-  {call .commitDetail data="$commit" /}
+  {call objDetail.commitDetail data="$commit" /}
 {/if}
-{call .streamingPlaceholder /}
+  {call common.streamingPlaceholder /}
 
-{call .footer}
+{call common.footer}
   {param customVariant: $customVariant /}
 {/call}
 {/template}
@@ -39,7 +42,7 @@
 /**
  * File header for a single unified diff patch.
  */
-{template .diffHeader}
+{template diffHeader}
   {@param firstParts: ?}  /** parts of the first line of the header, with "text" and optional "url"
       fields. */
   {@param rest: ?}  /** remaining lines of the header, if any. */
diff --git a/resources/com/google/gitiles/templates/Doc.soy b/resources/com/google/gitiles/templates/Doc.soy
index 28dad26..c541033 100644
--- a/resources/com/google/gitiles/templates/Doc.soy
+++ b/resources/com/google/gitiles/templates/Doc.soy
@@ -13,6 +13,8 @@
 // limitations under the License.
 {namespace gitiles}
 
+import * as common from 'com/google/gitiles/templates/Common.soy';
+
 /**
  * Default Doc Footer
  */
@@ -36,7 +38,7 @@
 /**
  * Documentation page rendered from markdown.
  */
-{template .markdownDoc}
+{template markdownDoc}
   {@param? siteTitle: ?}  /** h1 title from navbar.md. */
   {@param pageTitle: ?}  /** h1 title from specific page. */
   {@param? logoUrl: ?}  /** url of image logo. */
@@ -77,7 +79,7 @@
   <div class="Site-content Site-Content--markdown">
     <div class="Container">
       <div class="doc">
-        {call .streamingPlaceholder /}
+        {call common.streamingPlaceholder /}
       </div>
     </div>
   </div>
diff --git a/resources/com/google/gitiles/templates/Error.soy b/resources/com/google/gitiles/templates/Error.soy
index 39fcef3..7ca5024 100644
--- a/resources/com/google/gitiles/templates/Error.soy
+++ b/resources/com/google/gitiles/templates/Error.soy
@@ -13,15 +13,17 @@
 // limitations under the License.
 {namespace gitiles}
 
+import * as common from 'com/google/gitiles/templates/Common.soy';
+
 /**
  * HTML page for error.
  */
-{template .error stricthtml="false"}
+{template error stricthtml="false"}
   {@param? title: ?}  /** page title. */
   {@param? menuEntries: ?}  /** menu entries. */
   {@param? customVariant: ?}  /** variant name for custom styling. */
   {@param? breadcrumbs: ?}  /** map of breadcrumbs for header. */
-{call .header}
+{call common.header}
   {param title: $title /}
   {param menuEntries: $menuEntries /}
   {param breadcrumbs: $breadcrumbs /}
@@ -33,7 +35,7 @@
   {/msg}
 </h1>
 
-{call .footer}
+{call common.footer}
   {param customVariant: $customVariant /}
 {/call}
 {/template}
diff --git a/resources/com/google/gitiles/templates/HostIndex.soy b/resources/com/google/gitiles/templates/HostIndex.soy
index 5a05304..a8d84f8 100644
--- a/resources/com/google/gitiles/templates/HostIndex.soy
+++ b/resources/com/google/gitiles/templates/HostIndex.soy
@@ -13,10 +13,12 @@
 // limitations under the License.
 {namespace gitiles}
 
+import * as common from 'com/google/gitiles/templates/Common.soy';
+
 /**
  * HTML page for /.
  */
-{template .hostIndex stricthtml="false"}
+{template hostIndex stricthtml="false"}
   {@param hostName: ?}  /** host name. */
   {@param? menuEntries: ?}  /** menu entries. */
   {@param? customVariant: ?}  /** variant name for custom styling. */
@@ -24,7 +26,7 @@
   {@param? breadcrumbs: ?}  /** map of breadcrumbs for header. */
   {@param repositories: ?}  /** list of repository description maps with name, cloneUrl, and
       optional description values. */
-{call .header}
+{call common.header}
   {param title: $prefix ? $prefix : $hostName ? $hostName + ' Git repositories' : 'Git repositories' /}
   {param menuEntries: $menuEntries /}
   {param breadcrumbs: $breadcrumbs /}
@@ -62,7 +64,7 @@
   </div>
 {/if}
 
-{call .footer}
+{call common.footer}
   {param customVariant: $customVariant /}
 {/call}
 {/template}
diff --git a/resources/com/google/gitiles/templates/LogDetail.soy b/resources/com/google/gitiles/templates/LogDetail.soy
index 6b9a573..a99c1d2 100644
--- a/resources/com/google/gitiles/templates/LogDetail.soy
+++ b/resources/com/google/gitiles/templates/LogDetail.soy
@@ -13,10 +13,13 @@
 // limitations under the License.
 {namespace gitiles}
 
+import * as common from 'com/google/gitiles/templates/Common.soy';
+import * as objDetail from 'com/google/gitiles/templates/ObjectDetail.soy';
+
 /**
  * Detail page showing a shortlog for a commit.
  */
-{template .logDetail stricthtml="false"}
+{template logDetail stricthtml="false"}
   {@param title: ?}  /** human-readable revision name. */
   {@param repositoryName: ?}  /** name of this repository. */
   {@param? menuEntries: ?}  /** menu entries. */
@@ -24,7 +27,7 @@
   {@param breadcrumbs: ?}  /** breadcrumbs for this page. */
   {@param? tags: ?}  /** optional list of tags encountered when peeling this object, with keys
       corresponding to gitiles.tagDetail. */
-{call .header data="all" /}
+  {call common.header data="all" /}
 
 {if $tags}
   {for $tag in $tags}
@@ -32,9 +35,9 @@
   {/for}
 {/if}
 
-{call .streamingPlaceholder /}
+{call common.streamingPlaceholder /}
 
-{call .footer}
+{call common.footer}
   {param customVariant: $customVariant /}
 {/call}
 {/template}
@@ -43,7 +46,7 @@
 /**
  * Header for list of log entries.
  */
-{template .logEntriesHeader stricthtml="false"}
+{template logEntriesHeader stricthtml="false"}
   {@param? previousUrl: ?}  /** URL for the previous page of results. */
 {if $previousUrl}
   <nav class="LogNav">
@@ -58,7 +61,7 @@
 /**
  * Wrapper for a single log entry with pretty format and variant.
  */
-{template .logEntryWrapper}
+{template logEntryWrapper}
   {@param variant: ?}  /** variant name for log entry template. */
   {@param entry: ?}  /** log entry; see .logEntry. */
 <li class="CommitLog-item CommitLog-item--{$variant}">
@@ -70,7 +73,7 @@
 /**
  * Footer for the list of log entries.
  */
-{template .logEntriesFooter stricthtml="false"}
+{template logEntriesFooter stricthtml="false"}
   {@param? nextUrl: ?}  /** URL for the next page of results. */
   {@param? nextText: ?}  /** text for next page link. */
 </ol>
@@ -85,7 +88,7 @@
 /**
  * Single log entry indicating the full log is empty.
  */
-{template .emptyLog}
+{template emptyLog}
 <li class="CommitLog-item CommitLog-item--empty">{msg desc="informational text for when the log is empty"}No commits.{/msg}</li>
 {/template}
 
@@ -221,12 +224,16 @@
   </tr>
   <tr>
     <th class="Metadata-title">{msg desc="Header for commit author"}author{/msg}</th>
-    <td>{call .person_ data="$author" /}</td>
+    <td>
+      {call objDetail.person_ data="$author" /}
+    </td>
     <td>{$author.time}</td>
   </tr>
   <tr>
     <th class="Metadata-title">{msg desc="Header for committer"}committer{/msg}</th>
-    <td>{call .person_ data="$committer" /}</td>
+    <td>
+      {call objDetail.person_ data="$committer" /}
+    </td>
     <td>{$committer.time}</td>
   </tr>
 
diff --git a/resources/com/google/gitiles/templates/ObjectDetail.soy b/resources/com/google/gitiles/templates/ObjectDetail.soy
index f755720..ac5d98e 100644
--- a/resources/com/google/gitiles/templates/ObjectDetail.soy
+++ b/resources/com/google/gitiles/templates/ObjectDetail.soy
@@ -16,7 +16,7 @@
 /**
  * Detailed listing of a commit.
  */
-{template .commitDetail}
+{template commitDetail}
   {@param author: ?}  /** map with "name", "email", and "time" keys for the commit author. */
   {@param committer: ?}  /** map with "name", "email", and "time" keys for the committer. */
   {@param sha: ?}  /** commit SHA-1. */
@@ -58,12 +58,16 @@
     </tr>
     <tr>
       <th class="Metadata-title">{msg desc="Header for commit author"}author{/msg}</th>
-      <td>{call .person_ data="$author" /}</td>
+      <td>
+        {call person_ data="$author" /}
+      </td>
       <td>{$author.time}</td>
     </tr>
     <tr>
       <th class="Metadata-title">{msg desc="Header for committer"}committer{/msg}</th>
-      <td>{call .person_ data="$committer" /}</td>
+      <td>
+        {call person_ data="$committer" /}
+      </td>
       <td>{$committer.time}</td>
     </tr>
     <tr>
@@ -86,7 +90,7 @@
     {/for}
   </table>
 </div>
-{call .message_}
+{call message_}
   {param className: 'u-pre u-monospace MetadataMessage' /}
   {param message: $message /}
 {/call}
@@ -146,7 +150,7 @@
 /**
  * Detailed listing of a tree.
  */
-{template .treeDetail}
+{template treeDetail}
   {@param sha: ?}  /** SHA of this path's tree. */
   {@param? logUrl: ?}  /** optional URL to a log for this path. */
   {@param? archiveUrl: ?}  /** optional URL to a download link of this tree as an archive. */
@@ -222,7 +226,7 @@
 /**
  * Common header for a blob shared between detail, blame, etc. views.
  */
-{template .blobHeader}
+{template blobHeader}
   {@param sha: ?}  /** SHA of this file's blob. */
   {@param? fileUrl: ?}  /** optional URL to a detail view of this file. */
   {@param? logUrl: ?}  /** optional URL to a log for this file. */
@@ -240,14 +244,14 @@
 /**
  * Detailed listing of a blob.
  */
-{template .blobDetail}
+{template blobDetail}
   {@param sha: ?}  /** SHA of this file's blob. */
   {@param? logUrl: ?}  /** optional URL to a log for this file. */
   {@param? blameUrl: ?}  /** optional URL to a blame for this file. */
   {@param lines: ?}  /** lines (may be empty), or null for a binary file. Each line is a list of
       entries with "classes" and "text" fields for pretty-printed spans. */
   {@param? size: ?}  /** for binary files only, size in bytes. */
-  {call .blobHeader data="all" /}
+  {call blobHeader data="all" /}
 
   {if $lines != null}
     {if $lines}
@@ -278,7 +282,7 @@
 /**
  * Detailed listing of an annotated tag.
  */
-{template .tagDetail}
+{template tagDetail}
   {@param sha: ?}  /** SHA of this tag. */
   {@param? tagger: ?}  /** optional map with "name", "email", and "time" keys for the tagger. */
   {@param object: ?}  /** SHA of the object this tag points to. */
@@ -293,7 +297,9 @@
     {if $tagger}
       <tr>
         <th class="Metadata-title">{msg desc="Header for tagger"}tagger{/msg}</th>
-        <td>{call .person_ data="$tagger" /}</td>
+        <td>
+          {call person_ data="$tagger" /}
+        </td>
         <td>{$tagger.time}</td>
       </tr>
     {/if}
@@ -305,7 +311,7 @@
   </table>
 </div>
 {if $message and length($message)}
-  {call .message_}
+  {call message_}
     {param className: 'u-pre u-monospace MetadataMessage' /}
     {param message: $message /}
   {/call}
@@ -315,7 +321,7 @@
 /**
  * Line about a git person identity.
  */
-{template .person_}
+{template person_}
   {@param name: ?}  /** name. */
   {@param email: ?}  /** email. */
 {$name}{if $email} &lt;{$email}&gt;{/if}
@@ -324,7 +330,7 @@
 /**
  * Preformatted message, possibly containing hyperlinks.
  */
-{template .message_ visibility="private"}
+{template message_ visibility="private"}
   {@param className: ?}  /** CSS class name for <pre> block. */
   {@param message: ?}  /** list of message parts, where each part contains:
       text: raw text of the part.
diff --git a/resources/com/google/gitiles/templates/PathDetail.soy b/resources/com/google/gitiles/templates/PathDetail.soy
index 7dd283b..fb0936b 100644
--- a/resources/com/google/gitiles/templates/PathDetail.soy
+++ b/resources/com/google/gitiles/templates/PathDetail.soy
@@ -13,10 +13,13 @@
 // limitations under the License.
 {namespace gitiles}
 
+import * as common from 'com/google/gitiles/templates/Common.soy';
+import * as objDetail from 'com/google/gitiles/templates/ObjectDetail.soy';
+
 /**
  * Detail page for a path within a tree.
  */
-{template .pathDetail stricthtml="false"}
+{template pathDetail stricthtml="false"}
   {@param title: ?}  /** human-readable name of this path. */
   {@param repositoryName: ?}  /** name of this repository. */
   {@param? menuEntries: ?}  /** menu entries. */
@@ -28,30 +31,35 @@
       .symlinkDetail, or .gitlinkDetail as appropriate. */
   {@inject staticUrls: ?}
 {if $type == 'REGULAR_FILE' or $type == 'EXECUTABLE_FILE'}
-  {call .header data="all"}
+  {call common.header data="all"}
     {param css: [$staticUrls.PRETTIFY_CSS_URL] /}
   {/call}
 {elseif $data.readmeHtml}
-  {call .header data="all"}
+  {call common.header data="all"}
     {param css: [$staticUrls.DOC_CSS_URL, $staticUrls.PRETTIFY_CSS_URL] /}
   {/call}
 {else}
-  {call .header data="all" /}
+  {call common.header data="all" /}
 {/if}
 
 {switch $type}
-  {case 'TREE'}{call .treeDetail data="$data" /}
-  {case 'SYMLINK'}{call .symlinkDetail data="$data" /}
-  {case 'REGULAR_FILE'}{call .blobDetail data="$data" /}
-  {case 'EXECUTABLE_FILE'}{call .blobDetail data="$data" /}
-  {case 'GITLINK'}{call .gitlinkDetail data="$data" /}
+  {case 'TREE'}
+    {call objDetail.treeDetail data="$data" /}
+  {case 'SYMLINK'}
+    {call symlinkDetail data="$data" /}
+  {case 'REGULAR_FILE'}
+    {call objDetail.blobDetail data="$data" /}
+  {case 'EXECUTABLE_FILE'}
+    {call objDetail.blobDetail data="$data" /}
+  {case 'GITLINK'}
+    {call gitlinkDetail data="$data" /}
   {default}
     <div class="error">
       {msg desc="Error message for an unknown object type"}Object has unknown type.{/msg}
     </div>
 {/switch}
 
-{call .footer}
+{call common.footer}
   {param customVariant: $customVariant /}
 {/call}
 {/template}
@@ -59,7 +67,7 @@
 /**
  * Detail for a symbolic link.
  */
-{template .symlinkDetail}
+{template symlinkDetail}
   {@param target: ?}  /** target of this symlink. */
   {@param? targetUrl: ?}  /** optional URL for the target, if it is within this repo. */
 <div class="symlink-detail">
@@ -71,7 +79,7 @@
 /**
  * Detail for a git submodule link.
  */
-{template .gitlinkDetail}
+{template gitlinkDetail}
   {@param sha: ?}  /** submodule commit SHA. */
   {@param remoteUrl: ?}  /** URL of the remote repository. */
   {@param? httpUrl: ?}  /** optional HTTP URL pointing to a web-browser-compatible URL of the remote
diff --git a/resources/com/google/gitiles/templates/RefList.soy b/resources/com/google/gitiles/templates/RefList.soy
index 0815d41..112573b 100644
--- a/resources/com/google/gitiles/templates/RefList.soy
+++ b/resources/com/google/gitiles/templates/RefList.soy
@@ -13,18 +13,19 @@
 // limitations under the License.
 {namespace gitiles}
 
+import * as common from 'com/google/gitiles/templates/Common.soy';
 
 /**
  * List of all refs in a repository.
  */
-{template .refsDetail stricthtml="false"}
+{template refsDetail stricthtml="false"}
   {@param repositoryName: ?}  /** name of this repository. */
   {@param? menuEntries: ?}  /** menu entries. */
   {@param? customVariant: ?}  /** variant name for custom styling. */
   {@param breadcrumbs: ?}  /** breadcrumbs for this page. */
   {@param branches: ?}  /** list of branch objects with url, name, and isHead keys. */
   {@param tags: ?}  /** list of tag objects with url and name keys. */
-{call .header}
+{call common.header}
   {param title: 'Refs' /}
   {param repositoryName: $repositoryName /}
   {param menuEntries: $menuEntries /}
@@ -34,21 +35,21 @@
 
 <div class="Refs">
   {if length($branches)}
-    {call .refList}
+    {call refList}
       {param type: 'Branches' /}
       {param refs: $branches /}
     {/call}
   {/if}
 
   {if length($tags)}
-    {call .refList}
+    {call refList}
       {param type: 'Tags' /}
       {param refs: $tags /}
     {/call}
   {/if}
 </div>
 
-{call .footer}
+{call common.footer}
   {param customVariant: $customVariant /}
 {/call}
 {/template}
@@ -56,7 +57,7 @@
 /**
  * List of a single type of refs
  */
-{template .refList}
+{template refList}
   {@param type: ?}  /** name of this type of refs, e.g. "Branches" */
   {@param refs: ?}  /** list of branch objects with url, name, and optional isHead keys. */
   <div class="RefList">
diff --git a/resources/com/google/gitiles/templates/RepositoryIndex.soy b/resources/com/google/gitiles/templates/RepositoryIndex.soy
index 0a27d47..ca83cab 100644
--- a/resources/com/google/gitiles/templates/RepositoryIndex.soy
+++ b/resources/com/google/gitiles/templates/RepositoryIndex.soy
@@ -13,10 +13,13 @@
 // limitations under the License.
 {namespace gitiles}
 
+import * as common from 'com/google/gitiles/templates/Common.soy';
+import * as refList from 'com/google/gitiles/templates/RefList.soy';
+
 /**
  * Index page for a repository.
  */
-{template .repositoryIndex stricthtml="false"}
+{template repositoryIndex stricthtml="false"}
   {@param repositoryName: ?}  /** name of this repository. */
   {@param? menuEntries: ?}  /** menu entries. */
   {@param? customVariant: ?}  /** variant name for custom styling. */
@@ -32,16 +35,16 @@
   {@param? readmeHtml: ?}  /** optional rendered README.md contents. */
   {@inject staticUrls: ?}
 {if $readmeHtml}
-  {call .header data="all"}
+  {call common.header data="all"}
     {param title: $repositoryName /}
     {param repositoryName: null /}
     {param menuEntries: $menuEntries /}
     {param customVariant: $customVariant /}
     {param breadcrumbs: $breadcrumbs /}
-    {param css: [$staticUrls.DOC_CSS_URL] /}
+    {param css: [$staticUrls['DOC_CSS_URL']] /}
   {/call}
 {else}
-  {call .header}
+  {call common.header}
     {param title: $repositoryName /}
     {param repositoryName: null /}
     {param menuEntries: $menuEntries /}
@@ -72,11 +75,11 @@
 {if $hasLog and (length($branches) or length($tags))}
   <div class="RepoShortlog">
     <div class="RepoShortlog-refs">
-      {call .branches_ data="all" /}
-      {call .tags_ data="all" /}
+      {call branches_ data="all" /}
+      {call tags_ data="all" /}
     </div>
     <div class="RepoShortlog-log">
-      {call .streamingPlaceholder /}
+      {call common.streamingPlaceholder /}
       {if $readmeHtml}
         <div class="doc RepoIndexDoc">{$readmeHtml}</div>
       {/if}
@@ -84,16 +87,16 @@
   </div>
 
 {elseif $hasLog}
-  {call .streamingPlaceholder /}
+  {call common.streamingPlaceholder /}
 {elseif length($branches) or length($tags)}
-  {call .branches_ data="all" /}
-  {call .tags_ data="all" /}
+  {call branches_ data="all" /}
+  {call tags_ data="all" /}
 {else}
   <h1 class="EmptyRepo-header">Empty Repository</h1>
   <p class="EmptyRepo-description">This repository is empty. Push to it to show branches and history.</p>
 {/if}
 
-{call .footer}
+{call common.footer}
   {param customVariant: $customVariant /}
 {/call}
 {/template}
@@ -101,11 +104,11 @@
 /**
  * List of branches.
  */
-{template .branches_ visibility="private"}
+{template branches_ visibility="private"}
   {@param? branches: ?}  /** list of branch objects with url and name keys. */
   {@param? moreBranchesUrl: ?}  /** URL to show more branches, if necessary. */
   {if length($branches)}
-    {call .refList}
+    {call refList.refList}
       {param type: 'Branches' /}
       {param refs: $branches /}
     {/call}
@@ -118,11 +121,11 @@
 /**
  * List of tags.
  */
-{template .tags_ visibility="private"}
+{template tags_ visibility="private"}
   {@param? tags: ?}  /** list of branch objects with url and name keys. */
   {@param? moreTagsUrl: ?}  /** URL to show more tags, if necessary. */
   {if length($tags)}
-    {call .refList}
+    {call refList.refList}
       {param type: 'Tags' /}
       {param refs: $tags /}
     {/call}
diff --git a/resources/com/google/gitiles/templates/RevisionDetail.soy b/resources/com/google/gitiles/templates/RevisionDetail.soy
index 06fa996..e520990 100644
--- a/resources/com/google/gitiles/templates/RevisionDetail.soy
+++ b/resources/com/google/gitiles/templates/RevisionDetail.soy
@@ -13,10 +13,13 @@
 // limitations under the License.
 {namespace gitiles}
 
+import * as common from 'com/google/gitiles/templates/Common.soy';
+import * as objDetail from 'com/google/gitiles/templates/ObjectDetail.soy';
+
 /**
  * Detail page about a single revision.
  */
-{template .revisionDetail stricthtml="false"}
+{template revisionDetail stricthtml="false"}
   {@param title: ?}  /** human-readable revision name. */
   {@param repositoryName: ?}  /** name of this repository. */
   {@param? menuEntries: ?}  /** menu entries. */
@@ -30,27 +33,27 @@
       ObjectDetail.soy. */
   {@inject staticUrls: ?}
 {if $hasBlob}
-  {call .header data="all"}
+  {call common.header data="all"}
     {param css: [$staticUrls.PRETTIFY_CSS_URL] /}
   {/call}
 {elseif $hasReadme}
-  {call .header data="all"}
+  {call common.header data="all"}
     {param css: [$staticUrls.DOC_CSS_URL, $staticUrls.PRETTIFY_CSS_URL] /}
   {/call}
 {else}
-  {call .header data="all" /}
+  {call common.header data="all" /}
 {/if}
 
 {for $object in $objects}
   {switch $object.type}
     {case 'commit'}
-      {call .commitDetail data="$object.data" /}
+      {call objDetail.commitDetail data="$object.data" /}
     {case 'tree'}
-      {call .treeDetail data="$object.data" /}
+      {call objDetail.treeDetail data="$object.data" /}
     {case 'blob'}
-      {call .blobDetail data="$object.data" /}
+      {call objDetail.blobDetail data="$object.data" /}
     {case 'tag'}
-      {call .tagDetail data="$object.data" /}
+      {call objDetail.tagDetail data="$object.data" /}
     {default}
       <div class="error">
         {msg desc="Error message for an unknown object type"}Object has unknown type.{/msg}
@@ -58,7 +61,7 @@
   {/switch}
 {/for}
 
-{call .footer}
+{call common.footer}
   {param customVariant: $customVariant /}
 {/call}
 {/template}