openlab-at-city-tech / webworkqa

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

Many linebreaks are being inserted before PGML-formatted tables #131

Closed boonebgorges closed 5 years ago

boonebgorges commented 6 years ago

See https://i.imgur.com/1nPNtUB.png

There are many <br> elements in the rendered source, so I'm guessing that this is related to #82. The application is supposed to strip duplicate <br> but there must be something weird happening in this case.

drdrew42 commented 6 years ago

This is happening in a specific problem - and that problem is using a non-standard method for generating a table. Perhaps we revise the problem itself (and simultaneously move it away from using deprecated table-code).

Tables used in other problems (via "niceTables") do not have this spacing issue. See http://mathww.citytech.cuny.edu/webwork2/MAT1375/Polynomials_-_Division/1/

boonebgorges commented 6 years ago

I think it's a good idea in general to standardize on a technique for creating tables (and other bits of "specialty" markup), if only to preserve our collective sanity when we try to parse and style it on the OL-WW end.

As for this specific issue, it seems to be a bug in webwork-for-wordpress that so many line breaks would be allowed in the content at all, so it's worth looking at in more detail regardless of whether we abandon the specific table markup.

drdrew42 commented 6 years ago

I'll work on revising the table, but I will wait to implement until we've done some further testing, then?

boonebgorges commented 6 years ago

Yes, please leave this specific example in place so that I can do the necessary debugging. But you should feel free to go ahead and start researching a general approach for tables.

boonebgorges commented 5 years ago

Eesh, this turned out to be a difficult one to diagnose. It turns out that the original markup had some line breaks between table elements, eg:

<table><tr><td>foo</td> </tr><tr>...

My linebreak-converting script was catching these linebreaks and converting them to <br /> tags. On render, the browser was rejecting <br /> elements inside of <tables>, and rendering them instead just before the table.

I added some parsing that eliminates all non-content-related line breaks inside of table elements, and it seems to have fixed the problem. See http://openlabdev.org/webwork-playground/#:problemId=local2/setDifference_Quotient/intro-diff-quot.pg

bree-z commented 5 years ago

This seems fine, but just going to give it one more check to be sure!

bree-z commented 5 years ago

This looks good to me.