Skip to content

Commit

Permalink
Merge branch 'master' into wavedrom
Browse files Browse the repository at this point in the history
  • Loading branch information
bnmnetp authored Jul 22, 2021
2 parents d80d825 + 1a49e2d commit d5abb50
Show file tree
Hide file tree
Showing 26 changed files with 5,884 additions and 3,242 deletions.
4,410 changes: 1,170 additions & 3,240 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "dist/runestone.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"check-env": "node -e 'console.log(process.env)' | grep npm",
"build": "webpack --mode=development",
"buildj": "webpack --mode=development --profile --json > stats.json",
"watch": "webpack --mode=development --watch",
Expand Down Expand Up @@ -40,4 +41,4 @@
"vega-embed": "3.14.0",
"wavedrom": "^2.0.0"
}
}
}
3 changes: 3 additions & 0 deletions runestone/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from .animation import Animation
from .mchoice import MChoice, QuestionNumber
from .blockly import Blockly
from .quizly import Quizly
from .khanex import Khanex
from .codelens import Codelens
from .clickableArea import ClickableArea
from .datafile import DataFile
Expand Down Expand Up @@ -217,6 +219,7 @@ def build(options):
"dragndrop": DragNDrop,
"parsonsprob": ParsonsProblem,
"poll": Poll,
"quizly": Quizly,
"reveal": RevealDirective,
"selectquestion": SelectQuestion,
"shortanswer": JournalDirective,
Expand Down
77 changes: 77 additions & 0 deletions runestone/khanex/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
README.txt

The content files for the khanex component must be stored in the
course's _static folder. Download the following file and unzip it in _static:
https://github.com/ram8647/khanex/blob/16398fd496fad5b93fdf4d72c274064db8d1d1ac/khanex-runestone.zip

The khanex directive, in this first pass looks like this:
-----------------------------------------------

.. khanex::
:exercise: unique-exercise-name /qs folder

The quizly component uses and requires the following resources:
----------------------------------------------

runestone/khanex/khanex.py -- creates KhanexNode from directive
runestone/khanex/__init__.py -- imports the khanex code

runestone/khanex/js -- javascript resources


runestone/khanex/test -- some test code
-- _sources -- test files
-- conf.py -- sphinx config file for runestone
-- pavement.py -- needed for runestone build

The files that need to be coded by the developer
-----------------------------------------------

./runestone/khanex/khanex.py
----------------------------
Th script that runs during runestone build. Runestone build parses the
source document and translates the directive and its options into a QuizlyNode.

- QuizlyNode -- defines the node. The only option needed for this is the quizname,
which is parsed from the directive.

- visit_quizly_mode(self, node) -- appends the quizly template, instantiated, to the
body of the html document that will represent the quizly exercise

- Quizly(RunestoneDirective) -- its run() method instantiates and returns QuizlyNode,
probably called by runestone build.

./runestone/khanex/__init__.py -- called by runestone build, imports khanex.py
------------------------------

./runestone/khanex/js/khanex.js
-------------------------------

This script runs when the html page containing the khanex iframe is loaded. It contains
methods to render the khanex component and to handle the interface with runestone.

This script will be invoked automatically when the page is loaded, provided a khanex entry
is made in the module.exports list in webpack.config.js.

"./runestone/khanex/js/khanex.js",

khanex.js contains the following methods and functions:

-- class Khanex extends RunestoneBase -- constructs a Khanex object that holds the
data from the exercise. Calls renderQuiz() method.

-- getIFrame() -- extracts the iframe from the fully instantiated html code produced
by khanex.py and contained in KhanexNode.

-- renderKhanex() -- renders the khanex iframe inside a container <div>.

-- submitKhanex() -- the method invoked from the callback function when the user
clicks "Check Me" button in the khanex exercise.

$(document).bind( ,,, function() {}) -- function that sets up the callback function
and binds it to the html document.

setupCallback(khanex) -- defines the callback function that is invoked when the "Check Me"
button is clicked. It calls khanex.submitKhanex(result), where result is the
khanex-graded response to the user's attempt.

1 change: 1 addition & 0 deletions runestone/khanex/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .khanex import *
1 change: 1 addition & 0 deletions runestone/khanex/js/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Header set Access-Control-Allow-Origin "*"
Loading

0 comments on commit d5abb50

Please sign in to comment.