lang: options updates + gen utils cleanup (#1520)

* generate new langs

* add to nuxt

* cleanup generator code

* additional cleanups
This commit is contained in:
Hayden 2022-08-02 10:41:44 -08:00 committed by GitHub
parent 5fca94dd45
commit 6649ccf224
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 119 additions and 94 deletions

View file

@ -1,3 +1,4 @@
import logging
import re
from dataclasses import dataclass
from pathlib import Path
@ -5,9 +6,15 @@ from pathlib import Path
import black
import isort
from jinja2 import Template
from rich.logging import RichHandler
FORMAT = "%(message)s"
logging.basicConfig(level=logging.INFO, format=FORMAT, datefmt="[%X]", handlers=[RichHandler()])
log = logging.getLogger("rich")
def render_python_template(template_file: Path | str, dest: Path, data: dict) -> str:
def render_python_template(template_file: Path | str, dest: Path, data: dict):
"""Render and Format a Jinja2 Template for Python Code"""
if isinstance(template_file, Path):
tplt = Template(template_file.read_text())
@ -37,7 +44,6 @@ class CodeSlicer:
def push_line(self, string: str) -> None:
self._next_line = self._next_line or self.start + 1
print(self.indentation)
self.text.insert(self._next_line, self.indentation + string + "\n")
self._next_line += 1