diff --git a/src/bootstraparse/modules/error_mngr.py b/src/bootstraparse/modules/error_mngr.py index 828c6f0..fb5caa2 100644 --- a/src/bootstraparse/modules/error_mngr.py +++ b/src/bootstraparse/modules/error_mngr.py @@ -3,10 +3,10 @@ import logging import traceback import sys -from bootstraparse.modules.tools import __GFi, __GFu, __GL, __GLk +from bootstraparse.modules.tools import __GLk # __GFi, __GFu, __GL + + # Define the error codes - - _ERRORS = ["ParsingError"] __all__ = _ERRORS+[] diff --git a/src/bootstraparse/modules/preparser.py b/src/bootstraparse/modules/preparser.py index 0965394..d9ee786 100644 --- a/src/bootstraparse/modules/preparser.py +++ b/src/bootstraparse/modules/preparser.py @@ -208,7 +208,6 @@ class PreParser: and replaces shortcuts and images calls with appropriate html :return: a table of occurrences and their lines """ - # TODO: deal with optionals temp_file = self.file_with_all_imports temp_text = '' for line in temp_file.readlines(): @@ -242,8 +241,11 @@ class PreParser: :param shortcut: the id of the picture to fetch :param optionals: optional parameters along with image """ + blind_run = export.ExportRequest('inline_elements', 'image', export.format_optionals(optionals)) - local_export_manager = export.ExportManager('', '') + + # local_export_manager = self.__env.export_manager + local_export_manager = export.ExportManager("", "") output = local_export_manager(blind_run) return output.start + shortcut + output.end @@ -322,6 +324,7 @@ if __name__ == "__main__": # pragma: no cover config_path = pathresolver.b_path("../../example_userfiles/config/") __env = environment.Environment() __env.config = config.ConfigLoader(config_path) + __env.export_manager = export.ExportManager('', '') t_pp = PreParser(site_path, __env) out = t_pp.do_replacements() diff --git a/tests/modules/test_context_mngr.py b/tests/modules/test_context_mngr.py index 3c665ff..f820d2c 100644 --- a/tests/modules/test_context_mngr.py +++ b/tests/modules/test_context_mngr.py @@ -25,8 +25,7 @@ def test_context_mngr(): assert type(repr(base)) == str assert type(str(base)) == str assert ~base == [] - base.map = {'test': 'test3'} - assert base.map == {'test': "test3"} + base.map = {'test': lambda: "test3"} assert base >> "test" == 'test3'