How to use the runestone.activecode.activecode.ActivcodeNode function in runestone

To help you get started, we’ve selected a few runestone examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RunestoneInteractive / RunestoneComponents / runestone / activecode / activecode.py View on Github external
app.add_autoversioned_javascript("jquery.highlight.js")
    app.add_autoversioned_javascript("bookfuncs.js")
    add_codemirror_css_and_js(
        app, "xml", "css", "python", "htmlmixed", "javascript", "sql"
    )
    add_i18n_js(app, {"en", "sr-Cyrl"}, "activecode-i18n")
    add_skulpt_js(app)
    app.add_autoversioned_javascript("activecode.js")
    app.add_autoversioned_javascript("clike.js")
    app.add_autoversioned_javascript("timed_activecode.js")
    app.add_autoversioned_javascript("sql-wasm.js")  # todo: only load if we need it
    app.add_javascript("https://cdn.jsdelivr.net/npm/handsontable@7.2.2/dist/handsontable.full.js")
    app.add_stylesheet("https://cdn.jsdelivr.net/npm/handsontable@7.2.2/dist/handsontable.full.min.css")


    app.add_node(ActivcodeNode, html=(visit_ac_node, depart_ac_node))

    app.connect("doctree-resolved", process_activcode_nodes)
    app.connect("env-purge-doc", purge_activecodes)
github RunestoneInteractive / RunestoneComponents / runestone / activecode / activecode.py View on Github external
def run(self):
        env = self.state.document.settings.env
        # keep track of how many activecodes we have.... could be used to automatically make a unique id for them.
        if not hasattr(env, 'activecodecounter'):
            env.activecodecounter = 0
        env.activecodecounter += 1

        self.options['divid'] = self.arguments[0]

        source = "\n".join(self.content)
        self.options['initialcode'] = source

        return [ActivcodeNode(self.options)]
github RunestoneInteractive / RunestoneComponents / runestone / activecode / activecode.py View on Github external
def setup(app):
    app.add_directive('activecode', ActiveCode)
    app.add_stylesheet('activecode.css')

    app.add_javascript('skulpt.min.js')
    app.add_javascript('skulpt-stdlib.js')
    app.add_javascript('codemirror.js')
    app.add_javascript('python.js')
    app.add_javascript('activecode.js')

    app.add_role('textfield', textfield_role)

    app.add_node(ActivcodeNode, html=(visit_ac_node, depart_ac_node))

    app.connect('doctree-resolved', process_activcode_nodes)
    app.connect('env-purge-doc', purge_activecodes)
github RunestoneInteractive / RunestoneComponents / runestone / activecode / activecode.py View on Github external
def __init__(self, content):
        """
        Arguments:
        - `self`:
        - `content`:
        """
        super(ActivcodeNode, self).__init__()
        self.ac_options = content
github RunestoneInteractive / RunestoneComponents / runestone / activecode / activecode.py View on Github external
def __init__(self, content, **kwargs):
        """

        Arguments:
        - `self`:
        - `content`:
        """
        super(ActivcodeNode, self).__init__(name=content["name"], **kwargs)
        self.ac_components = content
github RunestoneInteractive / RunestoneComponents / runestone / activecode / activecode.py View on Github external
if (
                not hasattr(env, "dberr_activecode_reported")
                or not env.dberr_activecode_reported
            ):
                env.dberr_activecode_reported = True
                print(
                    "Unable to save to source_code table in activecode.py. Possible problems:"
                )
                print("  1. dburl or course_id are not set in conf.py for your book")
                print("  2. unable to connect to the database using dburl")
                print("")
                print(
                    "This should only affect the grading interface. Everything else should be fine."
                )

        acnode = ActivcodeNode(self.options, rawsource=self.block_text)
        acnode.source, acnode.line = self.state_machine.get_source_and_line(self.lineno)
        self.add_name(acnode)  # make this divid available as a target for :ref:

        if explain_text:
            self.state.nested_parse(explain_text, self.content_offset, acnode)

        return [acnode]