-
Notifications
You must be signed in to change notification settings - Fork 46
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
Omd_tyxml #211
Omd_tyxml #211
Conversation
Thanks very much for the initial feedback, @nojb! And sorry for the very rough state! As I noted, I only meant to rough in some broad strokes to get direction on a few major points, and your replies here -- and on the originating issue -- have been super helpful and informative in this direction. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AH! I forgot to submit these comments. They help make more sense
@shonfeder let me know when the code is ready for another review pass. Thanks! |
I've still got some cleanup to do here, but the basic functionality is in place and, afaik, all the tests should be passing in spirit. I'm finding the tests quite testy, due to trivial white space differences and arbitrary formatting differences (some end with new lines, some done, one way of generation produces breaks after certain tags, another way doesn't, etc). I pulled in lambdasoup as a testing dep hoping to fully normalize the HTML so we wouldn't have to fuss with string munging, but it's not working as well as expected. In fact, for some reason some (but not all!) of the HTML test cases are ending up with duplicated tags, causing spurious test failures. I have no idea what's causing these, but I'll look with fresh eyes later in the week. |
One easy way around this is to pretty-print the expected HTML output found in the test files. The output is already being extracted to generate the I was resisting to do this because when pretty-printing there is always the chance that a bug may squeak in. But if it is getting too hard to nail the spec formatting on the head, I think this is a valid way to go. |
Sounds good, let me know when it is ready for another review pass. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to see this going forward! Here's a bunch of preliminary reviews, don't hesitate to ask questions.
| Strong s -> Html.[strong ~a:[] (of_inline s)] | ||
| Hard_break -> Html.[br ~a:[] ()] | ||
(* TODO Add option for verified html ?*) | ||
| Html raw -> Html.Unsafe.[data raw] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is "correct" as long as the HTML is textual. As soon as you start using the non-textual Tyxml backends (for instance, Tyxml_js`), this is broken and you have to do more work.
Long term, I think it would be beneficial to provide a functor over the HTML module to adapt to different Tyxml instantiations (and provide a pre-applied instance for text!). The "right" solution is then to decode the HTML with lambdasoup and build actual tyxml trees. Then you can build DOM trees from markdown directly, without going through text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether we want this generalization as part of the current PR, or as a followup, but I agree we should target it in the long run.
I think we first need to settle settle whether or not we can replace the bespoke html generator with Tyxml.
Your fears have been validated, @nojb! I've been going a bit crazy trying to figure out why there is weird duplicate html in some of the generated test fragments (causing the parsing checks to fail). Turns out, a bug indeed squeaked in :)
|
Well, that's because your HTML is incorrect (unclosed |
Oof! I nearly forgot about this! Life has came at us fast this year 😬 -- still, sorry for letting this linger so long! I don't have time to dig into this again this weekend, but I hope to revisit the next weekend. IIRC, this isn't far off really, and thanks to Drup's feedback it should be easily to make the suggested improvements and push through the final bit. |
9409796
to
0f51039
Compare
For sandboxed development
These are just for exploring initial implementation approach. The actual tests should work on the specs the same way that the omd tests do.
I did not mean to add this file
Using the same approach and infrastructure as the core omd package.
(On my machine in any case.)
Thanks to Drup for guidance here.
More guidance from Drup.
As per the spec and current HTML implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,4 @@ | |||
let normalize_html s = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We won't need this as a separate module if we decide to go with one package.
(modules extract_tests)) | ||
|
||
; Code shared between various parts of the testing apartus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto re: not needing this if we go with one packages.
a01807e
to
4026767
Compare
None of this has any purchase in my working memory any more, the AST has changed, and there are numerous conflicts. So I'm gonna close this and will consider opening separately at some point. |
This is just at an early exploratory stage, to explore out the space and be sure I'm headed in the right direction, before I actually set out in earnest.
Closes: #82