Repository navigation
feat(title): join the text of all elements matched by a selector with |all - #569
Merged
Merged
Conversation
#552) {.tags span|all} joins every matched element with a space, and {.tags span|all:SEP} with a custom separator (taken as-is, spaces included). Without |all, a selector still uses the first match. Documented in the Help pane.
📦 Extension Build Ready!Version: 📥 Download Extension (tabee.zip)Installation
Status
🤖 Auto-generated by GitHub Actions |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
Merged
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.
Closes #552.
Problem
A
{css-selector}in a title only reads the first matching element. To show a variable number of tags, users had to chain:nth-of-type(1),:nth-of-type(2)… which breaks when there are more or fewer elements.Feature
A
|allsuffix joins the text of every matching element:{.filter-tags-selected-wrap span|all}tag1 tag2 tag3(space by default){.tags span|all:, }tag1, tag2, tag3-{.filter-tags-exclude-selected-wrap span|all: -}-ex1 -ex2all:is the separator, spaces included.*) selectors.|all, behaviour is unchanged (first match).Implementation
getTextBySelectoris split intoquerySelectorAll(wildcard expansion, unchanged logic) andgetElementText(input value, selected option or text, unchanged logic), so single and|allselectors share the same code.Tests
|all, and a fullprocessTitletemplate combining two|allselectors.{.inc span|all} -{.exc span|all: -}givestag1 tag2 tag3 -ex1 -ex2. One very first run showed the raw template; I couldn't reproduce it in 4 later runs, so it looks like a one-off.vue-tscand build pass.