Changeset 64

Show
Ignore:
Timestamp:
09/25/07 16:28:23 (6 years ago)
Author:
mgalloy
Message:

Capable of producing listing files for each directory.

Location:
trunk/idldoc/src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/idldoc/src/doc_system__define.pro

    r59 r64  
    3232 
    3333 
    34 pro doc_system::getProperty, root=root, sav_file_template=savFileTemplate 
     34pro doc_system::getProperty, root=root, $ 
     35                             listing_template=listingTemplate, $ 
     36                             sav_file_template=savFileTemplate 
    3537  compile_opt strictarr 
    3638 
    3739  if (arg_present(root)) then root = self.root 
     40  if (arg_present(listingTemplate)) then listingTemplate = self.listingTemplate 
    3841  if (arg_present(savFileTemplate)) then savFileTemplate = self.savFileTemplate 
    3942end 
     
    133136     self.directories->add, directory 
    134137  endfor 
     138end 
     139 
     140 
     141function doc_system::createTemplate, basename 
     142  compile_opt strictarr 
     143   
     144  templateFilename = filepath(basename, $ 
     145                              subdir=['templates'], $ 
     146                              root=self.sourceLocation)  
     147  return, obj_new('MGffTemplate', templateFilename) 
     148end 
     149 
     150 
     151pro doc_system::loadTemplates 
     152  compile_opt strictarr 
     153   
     154  self.listingTemplate = self->createTemplate('listing.tt') 
     155  self.savFileTemplate = self->createTemplate('savefile.tt') 
    135156end 
    136157 
     
    319340   
    320341  ; load templates 
    321   templateFilename = filepath('savefile.tt', $ 
    322                               subdir=['templates'], $ 
    323                               root=self.sourceLocation) 
    324   self.savFileTemplate = obj_new('MGffTemplate', templateFilename) 
     342  self->loadTemplates 
    325343   
    326344  ; parse tree of directories, files, routines, parameters  
     
    361379             sourceLocation: '', $ 
    362380             directories: obj_new(), $   
     381             listingTemplate: obj_new(), $ 
    363382             savFileTemplate: obj_new(), $   
    364383             title: '', $ 
  • trunk/idldoc/src/tree/doctreedirectory__define.pro

    r59 r64  
    1 pro doctreedirectory::getProperty, location=location, relative_root=relativeRoot 
     1pro doctreedirectory::getProperty, location=location 
    22  compile_opt strictarr 
    33   
    44  if (arg_present(location)) then location = self.location 
    5   if (arg_present(relativeRoot)) then begin 
    6     dummy = strsplit(self.location, path_sep(), count=nUps) 
    7     relativeRoot = strjoin(replicate('..' + path_sep(), nUps)) 
    8   endif 
     5end 
     6 
     7 
     8function doctreedirectory::getVariable, name, found=found 
     9  compile_opt strictarr 
     10 
     11  found = 1B 
     12  case strlowcase(name) of 
     13    'location' : return, self.location 
     14    'relative_root' : begin 
     15        dummy = strsplit(self.location, path_sep(), count=nUps) 
     16        return, strjoin(replicate('..' + path_sep(), nUps)) 
     17      end 
     18    else: begin 
     19        ; search in the system object if the variable is not found here 
     20        var = self.system->getVariable(name, found=found) 
     21        if (found) then return, var 
     22         
     23        found = 0B 
     24        return, -1L 
     25      end 
     26  endcase 
    927end 
    1028 
     
    2240   
    2341  print, 'Generating output for ' + self.location 
    24    
     42 
     43  ; create directory in the output if necessary 
     44  outputDir = outputRoot + self.location 
     45  if (~file_test(outputDir)) then begin 
     46    self.system->makeDirectory, outputDir, error=error 
     47    if (error ne 0L) then begin 
     48      self.system->error, 'unable to make directory ' + outputDir 
     49    endif 
     50  endif 
     51     
    2552  ; generate docs for each .pro/.sav/.idldoc file in directory 
    2653  for f = 0L, self.proFiles->count() - 1L do begin 
     
    4269   
    4370  ; generate file listing 
     71  listingFilename = filepath('dir-files.html', root=outputDir) 
     72  self.system->getProperty, listing_template=listingTemplate 
     73  listingTemplate->reset 
     74  listingTemplate->process, self, listingFilename 
    4475end 
    4576 
  • trunk/idldoc/src/tree/doctreesavfile__define.pro

    r59 r64  
    2828  switch strlowcase(name) of 
    2929    'basename' : return, self.basename 
    30     'relative_root' : begin 
    31         self.directory->getProperty, relative_root=relativeRoot 
    32         return, relativeRoot 
    33       end 
    3430    'creation_date': begin 
    3531        contents = self.savFile->contents() 
     
    5854    else: begin 
    5955        ; search in the system object if the variable is not found here 
    60         var = self.system->getVariable(name, found=found) 
     56        var = self.directory->getVariable(name, found=found) 
    6157        if (found) then return, var 
    6258         
     
    9692   
    9793  outputDir = outputRoot + directory 
    98   if (~file_test(outputDir)) then begin 
    99     self.system->makeDirectory, outputDir, error=error 
    100     if (error ne 0L) then begin 
    101       self.system->error, 'unable to make directory ' + outputDir 
    102     endif 
    103   endif 
    10494  outputFilename = outputDir + file_basename(self.basename, '.sav') + '-sav.html' 
    10595   
     96  savFileTemplate->reset 
    10697  savFileTemplate->process, self, outputFilename 
    10798end