RunestoneComponents
RunestoneComponents copied to clipboard
Updating codelens components to support Java and C++ in textbook.
I am currently working on trying to update the codelens component so that Java and C++ code in the books have a "Show CodeLens" button and someone is able to traverse through the code line by line.
I have narrowed it down to the button being created with the conditional found on line 261 in activecode.js
:
if ($(this.origElem).data("codelens") && ! this.graderactive) {
butt = document.createElement("button");
$(butt).addClass("ac_opt btn btn-default");
$(butt).text($.i18n("msg_activecode_show_codelens"));
$(butt).css("margin-left", "10px");
this.clButton = butt;
ctrlDiv.appendChild(butt);
$(butt).click(this.showCodelens.bind(this));
}
and deciding whether the code should have (this.origElem).data("codelens")
with the conditional on line 303 in activecode.py
:
if "nocodelens" in self.options or self.options["language"] != "python":
self.options["codelens"] = ""
else:
self.options["codelens"] = 'data-codelens="true"'
I am not quite sure how these two work together to decide whether the activecode gets a "Show CodeLens" button or not.
I have attached a snippet of code that we changed so that it takes C++ and Java, but still no dice. Also attached, the error code that we get.
In my activecode.py around line 198 I have:
"language": directives.unchanged,
It looks to me like you may have changed that to directives.flag? Unchanged does not put any restrictions on what the argument to the option can be. But directives.flag does not allow arguments which is what the error message is saying.