Adobe 38040334 - Dreamweaver CS3 User Manual page 344

Extending dreamweaver
Hide thumbs Also See for 38040334 - Dreamweaver CS3:
Table of Contents

Advertisement

/**********************************************************
* The getTranslatorInfo() function provides information
* about the translator, including its class and name,
* the types of documents that are likely to contain the
* markup to be translated, the regular expressions that
* a document containing the markup to be translated
* would match (whether the translator should run on all
* files, no files, in files with the specified
* extensions, or in files matching the specified
* expressions).
**********************************************************/
function getTranslatorInfo(){
//Create a new array with 6 slots in it
returnArray = new Array(6);
returnArray[0] = "DREAMWEAVER_TEAM";
returnArray[1] = "Kent Tags";
returnArray[2] = "0";
returnArray[3] = "1";
returnArray[4] = "<kent";
returnArray[5] = "byExpression";
return returnArray;
}
/**************************************************************************
* The translateMarkup() function performs the actual translation.
* In this translator, the translateMarkup() function is written
* entirely in JavaScript (that is, it does not rely on a C library) --
* and it's also extremely inefficient. It's a simple example, however,
* which is good for learning.
***************************************************************************/
function translateMarkup(docNameStr, siteRootStr, inStr){
var outStr = "";
var start = inStr.indexOf('<kent>');
var replCode = replaceKentTag();
var outStr = "";
//If the document does not contain any content, terminate the translation.
if ( inStr.length <= 0 ){
return "";
}
// As long as start, which is equal to the location in inStr of the
// KENT tag, is not equal to -1 (that is, as long as there is another
// KENT tag in the document)
while (start != -1){
// Copy everything up to the start of the KENT tag.
// This is very important, as translators should never change
// anything other than the markup that is to be translated.
outStr = inStr.substring(0, start);
// Replace the KENT tag with the translated HTML, wrapped in special
// locking tags. For more information on the repacement operation, see
// the comments in the replaceKentTag() function.
*
*
*
*
*
*
*
*
*
// The translatorClass
// The title
// The number of extensions
// The number of expressions
// Expression
// run if the file contains "<kent"
// The string to be returned after translation
// The first position of the KENT tag
// in the document.
// Calls the replaceKentTag() function
// to get the code that will replace KENT.
// The string to be returned after translation
DREAMWEAVER CS3
Extending Dreamweaver
*
*
*
*
*
338

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents