generated from exteraGramPlugins/pluginBase
Initial commit
This commit is contained in:
commit
787965ebbf
37 files changed
+2613
No files matched your search
@@ -0,0 +1,13 @@
|
||||
from textutil import normalize
|
||||
|
||||
|
||||
class TemplateError(ValueError):
|
||||
pass
|
||||
|
||||
|
||||
def render(template: str, name: str) -> str:
|
||||
normalized = normalize(name)
|
||||
try:
|
||||
return template.format(name=normalized)
|
||||
except (KeyError, IndexError, ValueError):
|
||||
raise TemplateError(f"unsupported placeholder in {template!r}")
|
||||
Reference in new issue
Block a user