openlab-at-city-tech / webworkqa

WeBWorK integration for WordPress and BuddyPress
GNU General Public License v2.0
4 stars 2 forks source link

WeBWorK generates dummy divs that produce too much vertical spacing #136

Closed boonebgorges closed 5 years ago

boonebgorges commented 5 years ago

Take the following rendered content on the WP side:

screenshot_2018-09-25_13-59-48

It has lots of odd vertical space. This comes from a combination of its <br /> logic and the fact that WeBWorK is sending over lots of dummy divs of the form <div style="margin-top:1em"></div>.

screenshot_2018-09-25_14-00-02

I can fairly easily strip out these empty divs, but before doing so, I wanted to check with @drdrew42 to be sure that this was something WW is doing on its own, not something that is being added manually to the problem markup. (I don't see anything when I edit the problem on the WW side.)

boonebgorges commented 5 years ago

Ping @drdrew42 - Could you confirm that WW is generating these empty divs on its own? If it's something being caused by something you're doing manually, we might need a different tack.

drdrew42 commented 5 years ago

WW is generating these empty divs when it renders the problem code. But I'm not seeing anything particular about the code itself that suggests where or why these are called for.

boonebgorges commented 5 years ago

Got it. I assume that WW does it for presentational purposes. This is annoying, but as long as it's consistent, I can work around it.

boonebgorges commented 5 years ago

It took a good deal of wrestling but I think I've got this working. Redundant whitespace between elements and empty divs are now stripped from problem text.

bree-z commented 5 years ago

I think this is looking good. There are a few places where it looks like there needs to be extra whitespace, but part of that might be the way the problem text is getting broken into multiple lines on OL WW because of the narrow width, when compared to WW. I'm posting an example below just to double check. Thanks!

WW: http://mathww.citytech.cuny.edu/webwork2/WW-Dev/Polynomials_-_Division/1/?user=student1&key=w2WI3A6LcFHoQsHn2nGADLmes81eKvNl&effectiveUser=student1

WW-OL: http://openlabdev.org/webwork-playground/#:problemId=local2/setPolynomial_Division/intro-long-division.pg:questionId=11809

WW linebreaks1ww

OL-WW linebreaks1olww

WW linebreaks2ww

OL-WW linebreaks2olww

boonebgorges commented 5 years ago

Thanks, Bree! Your screenshots do indeed look like it has to do with the way things are broken into separate lines in OL-WW. I don't know of a good way to eliminate this systematically without reintroducing the problem of lots of extra whitespace, so I'd suggest we call this good enough.