7 kyu
HTML Generator
1,187 of 2,209jgdodson
Loading description...
Functional Programming
Puzzles
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
C translation kumited! Please let me know if you would like the random tests to include test cases involving innerHTMLs of nested elements. :)
The richer the tests, the better. If you don't mind adding them, that'd be great! Also, would you mind editing the kata description by adding a translation of the example code (the code in the description itself) into C? Thanks-a-million!
Sure!
Done! Aside from random tests involving randomly nested elements, I also issued a hotfix (forgot to add the paragraph element to the kata).
Please let me know if anyone finds any issues or bugs with the translation. I'll fix it.
Thanks! :)
Hi there. Thanks for the c translaion. I seem to be experiancing some crashes, but only with one of the tests:
ElementTitleShouldWorkForNestedElements ✔ Test Passed ✘ Test Crashed Exit code: 0 Signal code: 6
STDERR: *** Error in `/workspace/solution': free(): invalid next size (fast): 0x000000000213ec40 ***
All the rest of my tests pass, and I'm using the same code for every function call.
A fun Kata to complete but I have a few suggestions:
HTMLGen.div("random string") === "<div>random string</div>"
?Anyway, good job with the Kata, keep it up :D
if any one want to add img tag inside the code .what will have to do. plese show for me
can anyone add a 'img' tag
Can you please change the tests (Javascript, both preloaded test cases and final test cases) so instead of
Test.expect
they useTest.assertEquals
? It would give much better feedback, showing what your code returned on tests that fail.Also note that
Test.assertEquals
wants the expected value first, then the value being tested:If they're in the other order, the error message will be wrong, saying that the wrong value was expected and the correct value was returned.
Hi, I've added a CoffeeScript translation, if you want to approve it, instructions for the approval process are here.
In Python translation the pre-set code uses class name
HTMLGen
, while pre-set tests use class namehtmlGen
.No.
htmlGen
is not a name of the class, it is an object of classHTMLGen
created in the first line of test case code:htmlGen = HTMLGen()
When I was writing Python translation, I copied this behaviour from JS, so this is supposed to be that way.
"class HTMLGen created in the first line of test case code" - that's not true for Python. When I insert a valid solution and press "Run Tests", I get "NameError: name 'htmlGen' is not defined". The pre-set tests look like this exactly, no object defined:
Oh, now I get what is the problem. I did not create the
htmlGen
object in the Example test cases (while it is created in test cases intended for submission).Unfortunately, I can no longer edit the kata for some reason. Someone with edit access can correct this. Just inserting
htmlGen = HTMLGen()
in the first line of Example test cases will resolve this issue.Sorry, I can't edit it neither. :(
Only the author or a moderator can edit the kata at this point, although this seems like a bug.
This issue seems to be fixed. Can you please re-check?
Yeah, it seems to be fixed. Thank you!
I created Python translation. Please approve it.
In Python translation the pre-set code uses class name
HTMLGen
, while pre-set tests use class namehtmlGen
.Nice kata although I think
7kyu
is too low for this one.6kyu
would fit better imo.I think that since defining methods on prototype is generally a better idea than doing that in the constructor, maybe you'd change the predefined function accordingly?