Feat: adapt to new mapytex

This commit is contained in:
Bertrand Benjamin 2022-01-21 16:34:17 +01:00
parent 97468b9602
commit 083831acdf
1 changed files with 8 additions and 12 deletions

View File

@ -11,8 +11,9 @@ import logging
from pathlib import Path
import pytex
from mapytex import Expression, Integer, Decimal
from mapytex import render, Expression, random
import bopytex.filters as filters
import random as rd
formatter = logging.Formatter("%(name)s :: %(levelname)s :: %(message)s")
steam_handler = logging.StreamHandler()
@ -24,19 +25,12 @@ logger.addHandler(steam_handler)
def setup():
Expression.set_render("tex")
logger.debug(f"Render for Expression is {Expression.RENDER}")
render.set_render("tex")
#logger.debug(f"Render for Expression is {Expression.RENDER}")
mapytex_tools = {
"Expression": Expression,
"Integer": Integer,
"Decimal": Decimal,
# "Polynom": mapytex.Polynom,
# "Fraction": mapytex.Fraction,
# "Equation": mapytex.Equation,
# "random_str": mapytex.random_str,
# "random_pythagore": mapytex.random_pythagore,
# "Dataset": mapytex.Dataset,
# "WeightedDataset": mapytex.WeightedDataset,
"rdm": random,
"random": rd,
}
pytex.update_export_dict(mapytex_tools)
@ -176,6 +170,8 @@ def produce_and_compile(options):
metadatas = subject_metadatas(options)
logger.debug(f"Metadata {metadatas}")
setup()
for meta in metadatas:
logger.debug(f"Feeding template toward {meta['texfile']}")
if options["crazy"]: