简体   繁体   English

为什么我的大豆模板缺少soyDocs?

[英]Why am I missing soyDocs for my soy template?

Plovr is raises a compile-time exception when I try to compile this soy template. 当我尝试编译这个大豆模板时,Plovr引发了一个编译时异常。

// 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? 为什么我错过了这个模板的大豆文档?

The Closure Templates documentation for file structure states: 文件结构状态的Closure Templates文档:

Precede each template with a SoyDoc comment that explains the purpose of the template, in the same style as JavaDoc. 在每个模板的前面加上一个解释模板用途的SoyDoc注释,与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 . JavaDoc注释必须以begin-comment分隔符/**开头,如如何Doc Comment的格式为Javadoc工具编写Doc Comments

The template example above is missing the second asterisk in the SoyDoc comment. 上面的模板示例缺少SoyDoc评论中的第二个星号。 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}
  1. to add more to cpeisert's answer all following three comment lines should begin with first column, ie there should be no white space before all following three lines. 要向cpeisert的答案添加更多内容,以下三条注释行应以第一列开头,即在所有后续三行之前不应有空格。

     /** * Lays out the home page. */ 
  2. There should be no blank lines in the middle of these soy doc comment and soy code ( ie {template .main} ) 这些大豆文档评论和大豆代码中间应该没有空白行(即{template .main}

  3. {template .main} should also starts from column1 , ie there should no preceding white space. {template .main}也应该从column1开始,即不应该有前面的空格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM