o3d/documentation/jsdoc-toolkit-templates/publish.js
/**
 * Called automatically by JsDoc Toolkit.
 * @param {SymbolSet} symbolSet Set of all symbols in all files.
 */
Called automatically by JsDoc Toolkit.
@param {SymbolSet} symbolSet Set of all symbols in all files.
Called automatically by JsDoc Toolkit . @param { SymbolSet } symbolSet Set of all symbols in all files .
function publish(symbolSet) {
  publish.conf = {  
    ext: '.ezt',
    outDir: JSDOC.opt.d || SYS.pwd + '../out/jsdoc/',
    templatesDir: JSDOC.opt.t || SYS.pwd + '../templates/jsdoc/',
    symbolsDir: '',
    prefix: JSDOC.opt.D.prefix || 'js_1_0_'};
  publish.conf.srcDir = publish.conf.outDir + 'src/'
  publish.conf.htmlDir = publish.conf.outDir + 'original_html/'
  if (JSDOC.opt.s && defined(Link) && Link.prototype._makeSrcLink) {
    Link.prototype._makeSrcLink = function(srcFilePath) {
      return '&lt;' + srcFilePath + '&gt;';
    }
  }
  IO.mkPath((publish.conf.htmlDir).split('/'));
  Link.symbolSet = symbolSet;
  Link.base = '../';
  g_symbolSet = symbolSet;
  g_filePrefix = publish.conf.prefix;
  try {
    var templatesDir = publish.conf.templatesDir;
    var classTemplate = new JSDOC.JsPlate(templatesDir + 'class.tmpl');
    var membersTemplate = new JSDOC.JsPlate(templatesDir + 'members.tmpl');
    var classTreeTemplate = new JSDOC.JsPlate(templatesDir + 'classtree.tmpl');
    var fileListTemplate = new JSDOC.JsPlate(templatesDir + 'filelist.tmpl');
    var annotatedTemplate = new JSDOC.JsPlate(templatesDir + 'annotated.tmpl');
    var namespacesTemplate = new JSDOC.JsPlate(templatesDir +
                                               'namespaces.tmpl');
  } catch(e) {
    generateError('Couldn\'t create the required templates: ' + e);
    System.exit(1);
  }
  function hasNoParent($) {return ($.memberOf == '')}
  function isaFile($) {return ($.is('FILE'))}
  function isaClass($) {return ($.is('CONSTRUCTOR') || $.isNamespace)}
  var symbols = symbolSet.toArray();
  if (false) {
    var files = JSDOC.opt.srcFiles;
    for (var i = 0, l = files.length; i < l; i++) {
      var file = files[i];
      makeSrcFile(file, publish.conf.srcDir);
    }
  }
  var classes = symbols.filter(isaClass).sort(makeSortby('alias'));
  for (var i = 0, l = classes.length; i < l; i++) {
    var symbol = classes[i];
    g_unknownTypes = { };
    symbol.events = symbol.getEvents();   
    symbol.methods = symbol.getMethods(); 
    print('Generating docs for: ' + symbol.alias);
    symbol.source = symbol.srcFile;    
    symbol.filename = symbol.srcFile;  
    var output = '';
    output = classTemplate.process(symbol);
    IO.saveFile(publish.conf.outDir,
                (publish.conf.prefix + symbol.alias +
                 '_ref' + publish.conf.ext).toLowerCase(),
                output);
    IO.saveFile(publish.conf.htmlDir,
                (publish.conf.prefix + symbol.alias +
                 '_ref.html').toLowerCase(),
                output);
    var output = '';
    output = membersTemplate.process(symbol);
    IO.saveFile(publish.conf.outDir,
                (publish.conf.prefix + symbol.alias +
                 '_members' + publish.conf.ext).toLowerCase(),
                output);
    IO.saveFile(publish.conf.htmlDir,
                (publish.conf.prefix + symbol.alias +
                 '_members.html').toLowerCase(),
                output);
  }
  var classTree = classTreeTemplate.process(classes);
  IO.saveFile(publish.conf.outDir, 'classtree.html', classTree);
  var fileList = fileListTemplate.process(symbols);
  IO.saveFile(publish.conf.outDir, 'filelist.html', fileList);
  var annotated = annotatedTemplate.process(classes);
  IO.saveFile(publish.conf.outDir, 'annotated' + publish.conf.ext, annotated);
  IO.saveFile(publish.conf.htmlDir, 'annotated.html', annotated);
  var namespaces = namespacesTemplate.process(classes);
  IO.saveFile(publish.conf.outDir, 'namespaces' + publish.conf.ext, namespaces);
  IO.saveFile(publish.conf.htmlDir, 'namespaces.html', namespaces);
  if (g_numErrors > 0) {
    print('Num Errors: ' + g_numErrors);
    System.exit(1);
  }
}
function publish ( symbolSet ) { publish . conf = { ext : '.ezt' , outDir : JSDOC . opt . d || SYS . pwd + '../out/jsdoc/' , templatesDir : JSDOC . opt . t || SYS . pwd + '../templates/jsdoc/' , symbolsDir : '' , prefix : JSDOC . opt . D . prefix || 'js_1_0_' } ; publish . conf . srcDir = publish . conf . outDir + 'src/' publish . conf . htmlDir = publish . conf . outDir + 'original_html/' if ( JSDOC . opt . s && defined ( Link ) && Link . prototype . _makeSrcLink ) { Link . prototype . _makeSrcLink = function ( srcFilePath ) { return '&lt;' + srcFilePath + '&gt;' ; } } IO . mkPath ( ( publish . conf . htmlDir ) . split ( '/' ) ) ; Link . symbolSet = symbolSet ; Link . base = '../' ; g_symbolSet = symbolSet ; g_filePrefix = publish . conf . prefix ; try { var templatesDir = publish . conf . templatesDir ; var classTemplate = new JSDOC . JsPlate ( templatesDir + 'class.tmpl' ) ; var membersTemplate = new JSDOC . JsPlate ( templatesDir + 'members.tmpl' ) ; var classTreeTemplate = new JSDOC . JsPlate ( templatesDir + 'classtree.tmpl' ) ; var fileListTemplate = new JSDOC . JsPlate ( templatesDir + 'filelist.tmpl' ) ; var annotatedTemplate = new JSDOC . JsPlate ( templatesDir + 'annotated.tmpl' ) ; var namespacesTemplate = new JSDOC . JsPlate ( templatesDir + 'namespaces.tmpl' ) ; } catch ( e ) { generateError ( 'Couldn\'t create the required templates: ' + e ) ; System . exit ( 1 ) ; } function hasNoParent ( $ ) { return ( $ . memberOf == '' ) } function isaFile ( $ ) { return ( $ . is ( 'FILE' ) ) } function isaClass ( $ ) { return ( $ . is ( 'CONSTRUCTOR' ) || $ . isNamespace ) } var symbols = symbolSet . toArray ( ) ; if ( false ) { var files = JSDOC . opt . srcFiles ; for ( var i = 0 , l = files . length ; i < l ; i ++ ) { var file = files [ i ] ; makeSrcFile ( file , publish . conf . srcDir ) ; } } var classes = symbols . filter ( isaClass ) . sort ( makeSortby ( 'alias' ) ) ; for ( var i = 0 , l = classes . length ; i < l ; i ++ ) { var symbol = classes [ i ] ; g_unknownTypes = { } ; symbol . events = symbol . getEvents ( ) ; symbol . methods = symbol . getMethods ( ) ; print ( 'Generating docs for: ' + symbol . alias ) ; symbol . source = symbol . srcFile ; symbol . filename = symbol . srcFile ; var output = '' ; output = classTemplate . process ( symbol ) ; IO . saveFile ( publish . conf . outDir , ( publish . conf . prefix + symbol . alias + '_ref' + publish . conf . ext ) . toLowerCase ( ) , output ) ; IO . saveFile ( publish . conf . htmlDir , ( publish . conf . prefix + symbol . alias + '_ref.html' ) . toLowerCase ( ) , output ) ; var output = '' ; output = membersTemplate . process ( symbol ) ; IO . saveFile ( publish . conf . outDir , ( publish . conf . prefix + symbol . alias + '_members' + publish . conf . ext ) . toLowerCase ( ) , output ) ; IO . saveFile ( publish . conf . htmlDir , ( publish . conf . prefix + symbol . alias + '_members.html' ) . toLowerCase ( ) , output ) ; } var classTree = classTreeTemplate . process ( classes ) ; IO . saveFile ( publish . conf . outDir , 'classtree.html' , classTree ) ; var fileList = fileListTemplate . process ( symbols ) ; IO . saveFile ( publish . conf . outDir , 'filelist.html' , fileList ) ; var annotated = annotatedTemplate . process ( classes ) ; IO . saveFile ( publish . conf . outDir , 'annotated' + publish . conf . ext , annotated ) ; IO . saveFile ( publish . conf . htmlDir , 'annotated.html' , annotated ) ; var namespaces = namespacesTemplate . process ( classes ) ; IO . saveFile ( publish . conf . outDir , 'namespaces' + publish . conf . ext , namespaces ) ; IO . saveFile ( publish . conf . htmlDir , 'namespaces.html' , namespaces ) ; if ( g_numErrors > 0 ) { print ( 'Num Errors: ' + g_numErrors ) ; System . exit ( 1 ) ; } }
Called automatically by JsDoc Toolkit.
Called automatically by JsDoc Toolkit .
// trailing slash expected for dirs // is source output is suppressed, just display the links to the source file // create the folders and subfolders to hold the output // used to allow Link to check the details of things being linked to // used to allow other parts of this module to access database of symbols // and the file prefix. // create the required templates // some ustility filters // get an array version of the symbolset, useful for filtering // create the hilited source code files // get a list of all the classes in the symbolset // create each of the class pages // 1 order matters // 2 // Comment these lines in to see what data is available to the templates. //print('----------------------------------------------------------------'); //dumpObject(symbol, 5); // <a href='symbol.source'>symbol.filename</a> // This is used as a link to the source // This is display as the link.