src/helper/text.js
function getRefText(ast){

    var ret = ast.leader;
    var isFn = ast.args !== undefined;

    if (ast.type === 'macro_call') {
      ret = '#';
    }

    if (ast.isWraped) ret += '{';

    if (isFn) {
      ret += getMethodText(ast);
    } else {
      ret += ast.id;
    }

    utils.forEach(ast.path, function(ref){
      //不支持method并且传递参数
      if (ref.type == 'method') {
        ret += '.' + getMethodText(ref);
      } else if (ref.type == 'index') {

        var text = '';
        var id = ref.id;

        if (id.type === 'integer') {

          text = id.value;

        } else if (id.type === 'string') {

          var sign = id.isEval? '"': "'";
          text = sign + id.value + sign;

        } else {

          text = getRefText(id);

        }

        ret += '[' + text + ']';

      } else if (ref.type == 'property') {

        ret += '.' + ref.id;

      }

    }, this);

    if (ast.isWraped) ret += '}';

    return ret;
  }
function getRefText(ast){

    var ret = ast.leader;
    var isFn = ast.args !== undefined;

    if (ast.type === 'macro_call') {
      ret = '#';
    }

    if (ast.isWraped) ret += '{';

    if (isFn) {
      ret += getMethodText(ast);
    } else {
      ret += ast.id;
    }

    utils.forEach(ast.path, function(ref){
      //不支持method并且传递参数
      if (ref.type == 'method') {
        ret += '.' + getMethodText(ref);
      } else if (ref.type == 'index') {

        var text = '';
        var id = ref.id;

        if (id.type === 'integer') {

          text = id.value;

        } else if (id.type === 'string') {

          var sign = id.isEval? '"': "'";
          text = sign + id.value + sign;

        } else {

          text = getRefText(id);

        }

        ret += '[' + text + ']';

      } else if (ref.type == 'property') {

        ret += '.' + ref.id;

      }

    }, this);

    if (ast.isWraped) ret += '}';

    return ret;
  }
function getRefText ( ast ) { var ret = ast . leader ; var isFn = ast . args !== undefined ; if ( ast . type === 'macro_call' ) { ret = '#' ; } if ( ast . isWraped ) ret += '{' ; if ( isFn ) { ret += getMethodText ( ast ) ; } else { ret += ast . id ; } utils . forEach ( ast . path , function ( ref ) { //不支持method并且传递参数 if ( ref . type == 'method' ) { ret += '.' + getMethodText ( ref ) ; } else if ( ref . type == 'index' ) { var text = '' ; var id = ref . id ; if ( id . type === 'integer' ) { text = id . value ; } else if ( id . type === 'string' ) { var sign = id . isEval ? '"' : "'" ; text = sign + id . value + sign ; } else { text = getRefText ( id ) ; } ret += '[' + text + ']' ; } else if ( ref . type == 'property' ) { ret += '.' + ref . id ; } } , this ) ; if ( ast . isWraped ) ret += '}' ; return ret ; }
获取引用文本，当引用自身不存在的情况下，需要返回原来的模板字符串
获取引用文本，当引用自身不存在的情况下，需要返回原来的模板字符串