0

Here is my code:

{template .someTemplate}
    {@param? icon : string} /** CSS class that loads and styles the icon */
    {@param? headlineHtml : any} /** Headline text with optional html for styling */
    {@param? textHtml : any} /** Subtext with optional html for styling */
    {@param? buttonText : string} /** The call to action text for the button */
    {@param? rejectButtonText : string} /** The text for choosing to reject the call to action */

....

When I try to compile I get an error saying:

Exception in thread "main" com.google.template.soy.base.SoySyntaxException: In file ./myfile.soy:7, template com.namespace.someTemplate: Not all code is in Soy V2 syntax (found tag {@param? icon : string} not in Soy V2 syntax).`

The only info I've found online seems to suggest this is correct syntax (per Google's site here, per this cheat sheet I found), though, and Googling for "soy v2" has not given me any results that explain what is correct Soy V2 syntax.

What's the correct way to define these parameters?

Reagankm
  • 4,780
  • 9
  • 27
  • 52

1 Answers1

0

It looks like this is the syntax:

{namespace test}

/**
 * This is a template.
 * @param name The name to say hello to
 */
{template .main}
Hello {$name}
{/template}

I also had trouble finding any documentation. I was getting the same errors saying that the {@param ...} syntax is not valid in V2. Then I found that the examples for soynode (like this one) use the comment syntax. Interestingly, it appears that this new syntax does not include a type definition at all, just a var name.

Graeme Hill
  • 623
  • 6
  • 11