Skip to content

handle/handleize filter should return a Liquid-consistent value#426

Merged
sebastienros merged 12 commits intosebastienros:mainfrom
hishamco:hishamco/handle
Jan 2, 2022
Merged

handle/handleize filter should return a Liquid-consistent value#426
sebastienros merged 12 commits intosebastienros:mainfrom
hishamco:hishamco/handle

Conversation

@hishamco
Copy link
Copy Markdown
Collaborator

@hishamco hishamco commented Dec 11, 2021

Fixes #424

/cc @deanebarker

[InlineData("One1Two2Three3", "one1-two2-three3")]
[InlineData("ONE1TWO2THREE3", "one1two2three3")]
[InlineData("First_Second_ThirdHi", "first_second_third-hi")]
[InlineData("First_Second_ThirdHi", "first-second-third-hi")]
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The string is converted to lowercase, and any spaces and special characters replaced by hyphens (-).

According to the liquid docs, if the underscore is a special character that means it should be replaced by hypen

@sebastienros
Copy link
Copy Markdown
Owner

Have you looked at how the SlugService works in Orchard?

@hishamco
Copy link
Copy Markdown
Collaborator Author

Have you looked at how the SlugService works in Orchard?

Nope, but I will have a quick look now ...

@hishamco
Copy link
Copy Markdown
Collaborator Author

It quite similar except I used a StringBuilder and SlugService removes the dashes and trim using string. I will try to rid off the Trim extension and trying to mimimize unnecessary iterations as much as I can

@hishamco
Copy link
Copy Markdown
Collaborator Author

Finally I did it with a single loop, hope it goes much better

@hishamco
Copy link
Copy Markdown
Collaborator Author

@sebastienros is there anything else prevent from merge this?

@sebastienros sebastienros enabled auto-merge (squash) January 2, 2022 23:52
@sebastienros sebastienros merged commit 9c83ad8 into sebastienros:main Jan 2, 2022
@hishamco hishamco deleted the hishamco/handle branch January 3, 2022 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

handle/handleize filter doesn't return a Liquid-consistent value

3 participants