Skip to content

Commit d159b9d

Browse files
committed
remove: tests
1 parent f2ddc24 commit d159b9d

2 files changed

Lines changed: 4 additions & 18 deletions

File tree

foliant/preprocessors/includes.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,22 +1775,8 @@ def apply(self):
17751775
output = f'{self.working_dir}/static/includes_map.json'
17761776
Path(f'{self.working_dir}/static/').mkdir(parents=True, exist_ok=True)
17771777

1778-
# Sort includes_map for consistent output
1779-
def sort_includes_map(data):
1780-
if isinstance(data, list):
1781-
for item in data:
1782-
if isinstance(item, dict):
1783-
if 'includes' in item and isinstance(item['includes'], list):
1784-
item['includes'].sort()
1785-
if 'anchors' in item and isinstance(item['anchors'], list):
1786-
item['anchors'].sort()
1787-
data.sort(key=lambda x: x.get('file', ''))
1788-
return data
1789-
1790-
sorted_includes_map = sort_includes_map(self.includes_map)
1791-
17921778
with open(output, 'w', encoding='utf8') as f:
1793-
dump(sorted_includes_map, f)
1779+
dump(self.includes_map, f)
17941780
self.logger.debug(f'includes_map written to {output}')
17951781

17961782
self.logger.info('Preprocessor applied')

test/test_includes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def test_includes_map_with_not_build_file(self):
368368
}
369369
expected_map = {
370370
'index.md': '# My title\n\nIncluded content 1',
371-
'static/includes_map.json': "[{\"file\": \"__src__/index.md\", \"includes\": [\"__src__/sub/sub-1.md\"]}, {\"file\": \"__src__/not_build.md\", \"includes\": [\"__src__/sub/sub-2.md\"]}]",
371+
'static/includes_map.json': "[{\"file\": \"__src__/not_build.md\", \"includes\": [\"__src__/sub/sub-2.md\"]}, {\"file\": \"__src__/index.md\", \"includes\": [\"__src__/sub/sub-1.md\"]}]",
372372
'not_build.md': """---
373373
not_build: true
374374
---
@@ -402,7 +402,7 @@ def test_includes_map_with_anchors_and_not_build(self):
402402
}
403403
expected_map = {
404404
'index.md': '# My title\n\n# Included 1 {#anchor1}\n\nContent 1\n\n<anchor>anchor2</anchor>',
405-
'static/includes_map.json': "[{\"file\": \"__src__/index.md\", \"includes\": [\"__src__/sub/sub-1.md\"], \"anchors\": [\"anchor1\", \"anchor2\"]}, {\"file\": \"__src__/not_build.md\", \"includes\": [\"__src__/sub/sub-2.md\"], \"anchors\": [\"anchor3\", \"anchor4\"]}]",
405+
'static/includes_map.json': "[{\"file\": \"__src__/not_build.md\", \"includes\": [\"__src__/sub/sub-2.md\"], \"anchors\": [\"anchor4\", \"anchor3\"]}, {\"file\": \"__src__/index.md\", \"includes\": [\"__src__/sub/sub-1.md\"], \"anchors\": [\"anchor2\", \"anchor1\"]}]",
406406
'not_build.md': """---
407407
not_build: true
408408
---
@@ -436,7 +436,7 @@ def test_recursive_includes_in_not_build_file(self):
436436
}
437437
expected_map = {
438438
'index.md': '# Main file\n\n# Not built file\n\n# Level 1\n\n# Level 2\n\nFinal content',
439-
'static/includes_map.json': "[{\"file\": \"__src__/index.md\", \"includes\": [\"__src__/not_build.md\"]}, {\"file\": \"__src__/level1.md\", \"includes\": [\"__src__/level2.md\"]}, {\"file\": \"__src__/not_build.md\", \"includes\": [\"__src__/level1.md\"]}]",
439+
'static/includes_map.json': "[{\"file\": \"__src__/not_build.md\", \"includes\": [\"__src__/level1.md\"]}, {\"file\": \"__src__/index.md\", \"includes\": [\"__src__/not_build.md\"]}, {\"file\": \"__src__/level1.md\", \"includes\": [\"__src__/level2.md\"]}]",
440440
'not_build.md': """---
441441
not_build: true
442442
---

0 commit comments

Comments
 (0)