WeBWorK Problems

helpLink shifts item numbers in ordered lists (HTML only)

helpLink shifts item numbers in ordered lists (HTML only)

by Joseph Lo -
Number of replies: 4

Hi,

I am running WeBWorK 2.17. I noticed that every time the function "helpLink" is called, the item number in an ordered list increases by 1. The attached code at the end generates an ordered list as follows:

This is a list.
  1. Number one
  2. Number two
  3. Number three, a helpLink: unit
  5. Number four, two helpLinks: numberpoint
  8. Number five
This is the end of the list.

Each time helpLink is called, the item number increases by one. This only affects HTML but not LateX. Does this problem have something to do with "/pg_files/js/apps/Knowls/knowl.xxxxxxxx.min.js"?

Will there be a fix or a workaround that I can apply on the server? Thanks very much in advance for any help.

Joseph


####################################################################################

DOCUMENT();

loadMacros("PGstandard.pl");


$BOL = MODES(TeX=>'\begin{enumerate} ', HTML=>'<ol> ');

$EOL = MODES(TeX=>'\end{enumerate} ', HTML=>'</ol> ');

$ITEM = MODES(TeX=>'\item ', HTML=>'<li> ');


BEGIN_TEXT

This is a list.

$BOL

$ITEM Number one

$ITEM Number two

$ITEM Number three, a helpLink: \{helpLink("unit")\}

$ITEM Number four, more helpLink: \{helpLink("number")\}, \{helpLink("point")\}

$ITEM Number five

$EOL

This is the end of the list.

END_TEXT


ENDDOCUMENT();

In reply to Joseph Lo

Re: helpLink shifts item numbers in ordered lists (HTML only)

by Glenn Rice -
This is fixed in the develop branch for the next release. See https://github.com/openwebwork/pg/pull/795. You could make the changes in that pull request. That would be the only way to fix this for webwork2/pg 2.17.
In reply to Glenn Rice

Re: helpLink shifts item numbers in ordered lists (HTML only)

by Joseph Lo -
Thank you so much, Glenn. I found the new knowl.js using your link. I copied the entire code, pasted it to knowl.xxxxxxxx.min.js and the problem is fixed.
In reply to Joseph Lo

Re: helpLink shifts item numbers in ordered lists (HTML only)

by Glenn Rice -

You really shouldn't paste the code into knowl.xxxxxxxx.min.js.  Instead you should paste it into knowl.js.  Then run "npm ci" in the pg/htdocs directory.  That will generate a new knowl.xxxxxxxx.min.js file with the updated contents with a new xxxxxxxx hash.  Make sure to restart apache2 so that it loads the updated static-assets.json file.  This way your users will not need to do a hard refresh in their browsers to get the updated content.  If you change knowl.xxxxxxxx.js directly they will need to do that, or the browser will use the cached file.

In addition, by changing knowl.js and running "npm ci", the javascript is minimized.  This reduces the size of the file and saves bandwidth for your users.

In reply to Glenn Rice

Re: helpLink shifts item numbers in ordered lists (HTML only)

by Joseph Lo -
I see. This explains the purpose of those xxxxxxxx.min.js files. Thank you so much!