When comparing the title when the child is an object, the associated folder-structure is ignored, which leads to weird results. This fix will recursively look for a string-child, thus preserving the folder structure in the comparison and maintaining the desired sort order.
Try the test case without the fix: The main sections will switch places, so that section 02 appears before section 01.
This only happens, however, with a subsection (here 01-section/a) that is alphabetically before the second child (here 01-section/b). When the folder a were renamed to c, the original logic works as expected.
When comparing the title when the child is an object, the associated folder-structure is ignored, which leads to weird results. This fix will recursively look for a string-child, thus preserving the folder structure in the comparison and maintaining the desired sort order.
Try the test case without the fix: The main sections will switch places, so that section 02 appears before section 01.
This only happens, however, with a subsection (here
01-section/a
) that is alphabetically before the second child (here01-section/b
). When the foldera
were renamed toc
, the original logic works as expected.