diff --git a/doc/guide/author/topics.xml b/doc/guide/author/topics.xml index 3787568243..15ba56ae84 100644 --- a/doc/guide/author/topics.xml +++ b/doc/guide/author/topics.xml @@ -3538,7 +3538,7 @@ displayed line, and there are no \\s. Use \amp to mark the alignm Interactive Programs, CodeLens -

CodeLens 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 HTML is hosted on a Runestone server (). This may also be accomplished in browser when hosted on any old generic web server. The catch is that for a generic server a publisher must generate trace data in advance, typically with the PreTeXt-CLI (). Place the interactive attribute on a program element with the value codelens to elect this behavior (no is the default value). Also, be sure to specify a language from the supported languages: Python, Java, C, and C++. Consult 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 program should have an xml:id that will be used as a unique identifier for the generated trace file needed by the codelens.

+

CodeLens 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 HTML is hosted on a Runestone server (). This may also be accomplished in browser when hosted on any old generic web server. The catch is that for a generic server a publisher must generate trace data in advance, typically with the PreTeXt-CLI (). Place the interactive attribute on a program element with the value codelens to elect this behavior (no is the default value). Also, be sure to specify a language from the supported languages: Python, Java, C, and C++. Consult 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 for how to configure the links). The program should have an xml:id that will be used as a unique identifier for the generated trace file needed by the codelens.

Sometimes, there is uninteresting setup to get through before the portion of the program the author wants to illustrate. The author can use starting-step 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 starting-step is a Step 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.

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

ActiveCode 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 in browser on any old generic web server, while others must be on a Runestone server () where a Jobe Server is running to support the execution.

-

Place the interactive attribute on a program element with the value activecode to elect this behavior (no is the default value). Also, be sure to specify a language from the supported languages. Consult 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.

+

Place the interactive attribute on a program element with the value activecode to elect this behavior (no is the default value). Also, be sure to specify a language from the supported languages. Consult 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. 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 URL (see ). If you have a base URL and want to disable the QR codes, you can set the static-qrcodes attribute to no "no" in the publisher variable common/program.

Labels and XML IDs diff --git a/pretext/lib/pretext.py b/pretext/lib/pretext.py index fdb774327a..6b2df71cfb 100644 --- a/pretext/lib/pretext.py +++ b/pretext/lib/pretext.py @@ -2644,7 +2644,7 @@ def qrcode(xml_source, pub_file, stringparams, xmlid_root, dest_dir): # Simple version: qr_image = qrcode.make(url), has border if has_image: # error correction up to 25% - error_correction = qrcode.constants.ERROR_CORRECT_Q + error_correction = qrcode.constants.ERROR_CORRECT_H else: # error correction up to 7% error_correction = qrcode.constants.ERROR_CORRECT_L diff --git a/xsl/entities.ent b/xsl/entities.ent index a22791eb0e..cb4b8e6ef9 100644 --- a/xsl/entities.ent +++ b/xsl/entities.ent @@ -145,3 +145,6 @@ + + + diff --git a/xsl/extract-qrcode.xsl b/xsl/extract-qrcode.xsl index b5aef2a47c..1a41d4aca0 100644 --- a/xsl/extract-qrcode.xsl +++ b/xsl/extract-qrcode.xsl @@ -19,6 +19,11 @@ You should have received a copy of the GNU General Public License along with MathBook XML. If not, see . *********************************************************************--> + + %entities; +]> + @@ -36,6 +41,9 @@ along with MathBook XML. If not, see . + + + @@ -46,18 +54,70 @@ along with MathBook XML. If not, see . - + - - + + + + + + + + + PTX:INFO: Writing qrcode-urls.txt + + + + PTX:ERROR: Base URL must be specified to generate QR codes + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsl/localizations/af-ZA.xml b/xsl/localizations/af-ZA.xml index d89ab40f22..bfed1edefb 100644 --- a/xsl/localizations/af-ZA.xml +++ b/xsl/localizations/af-ZA.xml @@ -200,6 +200,7 @@ along with PreTeXt. If not, see . ActiveCode CodeLens + diff --git a/xsl/localizations/bg-BG.xml b/xsl/localizations/bg-BG.xml index cdbe7f2612..4953e61bd0 100644 --- a/xsl/localizations/bg-BG.xml +++ b/xsl/localizations/bg-BG.xml @@ -218,6 +218,7 @@ along with PreTeXt. If not, see . ActiveCode CodeLens + diff --git a/xsl/localizations/ca-ES.xml b/xsl/localizations/ca-ES.xml index 6fe97d19bb..82807ae2e0 100644 --- a/xsl/localizations/ca-ES.xml +++ b/xsl/localizations/ca-ES.xml @@ -204,6 +204,7 @@ along with PreTeXt. If not, see . ActiveCode CodeLens + diff --git a/xsl/localizations/cs-CZ.xml b/xsl/localizations/cs-CZ.xml index abd4342d85..b343d39f63 100644 --- a/xsl/localizations/cs-CZ.xml +++ b/xsl/localizations/cs-CZ.xml @@ -199,6 +199,7 @@ along with PreTeXt. If not, see . ActiveCode CodeLens + diff --git a/xsl/localizations/de-DE.xml b/xsl/localizations/de-DE.xml index b98c54696a..546205a998 100644 --- a/xsl/localizations/de-DE.xml +++ b/xsl/localizations/de-DE.xml @@ -204,6 +204,7 @@ along with PreTeXt. If not, see . ActiveCode CodeLens + diff --git a/xsl/localizations/en-US.xml b/xsl/localizations/en-US.xml index bcc8a4f3ec..3539c75e0c 100644 --- a/xsl/localizations/en-US.xml +++ b/xsl/localizations/en-US.xml @@ -236,6 +236,7 @@ along with PreTeXt. If not, see . ActiveCode CodeLens + Interactive program diff --git a/xsl/localizations/es-ES.xml b/xsl/localizations/es-ES.xml index 6c337bce24..2edb48d5f2 100644 --- a/xsl/localizations/es-ES.xml +++ b/xsl/localizations/es-ES.xml @@ -205,6 +205,7 @@ along with PreTeXt. If not, see . ActiveCode CodeLens + diff --git a/xsl/localizations/fi-FI.xml b/xsl/localizations/fi-FI.xml index 72378912fc..2814aeed37 100644 --- a/xsl/localizations/fi-FI.xml +++ b/xsl/localizations/fi-FI.xml @@ -210,6 +210,7 @@ along with PreTeXt. If not, see . ActiveCode CodeLens + diff --git a/xsl/localizations/fr-CA.xml b/xsl/localizations/fr-CA.xml index 8ef7883859..58d296e31f 100644 --- a/xsl/localizations/fr-CA.xml +++ b/xsl/localizations/fr-CA.xml @@ -197,6 +197,7 @@ along with PreTeXt. If not, see . ActiveCode CodeLens + diff --git a/xsl/localizations/fr-FR.xml b/xsl/localizations/fr-FR.xml index 790d07931d..599807a3ca 100644 --- a/xsl/localizations/fr-FR.xml +++ b/xsl/localizations/fr-FR.xml @@ -199,6 +199,7 @@ along with PreTeXt. If not, see . ActiveCode CodeLens + diff --git a/xsl/localizations/hu-HU.xml b/xsl/localizations/hu-HU.xml index 12cecd72b7..23e7c2b658 100644 --- a/xsl/localizations/hu-HU.xml +++ b/xsl/localizations/hu-HU.xml @@ -200,6 +200,7 @@ along with PreTeXt. If not, see . ActiveCode CodeLens + diff --git a/xsl/localizations/it-IT.xml b/xsl/localizations/it-IT.xml index 3f5db03d90..b9cbd79ccb 100644 --- a/xsl/localizations/it-IT.xml +++ b/xsl/localizations/it-IT.xml @@ -194,6 +194,7 @@ along with PreTeXt. If not, see . Programma ActiveCode CodeLens + diff --git a/xsl/localizations/ku-CKB.xml b/xsl/localizations/ku-CKB.xml index 6c4cb120ae..3589846ee6 100644 --- a/xsl/localizations/ku-CKB.xml +++ b/xsl/localizations/ku-CKB.xml @@ -221,6 +221,7 @@ along with PreTeXt. If not, see . کۆد-چالاکردن CodeLens + diff --git a/xsl/localizations/nl-NL.xml b/xsl/localizations/nl-NL.xml index cacd5aebbb..f19ea1ba19 100644 --- a/xsl/localizations/nl-NL.xml +++ b/xsl/localizations/nl-NL.xml @@ -233,8 +233,8 @@ along with PreTeXt. If not, see . + CodeLens --> + diff --git a/xsl/localizations/pt-BR.xml b/xsl/localizations/pt-BR.xml index 41583978d0..9f4492dc94 100644 --- a/xsl/localizations/pt-BR.xml +++ b/xsl/localizations/pt-BR.xml @@ -202,6 +202,7 @@ along with PreTeXt. If not, see . Programa ActiveCode CodeLens + diff --git a/xsl/localizations/pt-PT.xml b/xsl/localizations/pt-PT.xml index 8252e2a1d0..ff927601c2 100644 --- a/xsl/localizations/pt-PT.xml +++ b/xsl/localizations/pt-PT.xml @@ -209,6 +209,7 @@ along with PreTeXt. If not, see . ActiveCode CodeLens + diff --git a/xsl/localizations/zh-HANS.xml b/xsl/localizations/zh-HANS.xml index f8df076c9f..6e11479548 100644 --- a/xsl/localizations/zh-HANS.xml +++ b/xsl/localizations/zh-HANS.xml @@ -229,6 +229,7 @@ along with PreTeXt. If not, see . ActiveCode CodeLens + diff --git a/xsl/pretext-assembly.xsl b/xsl/pretext-assembly.xsl index 8f4341ce19..aad32624fc 100644 --- a/xsl/pretext-assembly.xsl +++ b/xsl/pretext-assembly.xsl @@ -1911,6 +1911,10 @@ along with PreTeXt. If not, see . + + + + @@ -3225,11 +3229,11 @@ along with PreTeXt. If not, see . - - - + + + @@ -3535,6 +3539,12 @@ along with PreTeXt. If not, see . + + + + + + @@ -3581,4 +3591,55 @@ along with PreTeXt. If not, see . + + + + + + + + + + + + + + + + + + + + + <xsl:element name="pi:localize"> + <xsl:attribute name="string-id">program-interactive-available</xsl:attribute> + </xsl:element> + + +

+ + + + +

+ + + qrcode/ + + .png + + +
+
+
+
+ + + + + + +
+
+ diff --git a/xsl/pretext-runestone-static.xsl b/xsl/pretext-runestone-static.xsl index f254b3eb7c..a92fc679f0 100644 --- a/xsl/pretext-runestone-static.xsl +++ b/xsl/pretext-runestone-static.xsl @@ -1339,7 +1339,8 @@ along with PreTeXt. If not, see . - + + diff --git a/xsl/publisher-variables.xsl b/xsl/publisher-variables.xsl index f53f402e8c..bdfe11851f 100644 --- a/xsl/publisher-variables.xsl +++ b/xsl/publisher-variables.xsl @@ -152,6 +152,12 @@ along with PreTeXt. If not, see .
+ + + + + + @@ -3209,6 +3215,9 @@ along with PreTeXt. If not, see . + + +