Index sub-tab name more fixes, and first tab CSS class fix #97
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Recently there was the change
Fix the index sub-tab name when childs are hidden
to address the issue
#92 Text in first child tab should always inherit from parent tab
I think there are still some problems remaining though.
When the code looks back through sections to find the previous first-level section, it ignores sections set as second-level, except section 0 (which will always be first-level regardless of setting). I think this is mostly right, but if section 0 is visualised before the tabs, then it should also not ignore the first visible section after section 0 (this will also always be first-level regardless of setting). Also, when the code looks back, it doesn't ignore hidden (first-level) sections, which I think it should. To fix these, instead of looking back to find the previous first-level section, I have used the approach of remembering the most recent first-level section. I have changed a nested if statement into a single check to avoid duplicate code (indenting is fixed in a separate change, to make the initial change more readable).
The code to determine when an index tab is selected still assumes the previous section is the parent. To fix this, I have referred to the previously found parent section.
Unrelated, but I also noticed tabs' CSS class, as set in $specialstyle has tab_level_{$level}, where $level is the level setting, not accounting for exceptions (section 0, or first following section if section 0 is visualised before the tabs). To fix this, I have moved the check count($tabs) == 0 earlier.