google-closuregoogle-closure-templates

Why am I missing soyDocs for my soy template?


Plovr is raises a compile-time exception when I try to compile this soy template.

// Copyright 2012 David Faux
/**
 * @overview Lays out the home page.
 */

{namespace templates.home}

/*
 * Lays out the home page.
 */
{template .main}
  <h1>Hi! Welcome to my experimental page.</h1>
  <img src="/images/logo.png" alt="" id="homeLogo" />
{/template}

Here is the error raised.

org.plovr.CheckedSoySyntaxException:
template templates.home.main: Not all code is in Soy V2 syntax
(missing SoyDoc for template {template .main}).

Why am I missing soy docs for this template?


Solution

  • The Closure Templates documentation for file structure states:

    Precede each template with a SoyDoc comment that explains the purpose of the template, in the same style as JavaDoc.

    JavaDoc comments must start with the begin-comment delimiter /** as shown in How to Write Doc Comments for the Javadoc Tool under Format of a Doc Comment.

    The template example above is missing the second asterisk in the SoyDoc comment. It should look as follows:

    /**
     * Lays out the home page.
     */
    {template .main}
      <h1>Hi! Welcome to my experimental page.</h1>
      <img src="/images/logo.png" alt="" id="homeLogo" />
    {/template}