Mediawiker icon indicating copy to clipboard operation
Mediawiker copied to clipboard

Code folding

Open wunditta opened this issue 2 years ago • 5 comments

The code folding seems flawed. When folding e.g. level 4 I would expect to collapse all text of level 4 headings (i.e. all h5 and below headings are hidden), but see the h4 headings (without text) and h3 and higher headings with text. This is only partly the case, as some h3 and h2 headings are hidden too (the levels are only examples, the issue is true for any level).

Example: Open the page "Microsoft Windows" on Wikipedia and Fold level 4. The last heading shown is "Platform support" (h4). But when you unfold this heading then there are several h2 and h3 headings below, which were hidden. This issue does not only occur for the last heading.

It seems to me that higher level headings (e.g. h2, h3, h4) are hidden if they are after a collapsed heading (e.g. h5).

wunditta avatar Feb 21 '23 14:02 wunditta

Please check the new version https://github.com/tosher/Mediawiker/releases/tag/v3.6.14

tosher avatar Feb 23 '23 16:02 tosher

Thanks, it seems to work now... ... although I must admit I am not sure if I understood the full intention behind the whole folding/unfolding thing. Very likely I am wrong, but this is how I would expect the behavior:

Fold X: I'd expect that all headings from X and higher are folded, all headings less than X are unfolded. This is partly the case. Fold 3 does this. But when I do a fold 4 or 5 afterwards, nothing happens. So only the first part of the expected behavior is true, but headings < X are not unfolded. I might think that it would make more sense to do something (unfolding < X) than nothing happens. Because of this you now have to Unfold all and then Fold again (e.g. Fold 3, Unfold all, Fold 4).

Unfold X: I expected it may unfold >= X (but was not hoping any more it would fold < X ;-) ). But after some tests, as I understood it, the behavior is like this: In a fully unfolded tree nothing happens. If it is folded, e.g. Fold Y=2 and then a Unfold X=4 will unfold all headings (so from Y to 5) for any Y branch of the heading hierarchy where there is a heading X below Y (so the whole branch is unfolded). All Y headings will stay folded if this is not the case. If this is intended behavior I must admit I am not aware of the use case this is needed (but that doesn't mean anything).

Sorry, for this complicated post. Just ignore it, if it went too far. The current behavior is good to live with :-). Thanks again!

wunditta avatar Feb 23 '23 22:02 wunditta

BTW: How do we fold tags, as mentioned in the readme? When I "fold text blocks" it folds the contents of templates, but I don't see tags...?

reagle avatar Mar 01 '23 18:03 reagle

Headings foldling/infolding is the same as level-folding in Sublime text

https://docs.sublimetext.io/reference/commands.html#fold-by-level

Tags - like pre, source and other non-inline blocks.

tosher avatar Mar 05 '23 15:03 tosher

Oh, I thought this could be used to fold tags, but those are inline.

reagle avatar Mar 06 '23 12:03 reagle