WeBWorK Problems

knowlLink and Scaffold

knowlLink and Scaffold

by Benjamin Walter -
Number of replies: 3
I would like to insert knowlLinks into problems giving extra information during the flow of the problem.

Usually the knowlLink value will appear at the next $PAR, however this is not the case inside of a scaffold (using scaffold.pl). Inside of a Scaffold, the link pops up at Section::End() instead!

I've tried forcing some kind of wrapper around the knowlLink, but I can't manage to get this to work. Any help is appreciated.


Benjamin Walter


A bit more detail:

I'd like to do something like the following:

Scaffold::Begin();
Section::Begin("Important Section");
BEGIN_TEXT

Basic intro
$BR
\{ knowlLink("For Example",value=>"Interesting Example"); \}
$PAR
Long text of problem
....

END_TEXT
Section::END();

and have the interesting example appear where the knowlLink is rather than at the end of the entire section.

In reply to Benjamin Walter

Re: knowlLink and Scaffold

by Glenn Rice -
I am not seeing what you are seeing. I tested this using the following minimal example:

DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"scaffold.pl",
);

Scaffold::Begin();

Section::Begin("Important Section");
BEGIN_TEXT
Basic intro
$BR
\{ knowlLink("For Example", value => "Interesting Example"); \}
$PAR
Long text of problem
END_TEXT
Section::End();

Section::Begin("Important Section 2");
BEGIN_TEXT
Basic intro 2
$BR
\{ knowlLink("For Example", value => "Interesting Example 2"); \}
$PAR
Long text of problem 2
END_TEXT
Section::End();

Scaffold::End();

ENDDOCUMENT();

In this problem I see the knowls appear in the problem in the place that they are in the code. Perhaps there is something else going on in your problem code. Can you post more details. Perhaps post a minimal example where you see the problem occur.
In reply to Benjamin Walter

Re: knowlLink and Scaffold

by Davide Cervone -
Your example works for me (after changing Section::END() to Section::End() and adding Scaffold::End()). The knowl opens between the link and the "long text of problem" for me.

My recollection is that the knowl will open after the <p> tag containing the link. Because PG has only a paragraph initiator ($PAR) not paragraph begin/end, it is not always easy to control the location of the paragraph tags in the output. You might try adding a $PAR command before the "Basic intro 2" text, just to be sure there is a <p> surrounding the knowl.
In reply to Davide Cervone

Re: knowlLink and Scaffold

by Benjamin Walter -
Hmm.. this works... I think it may be because I didn't both precede and follow the knowlLink with a $PAR... I actually am a bit mystified. But happy.