Skip to content

Commit 478723b

Browse files
Guide: note about ActiveCode/Codelens QR codes
1 parent 1443cf4 commit 478723b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

doc/guide/author/topics.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3538,7 +3538,7 @@ displayed line, and there are no <c>\\</c>s. Use <c>\amp</c> to mark the alignm
35383538
<subsection xml:id="interactive-program-codelens">
35393539
<title>Interactive Programs, CodeLens</title>
35403540

3541-
<p><term>CodeLens</term> is an interactive version of a computer program, which can be visualized by stepping through the code one statement at a time, watching output, variables, and other data structures change. So it is similar to a debugger, except the reader does not set breakpoints or modify program data on-the-fly. This is possible automatically for several different languages when your <init>HTML</init> is hosted on a Runestone server (<xref ref="runestone"/>). This may also be accomplished <q>in browser</q> when hosted on any old generic web server. The catch is that for a generic server a publisher must generate <term>trace data</term> in advance, typically with the PreTeXt-CLI (<xref ref="processing-CLI"/>). Place the <tag>interactive</tag> attribute on a <tag>program</tag> element with the value <c>codelens</c> to elect this behavior (<c>no</c> is the default value). Also, be sure to specify a language from the supported languages: Python, Java, C, and C++. Consult <xref ref="table-program-interactive"/> below for a summary of various combinations. When an output format does not support an interactive CodeLens instance, the fallback is a static program listing. The <tag>program</tag> should have an <attr>xml:id</attr> that will be used as a unique identifier for the generated trace file needed by the codelens.</p>
3541+
<p><term>CodeLens</term> is an interactive version of a computer program, which can be visualized by stepping through the code one statement at a time, watching output, variables, and other data structures change. So it is similar to a debugger, except the reader does not set breakpoints or modify program data on-the-fly. This is possible automatically for several different languages when your <init>HTML</init> is hosted on a Runestone server (<xref ref="runestone"/>). This may also be accomplished <q>in browser</q> when hosted on any old generic web server. The catch is that for a generic server a publisher must generate <term>trace data</term> in advance, typically with the PreTeXt-CLI (<xref ref="processing-CLI"/>). Place the <tag>interactive</tag> attribute on a <tag>program</tag> element with the value <c>codelens</c> to elect this behavior (<c>no</c> is the default value). Also, be sure to specify a language from the supported languages: Python, Java, C, and C++. Consult <xref ref="table-program-interactive"/> below for a summary of various combinations. When an output format does not support an interactive CodeLens instance, the fallback is a static program listing, possibly with a link to the interactive version (see <xref ref="interactive-program-activecode"/> for how to configure the links). The <tag>program</tag> should have an <attr>xml:id</attr> that will be used as a unique identifier for the generated trace file needed by the codelens.</p>
35423542

35433543
<p>Sometimes, there is uninteresting setup to get through before the portion of the program the author wants to illustrate. The author can use <attr>starting-step</attr> to specify the instruction number that the interactive should start at. Code before that will be fast-forwarded through and execution will begin at the indicted step. Note that <attr>starting-step</attr> is a <q>Step</q> number in the execution sequence, not a line number in the source code. You may have to run the Codelens once to find the right step to start at.</p>
35443544

@@ -3554,7 +3554,9 @@ displayed line, and there are no <c>\\</c>s. Use <c>\amp</c> to mark the alignm
35543554

35553555
<p><term>ActiveCode</term> is an interactive environment where a reader may work on code through repeated edit-compile-test cycles. Code can be provided by an author as a complete program to be modified, a partial program to be completed, or nothing at all. One good example is that maybe header files, import statement, and similar are provided, and a skeleton of a main entry-point procedure is also provided. Then a reader can concentrate on the more conceptual parts of the programming. Some languages will be executable <q>in browser</q> on any old generic web server, while others must be on a Runestone server (<xref ref="runestone"/>) where a <url href="https://github.com/trampgeek/jobe" visual="github.com/trampgeek/jobe">Jobe Server</url> is running to support the execution.</p>
35563556

3557-
<p>Place the <attr>interactive</attr> attribute on a <tag>program</tag> element with the value <c>activecode</c> to elect this behavior (<c>no</c> is the default value). Also, be sure to specify a language from the supported languages. Consult <xref ref="table-program-interactive"/> below for a summary of various combinations. When an output format does not support an interactive ActiveCode instance, the fallback is a static program listing.</p>
3557+
<p>Place the <attr>interactive</attr> attribute on a <tag>program</tag> element with the value <c>activecode</c> to elect this behavior (<c>no</c> is the default value). Also, be sure to specify a language from the supported languages. Consult <xref ref="table-program-interactive"/> below for a summary of various combinations.</p>
3558+
3559+
<p>When an output format does not support an interactive ActiveCode instance, the fallback is a static program listing. The static listing is possibly supplemented with a link and QR code to access an HTML version. To get these links, you must specify a base <init>URL</init> (see <xref ref="online-baseurl"/>). If you have a base <init>URL</init> and want to disable the QR codes, you can set the <attr>static-qrcodes</attr> attribute to no <c>"no"</c> in the publisher variable <c>common/program</c>.</p>
35583560

35593561
<warning>
35603562
<title>Labels and XML IDs</title>

0 commit comments

Comments
 (0)