Changeset 2622 for trunk/vendor/Sensei

Show
Ignore:
Timestamp:
09/23/07 22:38:11 (16 months ago)
Author:
jepso
Message:

Fixed interdocumentation linking feature

Location:
trunk/vendor/Sensei/Sensei/Doc
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/vendor/Sensei/Sensei/Doc/Renderer/Xhtml.php

    r2308 r2622  
    188188    } 
    189189     
    190     public function makeUrl(Sensei_Doc_Section $section) 
    191     { 
     190    public function makeUrl($section) 
     191    { 
     192        if ($section instanceof Sensei_Doc_Section) { 
     193            $path = $section->getPath(); 
     194        } else { 
     195            $path = $section; 
     196        } 
     197         
    192198        $url = $this->_options['url_prefix']; 
    193199         
    194200        if ($this->_options['section'] instanceof Sensei_Doc_Section) { 
    195             $path = $section->getPath(); 
    196201            $level = $this->_options['section']->getLevel(); 
    197202            $url .= implode(':', array_slice(explode(':', $path), 0, $level)); 
     
    206211    } 
    207212     
    208     public function makeAnchor(Sensei_Doc_Section $section) 
    209     { 
    210         $path = $section->getPath(); 
     213    public function makeAnchor($section) 
     214    { 
     215        if ($section instanceof Sensei_Doc_Section) { 
     216            $path = $section->getPath(); 
     217        } else { 
     218            $path = $section; 
     219        } 
    211220         
    212221        if ($this->_options['section'] instanceof Sensei_Doc_Section) { 
  • trunk/vendor/Sensei/Sensei/Doc/Section.php

    r1957 r2622  
    115115    { 
    116116        if ($this->_parent->_name !== null) { 
    117             return $this->_parent->getIndex($separator) . ($this->_index + 1) . $separator; 
    118         } else { 
    119             return ($this->_index + 1) . $separator; 
     117            return $this->_parent->getIndex($separator) . $separator . ($this->_index + 1); 
     118        } else { 
     119            return ($this->_index + 1); 
    120120        } 
    121121    } 
     
    137137            $path = preg_replace($patterns, $replacements, strtolower($this->_name));  
    138138             
    139             return $path; 
     139            return self::convertNameToPath($this->_name); 
    140140        } 
    141141    } 
     
    386386            } 
    387387    } 
     388 
     389    /** 
     390     * Converts section name to section path. 
     391     * 
     392     * Section path is generated from section name by making section name 
     393     * lowercase, replacing all whitespace with a dash and removing all 
     394     * characters that are not a letter, a number or a dash. 
     395     * 
     396     * @param $name string  section name 
     397     * @return section path 
     398     */ 
     399    public static function convertNameToPath($name) 
     400    { 
     401        $patterns = array('/\s/', '/[^a-z0-9-]/'); 
     402        $replacements = array('-', ''); 
     403             
     404        return preg_replace($patterns, $replacements, strtolower($name));  
     405    } 
    388406}