-
-
Notifications
You must be signed in to change notification settings - Fork 269
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
Add html #194
Comments
Yo! I'm back after a week+ off. What's the deal with this? Would this be like generating individual |
Hey buddy! Ready for round 2? So my thought for this is to start with a simple function. Something like HtmlElement() string. and returns a random html element. Just like you described in your previous comment And then next function would take that a step further and do a random complete element And then take that another step further and do a group of element that could be randomly nested <div>
<p>random sentence</p>
<h1>
<li>random something</li>
</h1>
</div> |
Those were just my thoughts. Not sure if anyone would actually use it but I thought it would be interesting to add. Eventually my thoughts were to see how far I could take the idea of generating html to resemble at least something that looks like a website. |
So if I'm correctly understanding, we have one function that basically just generates an HTML stub (nothing in-between), another function that generates single HTML elements with some fake text inside of them, and then another function that generates nested HTML elements with fake data inside of them? |
ya that was my thoughts. each proceeding can use the previous function to get data it needs. |
Cool! I started work on a new branch, see html.go. So far I have stubs and single elements with fields being generated, next I'll do nesting. Should we be able to pass in multiple fields for single elements, or just one? |
Also, something I think may be cool is if there are also functions for populating specific elements with fake data, for example, perhaps we have a What do you think? |
ya thats a pretty good idea. maybe one function that takes in the element. cause otherwise we would have soooo many function to get all the primary html elements that exist |
Sorry! It's been a bit. Finals week and all that good stuff. I am having some trouble right now comprehending exactly how nested HTML would work. I am looking at For example, I don't understand how this: func ExampleFaker_JSON_object() {
f := New(11)
value, err := f.JSON(&JSONOptions{
Type: "object",
Fields: []Field{
{Name: "first_name", Function: "firstname"},
{Name: "last_name", Function: "lastname"},
{Name: "address", Function: "address"},
{Name: "password", Function: "password", Params: MapParams{"special": {"false"}}},
},
Indent: true,
})
if err != nil {
fmt.Println(err)
}
fmt.Println(string(value))
// Output: {
// "first_name": "Markus",
// "last_name": "Moen",
// "address": {
// "address": "4599 Dale ton, Norfolk, New Jersey 36906",
// "street": "4599 Dale ton",
// "city": "Norfolk",
// "state": "New Jersey",
// "zip": "36906",
// "country": "Tokelau",
// "latitude": 23.058758,
// "longitude": 89.022594
// },
// "password": "qjXy56JHcVlZ"
// }
} Produces the output there. |
Hey! No problem! So instead of looking at the json functions, the more similar one to look at in this situation would be the sentence and paragraph functions. If that makes sense. |
Gotcha, in that case, do we not care about what is inside each HTML element? Will we just generate stubs? Do we want nested HTML as a feature? |
So I think this one best explains the 3 functions I was thinking about. Let me know if I need to better describe it. |
Are the random things within the HTML elements user-specified or arbitrary? I.e. sentences? |
arbitrary |
Add input fields and svg generators |
I have been having a play around with the HTML generator https://github.com/Mrpye/gofakeit/blob/experimental/html_elements.go I might be overkill, got a bit carried away. |
Ill take a look at those as soon as we finalize the template stuff. |
Add ability to add random html elements.
The text was updated successfully, but these errors were encountered: