Changeset 592

Show
Ignore:
Timestamp:
04/21/09 15:46:34 (3 years ago)
Author:
mgalloy
Message:

Added links to routine and class names found in Uses section of routine and file docs.

Location:
trunk/idldoc
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/idldoc/docs/RELEASE

    r578 r592  
    2222  2 for level 1 items plus parameters, keywords, fields, properties, and sav 
    2323  file variables 
     24 
     25* Adds links to names of routines and classes found in the Uses section for  
     26  routines and files. 
    2427 
    2528* Miscellaneous small bug fixes. 
  • trunk/idldoc/src/doc_system__define.pro

    r550 r592  
    549549 
    550550;+ 
     551; Add a routine to the visible routines list. 
     552;  
     553; :Params: 
     554;    name : in, required, type=string 
     555;       name of routine 
     556;    routine : in, required, type=object 
     557;       DOCtreeRoutine object 
     558;- 
     559pro doc_system::addVisibleRoutine, name, routine 
     560  compile_opt strictarr 
     561 
     562  self.visibleRoutines->put, strlowcase(name), routine 
     563end 
     564 
     565 
     566;+ 
     567; Find link to given resource. 
     568;  
     569; :Returns: 
     570;    string, returns empty string if no resource found 
     571;     
     572; :Params: 
     573;    resource : in, required, type=string    
     574;- 
     575function doc_system::_findResourceLink, resource 
     576  compile_opt strictarr 
     577   
     578  class = self.classes->get(strlowcase(resource), found=found) 
     579  if (found) then begin 
     580    if (class->hasUrl()) then return, class->getUrl() 
     581  endif 
     582   
     583  routine = self.visibleRoutines->get(strlowcase(resource), found=found) 
     584  if (found) then begin 
     585    return, routine->getVariable('index_url') 
     586  endif 
     587   
     588  return, '' 
     589end 
     590 
     591 
     592;+ 
     593; Convert the uses clause into a string array using the current comment style. 
     594;  
     595; :Returns: 
     596;    strarr 
     597; 
     598; :Params: 
     599;    tree : in, required, type=object 
     600;       parse tree object 
     601 
     602; :Keywords: 
     603;    root : in, required, type=string 
     604;       relative location of root from the calling routine or file 
     605;- 
     606function doc_system::processUses, tree, root=root 
     607  compile_opt strictarr 
     608   
     609  if (~obj_valid(tree)) then return, '' 
     610   
     611  ; get plain text 
     612  crlf = string(!version.os_family eq 'unix' ? [10B] : [13B, 10B]) 
     613  plainParser = self->getParser('plainoutput') 
     614  s = plainParser->process(tree) 
     615  s = strjoin(s, crlf) 
     616  resources = strsplit(s, '[[:space:],]', /regex, /extract, count=nresources) 
     617   
     618  ; get new tree based with links to resources used 
     619  _tree = obj_new('MGtmTag', type='paragraph') 
     620  for r = 0L, nresources - 1L do begin 
     621    href = self->_findResourceLink(resources[r]) 
     622    if (href eq '') then begin 
     623      parent = _tree 
     624    endif else begin 
     625      link = obj_new('MGtmTag', type='link') 
     626      link->addAttribute, 'reference', root + '/' + href 
     627      _tree->addchild, link 
     628      parent = link 
     629    endelse 
     630     
     631    resourceName = obj_new('MGtmText', text=resources[r]) 
     632    parent->addChild, resourceName 
     633     
     634    if (r ne nresources - 1L) then begin 
     635      comma = obj_new('MGtmText', text=', ') 
     636      _tree->addChild, comma 
     637    endif 
     638  endfor 
     639 
     640  ; create output using current comment style 
     641  commentParser = self->getParser(self.commentStyle + 'output') 
     642  comments = commentParser->process(_tree) 
     643     
     644  ; destroy new tree 
     645  obj_destroy, _tree 
     646   
     647  return, comments 
     648end 
     649 
     650 
     651;+ 
    551652; Convert a parse tree into a string array using the plain output parser. 
    552653; 
     
    9681069   
    9691070  obj_destroy, [self.index, self.proFiles, self.dlmFiles, self.savFiles, self.idldocFiles] 
     1071  obj_destroy, self.visibleRoutines 
    9701072   
    9711073  classes = self.classes->values(count=nClasses) 
     
    11871289  self.savFiles = obj_new('MGcoArrayList', type=11, block_size=20)   
    11881290  self.idldocFiles = obj_new('MGcoArrayList', type=11, block_size=20) 
     1291   
     1292  self.visibleRoutines = obj_new('MGcoHashTable', key_type=7, value_type=11) 
    11891293   
    11901294  self.requiresItems = obj_new('MGcoArrayList', type=11, block_size=20) 
     
    13771481             idldocFiles: obj_new(), $ 
    13781482              
     1483             visibleRoutines: obj_new(), $ 
     1484              
    13791485             requiresVersion: '', $ 
    13801486             requiresItems: obj_new() $                               
  • trunk/idldoc/src/tree/doctreeclass__define.pro

    r586 r592  
    103103 
    104104;+ 
    105 ; Easy to use accessor for URL. 
    106 ; 
    107 ; :Returns: string 
     105; Easy to use accessor for URL to class file relative to doc root. 
     106; 
     107; :Returns:  
     108;    string 
    108109;- 
    109110function doctreeclass::getUrl 
  • trunk/idldoc/src/tree/doctreeprofile__define.pro

    r565 r592  
    372372         
    373373    'has_uses': return, obj_valid(self.uses) 
    374     'uses': return, self.system->processComments(self.uses) 
     374    'uses': begin 
     375        self.directory->getProperty, url=dirUrl 
     376        if (dirUrl eq './') then begin 
     377          root = '.' 
     378        endif else begin 
     379          dummy = strsplit(dirUrl, '/', count=ndirs) 
     380          root = strjoin(strarr(ndirs) + '..', '/') 
     381        endelse 
     382        return, self.system->processUses(self.uses, root=root) 
     383      end 
    375384 
    376385    'plain_attributes': begin 
     
    529538    routine->markArguments 
    530539    routine->checkDocumentation 
     540    routine->getProperty, name=routineName 
     541    if (routine->isVisible()) then begin 
     542      self.system->addVisibleRoutine, routineName, routine 
     543    endif 
    531544  endfor 
    532545end 
  • trunk/idldoc/src/tree/doctreeroutine__define.pro

    r561 r592  
    342342 
    343343    'has_uses': return, obj_valid(self.uses) 
    344     'uses': return, self.system->processComments(self.uses) 
    345                              
     344    'uses': begin 
     345        self.file->getProperty, directory=directory 
     346        directory->getProperty, url=dirUrl 
     347        if (dirUrl eq './') then begin 
     348          root = '.' 
     349        endif else begin 
     350          dummy = strsplit(dirUrl, '/', count=ndirs) 
     351          root = strjoin(strarr(ndirs) + '..', '/') 
     352        endelse 
     353        return, self.system->processUses(self.uses, root=root) 
     354      end 
     355                            
    346356    'has_requires': return, obj_valid(self.requires) 
    347357    'requires': return, self.system->processComments(self.requires)