9

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?

Christopher Peisert
  • 21,862
  • 3
  • 86
  • 117
dangerChihuahua007
  • 20,299
  • 35
  • 117
  • 206

2 Answers2

12

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}
Christopher Peisert
  • 21,862
  • 3
  • 86
  • 117
6
  1. to add more to cpeisert's answer all following three comment lines should begin with first column, i.e. there should be no white space before all following three lines.

    /**
    * Lays out the home page.
    */
    
  2. There should be no blank lines in the middle of these soy doc comment and soy code ( i.e. {template .main})

  3. {template .main} should also starts from column1 , i.e. there should no preceding white space.

Community
  • 1
  • 1
Arif Ali Saiyed
  • 657
  • 7
  • 11