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

Html generator for Faker #2769

Merged
merged 18 commits into from
Aug 7, 2023

Conversation

ruban-thilak
Copy link
Contributor

Motivation / Background

This Pull Request has been created because Faker doesn't have an html generator, and this can be used for testing HTML sanitizers or email bodies containing HTML, etc.

Additional information

I implemented this generator by referring to the existing implementation of the markdown generator available in Faker.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug, refactor something, or add a feature.
  • Tests and Rubocop are passing before submitting your proposed changes.

If you're proposing a new generator:

  • Open an issue first for discussion before you write any code. - HTML generator #2767
  • Double-check the existing generators documentation to make sure the new generator you want to add doesn't already exist.
  • You've reviewed and followed the Documentation guidelines.

@ruban-thilak
Copy link
Contributor Author

ruban-thilak commented Jul 7, 2023

Hi @thdaraujo,

Have added the documentation and fixed the flaky spec #2798 as well, Please check. 😄

Copy link
Contributor

@thdaraujo thdaraujo left a comment

Choose a reason for hiding this comment

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

this is really interesting, thanks for working on this!

I left some comments as I would like to keep this generator similar to the markdown one, but I also added some suggestions for improvement.

lib/faker/default/html.rb Outdated Show resolved Hide resolved
lib/faker/default/html.rb Show resolved Hide resolved
lib/faker/default/html.rb Show resolved Hide resolved
lib/faker/default/html.rb Outdated Show resolved Hide resolved
lib/faker/default/html.rb Outdated Show resolved Hide resolved
lib/faker/default/html.rb Show resolved Hide resolved
test/faker/default/test_faker_html.rb Outdated Show resolved Hide resolved
lib/faker/default/html.rb Outdated Show resolved Hide resolved
test/faker/default/test_faker_html.rb Outdated Show resolved Hide resolved
lib/faker/default/html.rb Show resolved Hide resolved
@ruban-thilak
Copy link
Contributor Author

@thdaraujo Have resolved your comments, Please take a look. 😄

doc/default/html.md Outdated Show resolved Hide resolved
doc/default/html.md Show resolved Hide resolved
doc/default/html.md Show resolved Hide resolved
@ruban-thilak
Copy link
Contributor Author

ruban-thilak commented Jul 31, 2023

@stefannibrasil I have added the version and addressed your comments. Please check.

Copy link
Contributor

@stefannibrasil stefannibrasil left a comment

Choose a reason for hiding this comment

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

@ruban-thilak thank you for the changes! I had more time today to test the generators. Looking good, just added a few more comments.

doc/default/html.md Outdated Show resolved Hide resolved
doc/default/html.md Outdated Show resolved Hide resolved
doc/default/html.md Outdated Show resolved Hide resolved
doc/default/html.md Outdated Show resolved Hide resolved
@ruban-thilak
Copy link
Contributor Author

ruban-thilak commented Aug 6, 2023

@stefannibrasil I have made the suggested changes. Please take a look.
And also excluded script and link tags for the sandwich method

Copy link
Contributor

@stefannibrasil stefannibrasil left a comment

Choose a reason for hiding this comment

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

Nice! I'm actually working with HTML parsing, so this came out in a good timing. Thank you!

@stefannibrasil stefannibrasil merged commit f7146f0 into faker-ruby:main Aug 7, 2023
7 checks passed
@chiperific
Copy link

chiperific commented Aug 9, 2023

Is there a timeline to publish v 3.2.1? (I know this is only 2 days old, so not trying to pester)

@stefannibrasil
Copy link
Contributor

I'm planning on doing a release this Friday. In the meantime, feel free use the main branch. Thanks!

@thdaraujo thdaraujo mentioned this pull request Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants