mercurial/templater.py
changeset 19125 6ba6e345961e
parent 19079 1e433b5457fd
child 19127 d982edcfe7f0
equal deleted inserted replaced
19124:4cdec37f0018 19125:6ba6e345961e
   392         generator.'''
   392         generator.'''
   393         return _flatten(runtemplate(self, mapping, self._load(t)))
   393         return _flatten(runtemplate(self, mapping, self._load(t)))
   394 
   394 
   395 engines = {'default': engine}
   395 engines = {'default': engine}
   396 
   396 
       
   397 def stylelist():
       
   398     path = templatepath()[0]
       
   399     dirlist =  os.listdir(path)
       
   400     stylelist = []
       
   401     for file in dirlist:
       
   402         split = file.split(".")
       
   403         if split[0] == "map-cmdline":
       
   404             stylelist.append(split[1])
       
   405     return ", ".join(stylelist)
       
   406 
   397 class templater(object):
   407 class templater(object):
   398 
   408 
   399     def __init__(self, mapfile, filters={}, defaults={}, cache={},
   409     def __init__(self, mapfile, filters={}, defaults={}, cache={},
   400                  minchunk=1024, maxchunk=65536):
   410                  minchunk=1024, maxchunk=65536):
   401         '''set up template engine.
   411         '''set up template engine.
   413         self.ecache = {}
   423         self.ecache = {}
   414 
   424 
   415         if not mapfile:
   425         if not mapfile:
   416             return
   426             return
   417         if not os.path.exists(mapfile):
   427         if not os.path.exists(mapfile):
   418             raise util.Abort(_('style not found: %s') % mapfile)
   428             raise util.Abort(_("style '%s' not found") % mapfile,
       
   429                              hint=_("available styles: %s") % stylelist())
   419 
   430 
   420         conf = config.config()
   431         conf = config.config()
   421         conf.read(mapfile)
   432         conf.read(mapfile)
   422 
   433 
   423         for key, val in conf[''].items():
   434         for key, val in conf[''].items():