Changeset 494 for trunk

Show
Ignore:
Timestamp:
06/09/08 11:55:56 (4 years ago)
Author:
mgalloy
Message:

Added a processing step for each line in rst markup that converts characters like < and > to their character entities. This is a bit of a hack, though. This really should insert some character entity object into the text markup tree and have the output class decide what to do with it.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/idldoc/src/parser/docparrstmarkupparser__define.pro

    r489 r494  
    6767 
    6868 
     69;+ 
     70; Substitute correct codes for less than, greater than, and other signs.  
     71; 
     72; :Returns: 
     73;    string 
     74; 
     75; :Params: 
     76;    line : in, required, type=string 
     77;       line to process 
     78;- 
     79function docparrstmarkupparser::_processText, line 
     80  compile_opt strictarr 
     81   
     82  output = '' 
     83   
     84  for pos = 0L, strlen(line) - 1L do begin 
     85    ch = strmid(line, pos, 1) 
     86    case ch of 
     87      '<': output += '&lt;' 
     88      '>': output += '&gt;' 
     89      else: output += ch 
     90     endcase 
     91  endfor 
     92   
     93  return, output 
     94end 
     95 
     96 
    6997pro docparrstmarkupparser::_handleLevel, lines, start, indent, tree=tree, file=file 
    7098  compile_opt strictarr 
     
    97125    endif else begin 
    98126      if (code && (currentIndent eq -1 || currentIndent gt indent)) then begin 
    99         listing->addChild, obj_new('MGtmText', text=strmid(cleanline, indent)) 
     127        listing->addChild, obj_new('MGtmText', text=self->_processText(strmid(cleanline, indent))) 
    100128        listing->addChild, obj_new('MGtmTag', type='newline') 
    101129      endif else begin      
    102         para->addChild, obj_new('MGtmText', text=cleanline) 
     130        para->addChild, obj_new('MGtmText', text=self->_processText(cleanline)) 
    103131        para->addChild, obj_new('MGtmTag', type='newline') 
    104132        code = 0B