Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Bind function for stripping HTML tags #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zakirkun
Copy link

@zakirkun zakirkun commented Jan 3, 2025

This commit adds a new function called Bind to the strip package. The Bind function takes an input interface and strips HTML tags from specific string fields in a struct. It iterates through the fields of the struct, checks for the presence of the "strip_tag" tag set to "true", and if found, it strips the HTML tags from the corresponding string field.

The Bind function ensures that the input is a pointer to a struct and that the dereferenced value is indeed a struct. It uses reflection to access and modify the field values.

This commit also includes a test case for the Bind function, which validates the functionality by creating a sample struct and asserting that the HTML tags are successfully stripped from the specified fields.

This commit adds a new function called Bind to the strip package. The Bind function takes an input interface and strips HTML tags from specific string fields in a struct. It iterates through the fields of the struct, checks for the presence of the "strip_tag" tag set to "true", and if found, it strips the HTML tags from the corresponding string field.

The Bind function ensures that the input is a pointer to a struct and that the dereferenced value is indeed a struct. It uses reflection to access and modify the field values.

This commit also includes a test case for the Bind function, which validates the functionality by creating a sample struct and asserting that the HTML tags are successfully stripped from the specified fields.

Closes #123
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.

1 participant