From 083831acdfa11d947ed0f94213372ba7a576a3b0 Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Fri, 21 Jan 2022 16:34:17 +0100 Subject: [PATCH] Feat: adapt to new mapytex --- bopytex/bopytex.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/bopytex/bopytex.py b/bopytex/bopytex.py index d324c59..2239b6d 100755 --- a/bopytex/bopytex.py +++ b/bopytex/bopytex.py @@ -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"]: