Skip to content

Conversation

@Mpdreamz
Copy link
Member

@Mpdreamz Mpdreamz commented Jul 15, 2025

This PR adds syntax support for mutation the contents of variables through a chain of operators.

{{variable | op1 | op2 | op3}}

Operator Purpose
lc LowerCase,
uc UpperCase,
tc TitleCase, capitalizes all words,
c Capitalize the first letter,
kc Convert to KebabCase,
sc Convert to SnakeCase,
cc Convert to CamelCase,
pc Convert to PascalCase,
trim Trim common non word characters from start and end

For variables declaring a semantic version or Major.Minor the following operations are also exposed

Operator Purpose
M Display only the major component
M.x Display major component followed by '.x'
M.M Display only the major and the minor
M+1 The next major version
M.M+1 The next minor version

This allows a more generic yet rigorous approach to displaying version numbers in the plethora of different formats the docs might need them to:

image

@Mpdreamz Mpdreamz requested a review from a team as a code owner July 15, 2025 10:04
@Mpdreamz Mpdreamz self-assigned this Jul 15, 2025
@Mpdreamz Mpdreamz requested a review from a team as a code owner July 15, 2025 10:04
@Mpdreamz Mpdreamz changed the base branch from main to feature/expose-version-variables July 15, 2025 10:04
@Mpdreamz Mpdreamz changed the title feature/variable mutation operators Add support for variable operator syntax Jul 15, 2025
@github-actions
Copy link

github-actions bot commented Jul 15, 2025

🔍 Preview links for changed docs

Copy link
Member

@reakaleek reakaleek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@Mpdreamz Mpdreamz merged commit 3fa4b33 into feature/expose-version-variables Jul 15, 2025
20 of 21 checks passed
@Mpdreamz Mpdreamz deleted the feature/variable-mutation-operators branch July 15, 2025 21:23
Mpdreamz added a commit that referenced this pull request Jul 16, 2025
* Add support for version context variables

* Apply suggestion from @reakaleek

Co-authored-by: Jan Calanog <[email protected]>

* Apply suggestion from @reakaleek

Co-authored-by: Jan Calanog <[email protected]>

* Add support for variable operator syntax (#1563)

* Add support for variable operator syntax

* do not report version variables as unused

* Allow a space after {{

* carry trimming over to split

* Temporarily make variables with spaces that are not found hints, we used to not do anything here

* flip ternary

---------

Co-authored-by: Jan Calanog <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants