Skip to content

PG 2.21 Release Candidate#1393

Open
drgrice1 wants to merge 284 commits into
mainfrom
PG-2.21
Open

PG 2.21 Release Candidate#1393
drgrice1 wants to merge 284 commits into
mainfrom
PG-2.21

Conversation

@drgrice1

Copy link
Copy Markdown
Member

This is the release candidate for WeBWorK 2.21. Please re-target any pull requests that you want to get into the release for this branch.

sfiedle1 and others added 30 commits August 30, 2025 19:31
Charge notation in contextReaction.pl
Fix parameter check in BeginList function
When I updated the sample problem documentation to use CodeMirror 6,
apparently prettier accidentally ran on the `problem-template.mt` file
(due to the format on save feature in my editor).  Since that is a
Mojolicious template file, prettier does not do the right thing, and
messed that file up pretty well.  So this fixes the resulting issues.

Also, fix several typos in the sample problems that have a PODLINK or
PROBLINK that have incorrect macro or sample problem file names.  These
cause "use of unitialized value" warnings when the
`parse-problem-doc.pl` script is executed. These warnings also occur
when loading these sample problems via webwork2.

Finally, switch the sample problem templates to using the same version
of Bootstrap that webwork2 uses.
…ns.pl in TeX display mode.

The default "separator" is a $BR which is defined to be
`\\leavemode\\\\\\relax` if the display mode is TeX.  This doesn't work
if the CheckboxList or RadioButtons happen to be in a table.
Furthermore, the separator doesn't make sense in TeX display mode in any
case.  So this makes it so that the separator is just not used in the
TeX display mode.

This is to address issue #1300.
Several times in the file the variable `$self` is used where it is not
defined.  So if the `$self->Error` method is actually called it results
in the error "can't call Error on an undefined value".

Also the wrong counts are used in the `randomPrime` method resulting in
unexpected behavior.

Finally, if the `$end` parameter to the `_getPrimesInRange` is prime,
then include it in the returned primes in the range.  Thus, the
`randomPrime` method will potentially be the `$end` parameter.  I.e.,
`randomPrime(1, 11)` could return 11.

This is to address the things discussed in #1296.
Fix some issues with sample problem documentation generation.
Ignore the "separator" for parserCheckboxList.pl and parserRadioButtons.pl in TeX display mode.
The following dependencies are updated:

* jsxgraph: 1.10.1 -> 1.11.1
* plotly.js-dist-min: 2.23.0 -> 3.1.0
* sortablejs: 1.15.2 -> 1.15.6
* autoprefixer: 10.4.19 -> 10.4.21
* chokidar: 3.6.0 -> 4.0.3
* cssnano: 6.1.2 -> 7.1.0
* postcss: 8.4.38 -> 8.5.6
* prettier: 3.2.5 -> 3.6.2
* rtlcss: 4.1.1 -> 4.3.0
* sass: 1.75.0 -> 1.90.0
* terser: 5.30.4 -> 5.43.1
* yargs: 17.7.2 -> 18.0.0

All libraries are now at their latest version.

Note that the only change to the PG code required is a minor change to
the generate-assets.js script due to a change in the usage of yargs.
Fix several issues with the `contextInteger.pl` macro.
…sion to molecular form, and allow comparisons based on molecular forms, better handling of charges
Fix typo in POD generation of parserCheckboxList.pl
See issue #1301 for details of the changes and examples to test with.
Fix issues with the legacy NumberWithUnits.
The `format_matrix_HTML` method uses `span` tags to format the html
output for matrices. This is a problem when that is used to format the
output for an `ans_array` answer because the answer inputs inside now
are wrapped in `div` tags (so that the feedback button works in a valid
html way).  So this just switches to using `div`s instead.  This doesn't
change the result at all since the containg array layout div already has
`display:inline-block` set.

There is one minor tweak to the style.  I added `text-align:center;` to
the cells.  This just looks better in about all of the cases that I have
observed. Note that this is also consistent with when these objects are
displayed in math mode via MathJax or as an image with the image display
mode.

Note that method is used ans_array matrix, vector, and point answer
rules, as well as the "Entered" feedback preview of the student answer
for those answers. It also affects the "textual" correct answer, but
that actually isn't used for anything anymore.
openwebwork/mathquill#39 and
openwebwork/mathquill#40 have been merged and a
new version of @openwebwork/mathquill have been merged.  This updates to
the newly published version that includes those fixes.
Update the MathQuill version to pull in some fixes.
Fix invalid html for ans_array answers.
pstaabp and others added 30 commits June 2, 2026 14:05
method to set a particular entry in a matrix to a value
I accidentally removed the default value for the `indices` argument to
the `htmlBucket` function in #1394. That breaks the "Add Bucket" button
because when it constructs a new `Bucket` there are no `indices`. This
happened because I converted this JavaScript into TypeScript in a
webpack built project for testing, and in the conversion back to
JavaScript I deleted the typing that was added to the parameter, but was
to aggressive in the deletion, and also deleted the default value.

For a basic problem to test with you can use:

```Perl
DOCUMENT();

loadMacros('PGstandard.pl', 'PGML.pl', 'MathObjects.pl', 'draggableSubsets.pl');

$draggable = DraggableSubsets(
    [
        '\(e\)',  '\(r\)', '\(r^2\)', '\(s\)',
        '\(sr\)', '\(sr^2\)'
    ],
    [ [ 0, 3 ], [ 1, 4 ], [ 2, 5 ] ],
    DefaultSubsets => [
        {
            label     => 'Coset 1',
            indices   => [ 0 .. 3 ],
            removable => 0
        },
        {
            label     => 'Coset 2',
            indices   => [4],
            removable => 1
        },
        {
            label     => 'Coset 3',
            indices   => [5],
            removable => 1
        }
    ],
    BucketLabelFormat => 'Coset %s',
    AddButtonText     => 'Add Coset',
    RemoveButtonText  => 'Remove Coset',
);

BEGIN_PGML
Let [``G = D_3 = \{ e,r,r^2, s,sr,sr^2 \}``] be the Dihedral group of order
[`6`], where [`r`] is the counter-clockwise rotation by [`2\pi/3`], and [`s`] is
the reflection across the [`x`]-axis.

Partition [`G = D_3`] into *right* cosets of the subgroup [`H = \{ e, s \}`].
Give your result by dragging the following elements into separate buckets, each
corresponding to a coset.

[_]{$draggable}
END_PGML

ENDDOCUMENT();
```
Fix the drag and drop "Add Bucket" button.
The `MathJax.typesetPromise` calls no longer need to be passed through
the `MathJax.startupPromise` according to @dpvc. See his comments on
this in openwebwork/webwork2#2955.

Also, make the `MathJax.typesetPromise` calls to typeset popover
contents specific to the particular popover that needs to be typeset
instead of typesetting all popovers in the page. This is not done in the
way that @dpvc suggested because moving the typesetting from the
`show.bs.popover` event to the `shown.bs.popover` event results in
visual motion as the popover is typeset and possibly resized, and that
is not desirable. Instead a timeout is used.  This works because
Bootstrap creates the `popover.tip` element immediately after Bootstrap
triggers the `show.bs.popover` event, and so when the timeout handler is
executed it is available to work with. But that is still before the css
transitions are complete which is when the `shown.bs.popover` event is
triggered.

Note that in `htdocs/js/Knowls/knowl.js` and `htdocs/js/DragNDrop/dragndrop.js`,
the `typesetPromise` method is often not yet defined on the `MathJax`
object when those calls are made.  That is okay, because if it isn't yet
defined, that means that MathJax is still typesetting the page, and gets
those elements.  Generally the call is only needed for cases where those
things are added to the page later.
…event.

This is certainly better than a timeout, and I don't know how I missed
that event. To be honest I didn't know it existed and have missed it in
the documentation for years. Thanks @dpvc for pointing this out.
I am seeing several instances where the function is not defined.  So
protect against calling it if it isn't.  Presumably the cases where it
is not defined will still be caught by the initial typeset.
…int bodies.

If the problem text or the content of a solution or hint is too wide,
then it overflows the problem boundaries.  This is a problem when the
page is in dark mode, because the problem is not and so the text is
dark, yet the main page background is also dark.  This results in black
text on a black background for the text that overflows the
`.problem-content` div.

Adding `overflow-x: auto` makes the content scroll horizontally as
needed if the text is too wide, and so the text is still contained
within the light background of the problem.

Note that adding the overflow to solutions and hints is perhaps not
needed since the `.problem-content` div has it.  The text overflows the
solution or hint if it is too wide, but the problem content is
scrollable, and so it is contained within the light background.
However, it is still ugly when the content overflows the solution or
hint, and it is better if it scrolls on its own.
The POD is rather heftily rewritten, and there were a lot of issues in
the code that were fixed.  I don't even remember all of them, since I
did this several months ago.

One issue was with the `set_plot_option_aliases` method.  It defined the
aliases with a hash with duplicate keys.  That means only the last one
of the duplicates actually worked. So the definition needed to be
inverted to function right.

Another option was with incorrectly names svg colors.

Also, switch to using the new plots `padding` option instead of using a
multiplier. The `padding` options scales better.

Don't blindly add the `fill => 'self'` option to everything.  Just add
it to things that can be possible filled. In fact, since the
`add_rectangle` method handles this, the `StatisticalPlots.pl` macro
does not need to.

Also, there was quite a bit of general code clean up.
Clean up and fix issues in the `StatisticalPlots.pl` macro.
Add horizontal overflow to `.problem-content` divs and solution and hint bodies.
Rework the `MathJax.typesetPromise` usage.
subMatrix method for Matrix Math Objects
A side effect of #1397 is that output (stdout and stderr) from system
calls is no longer suppressed. This was previously accomplished by
piping the output to `/dev/null`.  However, since those system commands
are no longer executed in a spawned shell, that cannot be done.

This suppresses the output generated by the execution of `dvisvgm` in
`LaTeXImage.pm` by adding the flat `--verbosity=0`.  This is specific to
this call, and errors or output from other system calls will still come
through, but this one is particularly annoying since it occurs when the
unit tests are run, and messes up the results output for the unit tests.
In the `removeRow` and `removeColumn` methods of `lib/Value/Matrix.pm`
check that the index is numeric before using it in a numeric comparison.

This causes warnings when the unit tests are run because the string
comparison is done last, and so the numeric comparisons are performed
with the string input.
Suppress output from `dvisvgm` in `LaTeXImage.pm`.
Check for a numeric value before using numerically.
Developers will need to install and use this version to match the
workflow.

Also update Github workflows to use node 24, and the actions in the
workflows to their newest versions. For now these are still running on
Ubuntu 24.04, since an official runner image for Ubuntu 26.04 has not
been released yet.  Also because there is a runner image, but some of
the rserve unit tests are failing with it.  Note that the rserve tests
are passing on my locak machine running Ubuntu 26.

The docker test build is updated to use Ubuntu 26.04.  The rserve tests
also are passing with this build.
allow empty containers in PGML
fully close most HTML tags in niceTables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants