##// END OF EJS Templates
templater: drop extension point of engine classes (API)...
Yuya Nishihara -
r38609:48289eaf default
parent child Browse files
Show More
@@ -485,7 +485,6 b' test-symlink-placeholder.t'
485 485 test-symlinks.t
486 486 test-tag.t
487 487 test-tags.t
488 test-template-engine.t
489 488 test-template-filters.t
490 489 test-treemanifest.t
491 490 test-ui-color.py
@@ -718,8 +718,6 b' class engine(object):'
718 718 mapping = extramapping
719 719 return templateutil.flatten(self, mapping, func(self, mapping, data))
720 720
721 engines = {'default': engine}
722
723 721 def stylelist():
724 722 paths = templatepaths()
725 723 if not paths:
@@ -777,10 +775,7 b' def _readmapfile(mapfile):'
777 775 conf.source('templates', key))
778 776 cache[key] = unquotestring(val)
779 777 elif key != '__base__':
780 val = 'default', val
781 if ':' in val[1]:
782 val = val[1].split(':', 1)
783 tmap[key] = val[0], os.path.join(base, val[1])
778 tmap[key] = os.path.join(base, val)
784 779 aliases.extend(conf['templatealias'].items())
785 780 return cache, tmap, aliases
786 781
@@ -815,7 +810,6 b' class templater(object):'
815 810 self._resources = resources
816 811 self._aliases = aliases
817 812 self._minchunk, self._maxchunk = minchunk, maxchunk
818 self._ecache = {}
819 813
820 814 @classmethod
821 815 def frommapfile(cls, mapfile, filters=None, defaults=None, resources=None,
@@ -835,13 +829,13 b' class templater(object):'
835 829 '''Get the template for the given template name. Use a local cache.'''
836 830 if t not in self.cache:
837 831 try:
838 self.cache[t] = util.readfile(self._map[t][1])
832 self.cache[t] = util.readfile(self._map[t])
839 833 except KeyError as inst:
840 834 raise templateutil.TemplateNotFound(
841 835 _('"%s" not in template map') % inst.args[0])
842 836 except IOError as inst:
843 837 reason = (_('template file %s: %s')
844 % (self._map[t][1],
838 % (self._map[t],
845 839 stringutil.forcebytestr(inst.args[1])))
846 840 raise IOError(inst.args[0], encoding.strfromlocal(reason))
847 841 return self.cache[t]
@@ -857,16 +851,8 b' class templater(object):'
857 851 def generate(self, t, mapping):
858 852 """Return a generator that renders the specified named template and
859 853 yields chunks"""
860 ttype = t in self._map and self._map[t][0] or 'default'
861 if ttype not in self._ecache:
862 try:
863 ecls = engines[ttype]
864 except KeyError:
865 raise error.Abort(_('invalid template engine: %s') % ttype)
866 self._ecache[ttype] = ecls(self.load, self._filters, self.defaults,
867 self._resources, self._aliases)
868 proc = self._ecache[ttype]
869
854 proc = engine(self.load, self._filters, self.defaults, self._resources,
855 self._aliases)
870 856 stream = proc.process(t, mapping)
871 857 if self._minchunk:
872 858 stream = util.increasingchunks(stream, min=self._minchunk,
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now