PreTeXtBook / pretext

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

Some components missing from the runestone-manifest.xml #1843

Closed bnmnetp closed 2 years ago

bnmnetp commented 2 years ago

Take a look at this page: https://runestone.academy/ns/books/published/httlacs/general-intro_executing-python-in-this-book.html

The progress bar at the bottom indicates that there are three things to complete with a count of 1 for opening the page.

However, there is:

  1. A video
  2. An activecode
  3. A codelens checkpoint 1.4.1
  4. multiple choice checkpoint 1.4.2
  5. second multiple checkpoint 1.4.3

Only 4 and 5 are in the Runestone manifest. But all of them need to be in order for the reading assignments to work properly.

rbeezer commented 2 years ago

Looks like video[@youtube], program[@interactive = 'activecode'], and program[@interactive = 'codelens'] are all being missed, should be easy to add.

Looks to me like Exercise 1.4.1 is missing a statement in its source. If so, that is why it is not being recognized.

Not trying to be pedantic: if a video is inside an exercise or activity should it still go in the manifest? As in, "watch this video and answer these three questions (task)".

bnmnetp commented 2 years ago

The reason all of these things need to be in the manifest is that when we serve a page we make a query and ask what interactive components are on this page. The only way we know that for a PreTeXt book is from the manifest. The green progress bar at the bottom tracks how many of the things a student has touched. For our formative reading assignments we don't care about the correctness only that the student has touched it.

I'm not sure what I would put in the statement for the codelens... can it be empty? That one in particular has

<exercise runestone="firstexample"> 

in the source !! oops.

However, The page full of of codelens in the sample book only shows one activity for the whole page. Those are just listings with @interactive="codelens" So I think your solution mentioned above is correct.

Definitely the video should go in the manifest in the case you mention. We need to talk about how to deal with tasks in the manifest.

rbeezer commented 2 years ago

The reason all of these things need to be in the manifest...

I undestand all that. But if a video is part of an exercise, do we presume the video was watched to do teh exercise, or two we have two things in the manifest? The exercise and its contained video?

I'm not sure what I would put in the statement for the codelens

There are any amount of instructions below, but not contained within the exercise. None of that will be in the manifest, and a student who sees the Checkpoint from the assignment page will not know what to do?

can it be empty?

That will feed the code and it will go to the manifest. Definitely not good practice, and I can't say what will break elsewhere (spacing in LaTeX?).

OK, you edited while I was replying. :-( Some of this is now moot. ;-)

rbeezer commented 2 years ago

OK, how should a video be structured in the manifest? Right now, we just have "questions". Best guess, which is not meant to suggest correctness. Note that videos are not guaranteed to have numbers, and we don't even have a "name" for a video (which means it is not internationalized). We never say "Video 5.6" just like we would never say "JPEG 3.2". Could discuss Friday afternoon, though I'm into it now. Same question for ActiveCode and CodeLens.

      <question>
        <label>[video] [STRUCT].[NUM] </label>
        <htmlsrc>
          <div id="PTXSB_2_youtube-list-vars-ten" data-component="youtube" class="align-left youtube-video" data-video-height="" data-video-width="" data-video-videoid="X1-UNHUajfk" data-video-divid="PTXSB_2_youtube-list-vars-ten" data-video-start="0" data-video-end="-1"/>
...
bnmnetp commented 2 years ago

I think the short answer is that all of the html that you transform the PreTeXt into should go into the htmlsrc tag.

I can get you specific examples of what I have now.

bnmnetp commented 2 years ago

Here is what I have for youtube videos today

    <div class="runestone " style="margin-left: auto; margin-right:auto">                       
        <div id="mutabilityvid" data-component="youtube" class="align-left youtube-video"       
            data-video-height="315" data-question_label="9.2.1"                                 
            data-video-width="560" data-video-videoid="fnSijYDKz3c"                             
            data-video-divid="mutabilityvid" data-video-start="0"                               
            data-video-end="-1" ></div>                                                         
    </div>
bnmnetp commented 2 years ago

Here is what I have for codelens

<div class="runestone codelens ">                                                                                                              >
    <div class="cd_section" data-component="codelens" data-question_label="5.9.4">                                                             >
        <div id=functParam_codelens3_question class="ac_question">                                                                             >
        </div>                                                                                                                                 >
        <div class="pytutorVisualizer" id="functParam_codelens3"                                                                               >
           data-params='{"embeddedMode": true, "lang": "python", "jumpToEnd": false}'>                                                         >
        </div>                                                                                                                                 >
        <p class="runestone_caption"><span class="runestone_caption_text">Activity: CodeLens 5.9.4 (functParam_codelens3)</span> </p>          >
    </div>                                                                                                                                     >
                                                                                                                                               >
<script>                                                                                                                                       >
var functParam_codelens3_vis;                                                                                                                  >
                                                                                                                                               >
if (allTraceData === undefined) {                                                                                                              >
   var allTraceData = {};                                                                                                                      >
}                                                                                                                                              >
                                                                                                                                               >
allTraceData["functParam_codelens3"] = {"code": "def print_twice(bruce):\n    print(bruce)\n    print(bruce)\n\nmichael = 'Python is cool.'\npr>
</script>                                                                                                                                      >
</div>

But yours will be different because you put the trace data in a separate script.

bnmnetp commented 2 years ago

activecodes are no different from what you current write.

rbeezer commented 2 years ago

The HTML is easy to duplicate. It is the wrapping for the manifest that needs attention. For example these are not "question" (which is not a big deal).

What do I use for the "label" of a video? It does not have a title in PreTeXt, and shouldn't. Authors put it into a figure which can have a title and a caption. (We can look outward for those.) If a page has 10 videos, does an instructor need to be able to quickly identify one versus the other? 'Nobody watched "Loops", but everybody watched "Sorting"'?

bnmnetp commented 2 years ago

The label issue is important.

See APEX on runestone as we only have one video per page with many captions instead of many videos. That is because they are in figures but the videos do not have unique identifiers.

RS requires each video to have a unique id. That could be inherited from the figure but if its not in the figure then it should be an error on a runestone build to make the author add a unique label.

rbeezer commented 2 years ago

video should definitely require a label attribute to get an identifier agreeable to RS. I don't think it should come from a (possible) enclosing figure. Let's talk more tomorrow.

rbeezer commented 2 years ago

YouTube videos, inline ActiveCode, and inline CodeLens will now appear in the manifest. Test with existing CS Awesome course?

Labels have seen some heroics, but I'm still not happy with them. Internally conflicted about placement of title on atomic objects. So not ready to spout advice/requirements to authors. Let's discuss on Tuesday?

Main commit: c97c3081692150892d774a5d78ac4a75af59e689 Just prior is some translation work and a very small test case addition to the Sample Book comes later. I have not updated website version of that.

bnmnetp commented 2 years ago

One final twist to the plot:

        <listing xml:id="program-mistake-pascal">
            <caption>A Pascal program that cannot be interactive on Runestone</caption>
            <program xml:id="pascal-mistake" interactive='activecode' language="pascal">
                <input>
                program HelloWorld;
                begin
                  WriteLn('Hello, world!');
                end.
                </input>
            </program>
    </listing>

I think this only matters for this one example in this one book. Which I have now worked around in processing the manifest. I don't think it belongs in the manifest as the student would not be able to interact with it, yet it is there but with nothing to grab on to as a runestone component.

      <question>
        <label>ActiveCode: Listing 5.1.7 </label>
        <htmlsrc>
          <pre class="program">
            <code class="language-pascal">program HelloWorld;
begin
  WriteLn('Hello, world!');
end.
</code>
          </pre>
        </htmlsrc>
      </question>
rbeezer commented 2 years ago

listing, program, Pascal; should all be fine (it'll get syntax highlighting).

But it is a mistake to say "activecode" since there is no support for Pascal.

So before it gets to the manifest, I should should check for illegal/legal languages trying to be interactive (RS server or no). Still thinking about where in the pipeline that should happen...

bnmnetp commented 2 years ago

I would not make it a high priority... I think its nice as a test case, but is probably not going to come into play in any of our current books.

rbeezer commented 2 years ago

Well, I'm preventing it from being an ActiveCode where born (I think!), so there must be an effective chunk of code someplace. (Haven't peeked yet.)

rbeezer commented 2 years ago

Vastly improved manifest labels for these objects. Anything helpful an author provides will get used.

Main changes: 5960d2368b150da7975690a17f7f2056fabe79f2

A refactor (consolidation) before and two examples modified in the sample book later, so you can look at their labels after Saturday's rebuild.

I have some code already for the Pascal problem - may be an easy fix. Except I may not be so careful about CodeLens. ;-(