Feat: adapt to new mapytex

This commit is contained in:
Bertrand Benjamin 2022-01-21 16:34:17 +01:00
parent 97468b9602
commit 083831acdf

View File

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