Changeset 740:119f013c8e27 in hatta-dev for hatta.py


Ignore:
Timestamp:
01/24/10 13:28:09 (2 years ago)
Author:
sheep@…
Branch:
default
Message:

Add option and placeholder for the subdirectory storage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • hatta.py

    r739 r740  
    185185            help='Use the STYLE pygments style for highlighting', 
    186186            metavar='STYLE') 
     187        add('-D', '--subdirectories', dest='subdirectories', 
     188            action="store_true", 
     189            help='Store subpages as subdirectories in the filesystem') 
    187190 
    188191        options, args = parser.parse_args() 
     
    662665            if filename.startswith(self.repo_prefix): 
    663666                yield self._file_to_title(filename) 
     667 
     668 
     669class WikiSubdirectoryStorage(WikiStorage): 
     670    """ 
     671    A version of WikiStorage that keeps the subpages in real subdirectories in 
     672    the filesystem. 
     673 
     674    """ 
     675 
     676    # XXX Override required methods here. 
     677 
    664678 
    665679class WikiParser(object): 
     
    24462460        self.icon_page = self.config.get('icon_page', None) 
    24472461        self.pygments_style = self.config.get('pygments_style', 'tango') 
    2448  
    2449         self.storage = self.storage_class(self.path, self.page_charset) 
     2462        self.subdirectories = self.config.get_bool('subdirectories', False) 
     2463        if self.subdirectories: 
     2464            self.storage = WikiSubdirectoryStorage(self.path, self.page_charset) 
     2465        else: 
     2466            self.storage = self.storage_class(self.path, self.page_charset) 
    24502467        if not os.path.isdir(self.cache): 
    24512468            os.makedirs(self.cache) 
Note: See TracChangeset for help on using the changeset viewer.