Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protect EV3P command output from variable substitution. #918

Merged
merged 1 commit into from
Oct 2, 2023

Conversation

drgrice1
Copy link
Member

@drgrice1 drgrice1 commented Aug 22, 2023

This an alternate to #917 (and #914) to fix issue #912. This uses the technique described by @dpvc in
#914 (comment) with a minor tweak to limit the scope of $__blank__.

Here is a MWE with all of the issues that have been brought up:

DOCUMENT();

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

$x = "one"; $xx = "two"; $xxx = "three";
$y = '$x';

BEGIN_TEXT
$DOLLAR\{ ans_rule(1) \}
$PAR
$x\{"x"\} and $x\{"x"\}x and \{$y\}x
END_TEXT

ANS(Real(1)->cmp);

ENDDOCUMENT();

With the develop branch the above example will work in html, but the output on the second line will be "two and three and two". With this pull request the output on the second line will be "onex and onexx and onex".

With the develop branch the above example will not work in hardcopy, but with this branch it will.

@drgrice1 drgrice1 force-pushed the EV3P-protect-command-output branch 2 times, most recently from e7b0aa8 to 55c1156 Compare August 22, 2023 23:06
This an alternate to openwebwork#917 (and openwebwork#914) to fix issue openwebwork#912.  This uses the
technique described by @dpvc in
openwebwork#914 (comment) with
a minor tweak to limit the scope of `$__blank__`.

Here is a MWE with all of the issues that have been brought up:
```perl
DOCUMENT();

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

$x = "one"; $xx = "two"; $xxx = "three";
$y = '$x';

BEGIN_TEXT
$DOLLAR\{ ans_rule(1) \}
$PAR
$x\{"x"\} and $x\{"x"\}x and \{$y\}x
END_TEXT

ANS(Real(1)->cmp);

ENDDOCUMENT();
```

With the develop branch the above example will work in html, but the
output on the second line will be "two and three and two".  With this
pull request the output on the  second line will be
"onex and onexx and onex".

With the develop branch the above example will not work in hardcopy, but
with this branch it will.
@drgrice1 drgrice1 force-pushed the EV3P-protect-command-output branch from 73e7db8 to 54dc0ee Compare October 1, 2023 19:02
Copy link
Member

@drdrew42 drdrew42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested 👍

@drdrew42 drdrew42 merged commit c8344f9 into openwebwork:develop Oct 2, 2023
2 checks passed
@drgrice1 drgrice1 deleted the EV3P-protect-command-output branch October 2, 2023 21:27
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.

3 participants