Show
Ignore:
Timestamp:
11/30/2007 01:05:23 AM (12 months ago)
Author:
Shadowhand
Message:

Updated Kodoc module.

Location:
trunk/modules/kodoc/views
Files:
11 added
1 removed
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/kodoc/views/kodoc_html.php

    r1297 r1329  
    11<?php 
    22 
    3 if ( ! function_exists('kodoc_html')): 
    4  
    5 function kodoc_html($comment) 
    6 { 
    7         // Create anchors 
    8         $comment = preg_replace_callback('/<([^ ]+) ?([^>]+)?>/', 'kodoc_html_anchor', $comment); 
    9  
    10         // Break out the comment 
    11         $comment = explode("\n", $comment); 
    12  
    13         foreach($comment as $key => $line) 
    14         { 
    15                 if (strpos($line, '-') === FALSE) 
    16                         continue; 
    17  
    18                 // Definition lists 
    19                 if (preg_match('/([a-z_]+)\s+\-\s+(.+)/', trim($line), $matches)) 
    20                 { 
    21                         // Add a definition list item 
    22                         $comment[$key] = 
    23                                 '<dt>'.$matches[1].'</dt>'."\n". 
    24                                 '<dd>'.$matches[2].'</dd>'."\n"; 
    25  
    26                         if (isset($end)) 
    27                         { 
    28                                 if ($line === $end) 
    29                                 { 
    30                                         // End the DL 
    31                                         $comment[$key] .= '</dl>'."\n"; 
    32  
    33                                         // Clear the list 
    34                                         unset($end); 
    35                                 } 
    36                         } 
    37                         else 
    38                         { 
    39                                 // Start the comment 
    40                                 $comment[$key] = '<dl>'."\n".$comment[$key]; 
    41  
    42                                 // End of list 
    43                                 $end = ''; 
    44                         } 
    45                 } 
    46                 else 
    47                 { 
    48                         if ( ! isset($paragraph)) 
    49                         { 
    50                                 // Start a paragraph 
    51                                 $paragraph = '<p>'; 
    52  
    53                                 // End of paragraph 
    54                                 $end = ''; 
    55                         } 
    56  
    57                         if ($line === $end) 
    58                         { 
    59                                 // Set the paragraph 
    60                                 $comment[$key] = $paragraph.'</p>'."\n"; 
    61  
    62                                 // Clear the paragraph 
    63                                 unset($paragraph); 
    64  
    65                                 continue; 
    66                         } 
    67  
    68                         // Add the line to the paragraph 
    69                         $paragraph .= $line.' '; 
    70  
    71                         // Remove the comment 
    72                         unset($comment[$key]); 
    73                 } 
    74         } 
    75  
    76         // Re-form the comment 
    77         $comment = implode("\n", $comment); 
    78  
    79         // Copyright symbols 
    80         $comment = str_replace('(c)', '&copy;', $comment); 
    81  
    82         return $comment; 
    83 } 
    84  
    85 function kodoc_html_anchor($matches) 
    86 { 
    87         if (strpos($matches[1], '://') === FALSE) 
    88         { 
    89                 // Add HTTP protocol 
    90                 $matches[1] = 'http://'.$matches[1]; 
    91         } 
    92  
    93         if (empty($matches[2])) 
    94         { 
    95                 // No title 
    96                 return html::anchor($matches[1]); 
    97         } 
    98         else 
    99         { 
    100                 // With title 
    101                 return html::anchor($matches[1], $matches[2]); 
    102         } 
    103 } 
    104  
    105 endif; 
    1063if (empty($this->kodoc) OR count($docs = $this->kodoc->get()) < 1): 
    1074 
     
    11411 
    11512?> 
     13 
    11614<h2><?php echo $docs['file'] ?></h2> 
     15 
    11716<?php 
    11817 
    119 if ( ! empty($docs['comment']['about'])): 
     18if ( ! empty($docs['comments'])): 
    12019 
    121         echo kodoc_html($docs['comment']['about']); 
     20        foreach($docs['comments'] as $comment): 
     21                if ($docs['type'] === 'config'): 
    12222 
    123 endif; 
    124 foreach($docs['classes'] as $class): 
     23                        echo new View('kodoc/file_config', $comment); 
    12524 
    126 ?> 
    127 <h3><?php echo $class['name'] ?></h3> 
    128 <?php 
     25                elseif ( ! empty($comment['about'])): 
    12926 
    130         if ( ! empty($class['comment']['license'])): 
    131  
    132                 echo kodoc_html($docs['comment']['license']); 
    133  
    134         endif; 
    135         if ( ! empty($class['comment']['about'])): 
    136  
    137                 echo kodoc_html($docs['comment']['about']); 
    138  
    139         endif; 
    140         foreach ($class['methods'] as $method): 
    141                 $sigil = ' '.(($method['static'] == TRUE) ? '::' : '->').' '; 
    142  
    143 ?> 
    144 <div class="method"> 
    145 <h4><span class="visibility"><?php echo $method['visibility'] ?></span> <?php echo $class['name'].$sigil.$method['name'] ?></h4> 
    146 <div class="method"><?php echo Kohana::debug($method['about']) ?></div> 
    147 <?php 
    148  
    149                 if ($method['final']): 
    150  
    151 ?> 
    152 <p class="note">This method is <tt>final</tt> and cannot be extended.</p> 
    153 <?php 
     27                        echo $comment['about']; 
    15428 
    15529                endif; 
    156                 if ($method['abstract']): 
     30        endforeach; 
     31endif; 
     32if ( ! empty($docs['classes'])): 
    15733 
    158 ?> 
    159 <p class="note">This method is <tt>abstract</tt> and must be implemented in extended classes.</p> 
    160 <?php 
     34        foreach($docs['classes'] as $class): 
    16135 
    162                 endif; 
    163  
    164 ?> 
    165 </div> 
    166 <?php 
     36                echo new View('kodoc/class', $class); 
    16737 
    16838        endforeach; 
    169 endforeach; 
    170  
     39endif; 
    17140?> 
  • trunk/modules/kodoc/views/kodoc_menu.php

    r1297 r1329  
     1<div id="menu"> 
     2<ul> 
    13<?php 
    24 
     
    46 
    57?> 
    6 <h4><?php echo ucfirst($group) ?></h4> 
    7 <ul> 
     8<li class="first<?php echo ($active == $group) ? ' active': '' ?>"><?php echo ucfirst($group) ?><ul> 
    89<?php 
    910 
     
    1718 
    1819?> 
    19 <ul> 
     20<ul class="expanded"> 
    2021<?php 
    2122 
     
    4344 
    4445?> 
    45 </ul> 
     46</ul></li> 
    4647<?php 
    4748 
     
    4950 
    5051?> 
     52<div style="clear:both;"></div> 
     53</div>