Macromedia dreamweaver 8-extending dreamweaver User Manual

Page of 504
446
Data Translators
     transValue = attName + '="' + trueValue + '"';
     transAtt = ' mmTranslatedValue' + count + '="' + ¬
     escape(transValue) + '"';
     outStr = outStr.substring(0,end+4) + transAtt + ¬
     outStr.substring(end+4);
 
   // If attAndValue is true, and tokens is greater than
   // 1, then trueValue is a series of attribute/value
   // pairs, not just one. In that case, each attribute/value
   // pair must be encoded separately and then added back
   // together to make the translated value.
   }else if (tokens.length > 1){
     transAtt = ' mmTranslatedValue' + count + '="'
     for (var j=0; j < tokens.length; j++){
       tokens[j] = escape(tokens[j]);
       if (j>0){
         spacer=" ";
       }
       transAtt += spacer + tokens[j]; 
     }
     transAtt += '"';
     outStr = outStr.substring(0,end+3) + transAtt + ¬
     outStr.substring(end+3)
   // If attAndValue is true and tokens is not greater
   // than 1, then trueValue is a single attribute/value pair.
   // This is the simplest case, where all that is necessary is
   // to encode trueValue.
   }else{
     transValue = trueValue;
     transAtt = ' mmTranslatedValue' + count + '="' + ¬
     escape(transValue) + '"';
     outStr = outStr.substring(0,end+3) + transAtt + ¬
     outStr.substring(end+3);
   }
   
   // Increment the counter so that the next instance
   // of mmTranslatedValue will have a unique name, and
   // then find the next <# conditional in the code.
   count++;
   start = outStr.indexOf('<# if',end);
  }
 
 // Return the translated string.
 return outStr
}
function getTranslatorInfo(){
 returnArray = new Array(7);