Static tabs macro - Intended to be used with static output#9845
Draft
pmario wants to merge 10 commits into
Draft
Static tabs macro - Intended to be used with static output#9845pmario wants to merge 10 commits into
pmario wants to merge 10 commits into
Conversation
Introduces $:/core/macros/static-tabs which renders every tab visibly as a sequence of - <section> blocks (default) or - <details open> blocks, with no $reveal widget, no JS, no state tiddler. Internal headings auto-demote via tv-adjust-heading-level so tab content nests below the configured section heading level. Also adds three TestCase tiddlers under TestCases/StaticTabs/ that share a common SharedSamples compound tiddler via the import-compound field.
Outer call sets tv-static-tabs-depth and tv-static-tabs-mode. Inner call inherits the mode if none passed, and shifts headingLevel by depth (capped at h6). SampleTabFour now calls <<static-tabs>> directly to exercise nested rendering.
The core <<tabs>> macro now delegates to <<static-tabs>> when tv-config-static is "yes". static-tabs derived variables use the underscore-prefix convention from the toc macro header (e.g. headingLevel param resolves to _headingLevel, mode to _mode). Computation chain inside the macro also uses _-prefixed locals (_levelNum, _ownShift, _parentShift, _shift).
-sections and -details now wrap <<tabs>> in <$let tv-config-static="yes"> (plus tv-static-tabs-mode="details" for the latter). SampleTabFour reverts to <<tabs>> and inherits via propagation. -auto deleted as redundant.
- Captions transcluded via `<$transclude field="caption">` so values
like `{{$:/language/.../Caption}}` resolve to rendered text.
- Default mode flipped to `details`; pass `tv-static-tabs-mode="sections"`
to override.
- Adds vanilla stylesheet for bordered cards.
- Adds `-vertical` test case; `NestedTabC` now exercises three-level
nesting via inner `<<tabs>>`.
Setting `tv-config-static-tabs-closed="yes"` makes static-tabs in details mode emit `<details>` without the `open` attribute, so each tab renders collapsed by default. Implemented by splitting `static-tabs-detail` into helper procedures (`-summary`, `-body`) and building the `<details>` opening as a backtick-substituted string so the conditional `open` keyword is inlined into a single tag.
`static-adjust-heading-level` field on a tab tiddler is added to the auto-derived shift (+/- integer, 0 = unchanged). `StaticTabs` plus five pitch tabs, with three further tabs nested under `OneVariable`. Test cases `-details`, `-sections`, `-vertical` import the new compound and transclude `StaticTabs` via the modern transclude widget.
✅ Deploy Preview for tiddlywiki-previews ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Confirmed: pmario has already signed the Contributor License Agreement (see contributing.md) |
📊 Build Size Comparison:
|
| Branch | Size |
|---|---|
| Base (master) | 2489.5 KB |
| PR | 2495.7 KB |
Diff: ⬆️ Increase: +6.2 KB
⚠️ Change Note Status
This PR appears to contain code changes but doesn't include a change note.
Please add a change note by creating a .tid file in editions/tw5.com/tiddlers/releasenotes/<version>/
📚 Documentation: Release Notes and Changes
💡 Note: If this is a documentation-only change, you can ignore this message.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The static tabs macro is mainly intended to be used to render static output, that contains tabs.
The PR contains 4 test tiddlers
Detailed docs is still missing. Playing with it, prior to publishing, it seems there is a lot more potential, for wikitext use too.