2013-02-13 26 views
0

這裏是我的谷歌的部分Google Apps腳本的HTML模板:谷歌Apps腳本的HTML模板的SyntaxError

<? if (filter == "ticket"){ var feedback = sortFeedbackByDate(getRecentTicketFeedback()); } 
    else if (filter == "all"){ var feedback = sortFeedbackByDate(getAllRecentFeedback()); } 
    else { var feedback = getRecentBomgarFeedback(); } 
    var percHappy = getNumHappy(feedback)/feedback.length; 
    var percOK = getNumOK(feedback)/feedback.length; 
    var percSad = getNumSad(feedback)/feedback.length; ?> 

當此模板調用引用代碼(),這部分如下:

if (filter == "ticket"){ ; 
    output._ = '     <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1&filter=ticket" ; output._ = '\">Ticket Feedback</option>\n'; 
    output._ = '     <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1" ; output._ = '\">Bomgar Feedback</option>\n'; 
    output._ = '     <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1&filter=all" ; output._ = '\">All Feedback</option>\n'; 
    output._ = '    '; } else if (filter == "all" { ; 
    output._ = '     <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1&filter=ticket" ; output._ = '\">Ticket Feedback</option>\n'; 
    output._ = '     <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1&filter=all" ; output._ = '\">All Feedback</option>\n'; 
    output._ = '     <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1" ; output._ = '\">Bomgar Feedback</option>\n'; 
    output._ = '    '; } else { ; 
    output._ = '     <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1" ; output._ = '\">Bomgar Feedback</option>\n'; 
    output._ = '     <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1&filter=ticket" ; output._ = '\">Ticket Feedback</option>\n'; 
    output._ = '     <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1&filter=all" ; output._ = '\">All Feedback</option>\n'; 
    output._ = '    '; } ; 

如您所見,在模板中存在以下行:

else if (filter == "all"){ 

這被看作是從調用getCode()

else if (filter == "all" { 

這顯然會導致語法錯誤。我是否在這裏犯過一些錯誤,或者這是js代碼生成中的錯誤?

感謝

回答

0

我會說,它看起來像一個錯誤,但我想你的片斷,並沒有看到這個bug,並引用代碼()結果,你都呈現完全不對應模板您正在展示的代碼段。你能顯示導致錯誤的實際代碼嗎?

如果您在將getCode()與原始模板代碼進行匹配時遇到問題,請嘗試使用getCodeWithComments()。