-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎨 Improved formatting: Make the template engine easy to customize (close
#14)
- Loading branch information
1 parent
9ede4f6
commit 79096ca
Showing
4 changed files
with
25 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from abc import ABCMeta, abstractmethod | ||
|
||
from mako.lookup import TemplateLookup | ||
from six import with_metaclass | ||
|
||
|
||
class TemplateEngine(with_metaclass(ABCMeta)): | ||
@abstractmethod | ||
def get_template(self, template: str): | ||
pass | ||
|
||
|
||
class MakoTemplate(TemplateEngine): | ||
def __init__(self, *args, **kwds) -> None: | ||
self.engine = TemplateLookup(*args, **kwds) | ||
|
||
def get_template(self, template: str): | ||
return self.engine.get_template(template) |