set_syntax.js

Parent Previous Next

// TeXworksScript

// Title: Syntax for Scripting

// Description: Colourises  .js .qs .mod files

// Author: Paul A Norman

// Version: 0.3

// Date: 2010-12-20

// Script-Type: hook

// Hook: LoadFile




var  fileName = TW.target.fileName;

 var   extPos = fileName.lastIndexOf('.') +1;

 

if (extPos > 0)

 {  

  var ext = fileName.substr(extPos);

 

  // updated 2011 08 01

 

// N.B. that the sections HTML QtScrpt and anything you add will need to already exist in your syntax-patterns.txt or be deactivated here - error messages will follow otherwise


  switch(ext)

        {

       

         case 'html':

         case  'htm':

         case  'xml':

          TW.target.setSyntaxColoringMode('HTML');        

         break;

         

         case   'qs':

         case   'js':

         case 'mod':

         case  'php':

          TW.target.setSyntaxColoringMode('QtScript');

         break;

         

         

         default:

          TW.target.setSyntaxColoringMode('LaTeX');

         break;

        }

       

  }  //End. if (extPos > 0)

Created with the Personal Edition of HelpNDoc: Full featured Documentation generator