PreTeXtBook / pretext

PreTeXt: an authoring and publishing system for scholarly documents
https://pretextbook.org
Other
266 stars 208 forks source link

CSS surrounding WeBWorK conclusion #503

Closed Alex-Jordan closed 6 years ago

Alex-Jordan commented 7 years ago

If you go to: http://mathbook.pugetsound.edu/examples/webwork/sample-chapter/html/section-1.html and click to open the first WeBWorK knowl, it opens after the conclusion instead of before the conclusion.

In trying to address this, we should be careful not to break something else. I'm shortly going to submit a PR with a new section in the WeBWorK sample chapter that demonstrates every combination of components that would go into a WeBWorK layout. Best to get that up before trying to work on this.

rbeezer commented 7 years ago

The knowl there, whose clickable is WeBWorK Exercise is wrapped in a div.hidden-knowl-wrapper The only purpose of that div is to give the knowl something to open up right after.

So it is a bit of a mystery to me why the knowl finds its way below the conclusion to open. I think @davidfarmer might want to take a look?

rbeezer commented 7 years ago

504 has now introduced lots of situations for testing.

Alex-Jordan commented 7 years ago

See: http://mathbook.pugetsound.edu/examples/webwork/sample-chapter/html/section-11.html for all 2^4 combinations that I am aware of.

Alex-Jordan commented 7 years ago

I've noted this elsewhere, but I think I should repeat it here.

I think it looks good for the WeBWorK knowl to be inline with the exercise number when there is no introduction. Regardless of whether there is a title. Regardless of whether the exercise is free range or sectional.

If there is an introduction, I think it is best to have the introduction inline with the problem number, and have the WeBWorK knowl reset to start a new block. Regardless of whether there is a title. Regardless of whether the exercise is free range or sectional.

All of this is currently in place. However I think that part of what is making these things work out is responsible for the knowl opening subsequent to conclusion elements. (Because the WeBWorK knowl's surrounding div has display:inline.)

Alex-Jordan commented 7 years ago

@davidfarmer Would you take a look at this when have a chance? In summary, if you go here: http://mathbook.pugetsound.edu/examples/webwork/sample-chapter/html/section-11.html

Then you can see how exercises 11.1.5--11.1.8 open up after the conclusion.

rbeezer commented 7 years ago

High probability this ball is in my court, likely due to lacking a div.

The request to make knowls more configurable for WW exercises was almost unattainable, since they were grafted in under certain assumptions that are now being requested to change.

These things ("environments") need a (another) major refactor.

On 04/14/2017 09:58 AM, Alex Jordan wrote:

@davidfarmer https://github.com/davidfarmer Would you take a look at this when have a chance? In summary, if you go here: http://mathbook.pugetsound.edu/examples/webwork/sample-chapter/html/section-11.html

Then you can see how exercises 11.1.5--11.1.8 open up /after/ the conclusion.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rbeezer/mathbook/issues/503#issuecomment-294190947, or mute the thread https://github.com/notifications/unsubscribe-auth/ABy2cpwVRAT5uzYYo3WS3GlTsyh0O-CXks5rv6WsgaJpZM4LiixZ.

davidfarmer commented 7 years ago

The problem is that the hidden-knowl-wrapper around the "WeBWorK Exercise" knowl is set to be display: inline. So when the knowl looks for the nearest enclosing block element, it goes to the next level out.

In other contexts, the hidden-knowl-wrapper is block level, which it needs to be because its whole purpose is to make the knowl open in the right place.

So, there is a tension between standard knowl behavior and having "WeBWorK Exercise" appear inline.

Let's think for a while before making any changes, because right now it looks like both the HTML markup and the CSS have to change, and it is best to not be too hasty with multiple changes.

On Fri, 14 Apr 2017, Rob Beezer wrote:

High probability this ball is in my court, likely due to lacking a div.

The request to make knowls more configurable for WW exercises was almost unattainable, since they were grafted in under certain assumptions that are now being requested to change.

These things ("environments") need a (another) major refactor.

On 04/14/2017 09:58 AM, Alex Jordan wrote:

@davidfarmer https://github.com/davidfarmer Would you take a look at this when have a chance? In summary, if you go here: http://mathbook.pugetsound.edu/examples/webwork/sample-chapter/html/section-11.html

Then you can see how exercises 11.1.5--11.1.8 open up /after/ the conclusion.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rbeezer/mathbook/issues/503#issuecomment-294190947, or mute the thread https://github.com/notifications/unsubscribe-auth/ABy2cpwVRAT5uzYYo3WS3GlTsyh0O-CXks5rv6WsgaJpZM 4LiixZ.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.[AAM6LD-qu9zQD1gg5xfelLU10p-t43tcks5rv6chgaJpZM4LiixZ.gif]

davidfarmer commented 7 years ago

Is this a bad idea:

When the knowl looks for the nearest enclosing block element (so that the knowl contents can appear after it) it treats .hidden-knowl-wrapper as a special case. If it encounters such an element when moving up the tree, it will set the knowl contents to appear after that, even if that element is styled to be inline.

This seems to be a faithful interpretation of the meaning of .hidden-knowl-wrapper, but of course it is easy to concoct examples where this results in undesirable behavior. At the moment I can't think of how such an example would be "reasonable".

If we go that route, should we look for a better name than "hidden-knowl-wrapper". (I always thought the "hidden" part was confusing, because what is being hidden?)

davidfarmer commented 7 years ago

This is fixed.

I modified the knowls code so that if the parent() (or parent().parent()) hasClass("hidden-knowl-wrapper"), then the knowl opens after it.

Please confirm and then close.

Alex-Jordan commented 7 years ago

Why is it different here (http://mathbook.pugetsound.edu/examples/webwork/sample-chapter/html/section-11.html, 11.1 exercise 1) compared to here (http://greenprecalc.com/precalc1-MHCC/composition-and-inverse-gist.html, 7.3.3 exercises)?

I just processed and posted the latter example's HTML this morning, and my mathbook repo is up to date.

davidfarmer commented 7 years ago

The 7.3.3 exercises have an article.introduction which contains only an empty paragraph. That causes the exercises to be pushed to the next line, so it is an unrelated issue. (The current issue is about where the knowl opens, not where the knowl link appears.)

If that empty p was eliminated (and the empty article), then the display should be fine.

On Fri, 28 Apr 2017, Alex Jordan wrote:

Why is it different here (http://mathbook.pugetsound.edu/examples/webwork/sample-chapter/html/section-11.html, 11.1 exercise 1) compared to here (http://greenprecalc.com/precalc1-MHCC/composition-and-inverse-gist.html, 7.3.3 exercises)?

I just processed and posted the latter example's HTML this morning, and my mathbook repo is up to date.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.[AAM6LAqLSUpzvkjkoOCQ2pv37OnCywIUks5r0oHWgaJpZM4LiixZ.gif]

Alex-Jordan commented 6 years ago

This was almost certainly fixed by David long ago. But it's also moot now, because we will no longer be knowlifying a webwork alone. (Now you just knowlify the entire exercise if you want.)