diff --git a/foliant/preprocessors/includes.py b/foliant/preprocessors/includes.py index b80e684..fbf1f76 100644 --- a/foliant/preprocessors/includes.py +++ b/foliant/preprocessors/includes.py @@ -23,7 +23,7 @@ class Preprocessor(BasePreprocessor): 'cache_dir': Path('.includescache'), 'aliases': {}, 'extensions': ['md'], - 'includes_map': True + 'includes_map': False } tags = 'include', diff --git a/test/test_includes.py b/test/test_includes.py index d5638ce..049de10 100644 --- a/test/test_includes.py +++ b/test/test_includes.py @@ -243,3 +243,21 @@ def test_extensions(self): 'index.j2': '# My title\n\nIncluded content', 'sub/sub.md': 'Included content' } + + def test_includes_map(self): + self.ptf.options = {'includes_map': True } + input_map = { + 'index.md': '# My title\n\n\n\n', + 'sub/sub-1.md': 'Included content 1', + 'sub/sub-2.md': 'Included content 2' + } + expected_map = { + 'index.md': '# My title\n\nIncluded content 1\n\nIncluded content 2', + 'static/includes_map.json': "[{\"file\": \"__src__/index.md\", \"includes\": [\"__src__/sub/sub-1.md\", \"__src__/sub/sub-2.md\"]}]", + 'sub/sub-1.md': 'Included content 1', + 'sub/sub-2.md': 'Included content 2' + } + self.ptf.test_preprocessor( + input_mapping=input_map, + expected_mapping=expected_map, + )