2011-09-15 11 views
9

クロージャテンプレートを使用して作成された次のHTMLを取得するにはどうすればよいですか?方法:要素の属性値に中括弧が含まれているHTMLを生成するクロージャテンプレート

<input name="fullName" class="large" type="text" data-validate="{required:true, minlength: 5, maxlength:100, messages:{required:'Please provide your Full Name.', maxlength:'This field can contain maximum 100 characters.'}}"/> 

何か助けていただければ幸いです。

以下は今まで私が試したことです。

{namespace myApp.test} 
/** 
* Template for UI of Create User View 
* @param userToEdit It is the object returned from GET on User Resource. 
*/ 
{template .testUser autoescape="false"} 
    {{msg desc="<input id=\"fullName\" name=\"fullName\" class=\"large\" type=\"text\" value=\"{$userToEdit.FullName}\" data-validate=\"{required:true, minlength: 5, maxlength:100, messages:{required:\'Please provide your Full Name.\', maxlength:\'This field can contain maximum 100 characters.\'} }\" />"}} 
{/template} 

返信Malformed attributes in tagエラー。


{namespace myApp.test} 
/** 
* Template for UI of Create User View 
* @param userToEdit It is the object returned from GET on User Resource. 
*/ 
{{template .testUser autoescape="false"}} 
<input id="fullName" name="fullName" class="large" type="text" value="{{$userToEdit.FullName}}" data-validate="{required:true, minlength: 5, maxlength:100, messages:{required:'Please provide your Full Name.', maxlength:'This field can contain maximum 100 characters.'} }" /> 
{{/template}} 

戻りTag 'template' not at start of line [line 6, column 1].エラー。


{namespace myApp.test} 
/** 
* Template for UI of Create User View 
* @param userToEdit It is the object returned from GET on User Resource. 
*/ 
{template .testUser autoescape="false"} 
<input id="fullName" name="fullName" class="large" type="text" value="{$userToEdit.FullName}" data-validate="{required:true, minlength: 5, maxlength:100, messages:{required:'Please provide your Full Name.', maxlength:'This field can contain maximum 100 characters.'} }" /> 
{/template} 

返しtemplate .testUser: Left brace '{' not allowed within a Soy tag delimited by single braces (consider using double braces to delimit the Soy tag) [line 7, column 164].エラー。


{namespace myApp.test} 
/** 
* Template for UI of Create User View 
* @param userToEdit It is the object returned from GET on User Resource. 
*/ 
{template .testUser autoescape="false"} 
<input id="fullName" name="fullName" class="large" type="text" value="{$userToEdit.FullName}" data-validate="{{required:true, minlength: 5, maxlength:100, messages:{{required:'Please provide your Full Name.', maxlength:'This field can contain maximum 100 characters.'}} }}" /> 
{/template} 

返しtemplate .testUser: Double left brace '{{' not allowed within a Soy tag delimited by double braces (consider inserting a space: '{ {') [line 7, column 165].エラー。


{namespace myApp.test} 
/** 
* Template for UI of Create User View 
* @param userToEdit It is the object returned from GET on User Resource. 
*/ 
{template .testUser autoescape="false"} 
<input id="fullName" name="fullName" class="large" type="text" value="{$userToEdit.FullName}" data-validate="{{required:true, minlength: 5, maxlength:100, messages:{ {required:'Please provide your Full Name.', maxlength:'This field can contain maximum 100 characters.'} } }}" /> 
{/template} 

返しtemplate myApp.test.testUser: Not all code is in Soy V2 syntax (found tag {{print required:true, minlength: 5, maxlength:100, messages:{ {required:'Please provide your Full Name.', maxlength:'This field can contain maximum 100 characters.'} } }} not in Soy V2 syntax).エラー。

答えて

10

Literal Commandを使用すると、魅力的に機能しました。 Jimに感謝します。 "Special Characters" section in the documentation{lb}{rb}に基づいて

{namespace myApp.test} 
/** 
* Template for UI of Create User View 
* @param userToEdit It is the object returned from GET on User Resource. 
*/ 
{template .testUser autoescape="false"} 
<input name="fullName" value="{$userToEdit.FullName}" class="large" type="text" {literal}data-validate="{required:true, minlength: 5, maxlength:100, messages:{required:'Please provide your Full Name.', maxlength:'This field can contain maximum 100 characters.'}}"{/literal}/> 
{/template} 
-1

は、移動するための方法であるように見えます。これらは、それぞれ左括弧または右括弧をプレーンテキストとして出力に追加します。

関連する問題