@pretextbook/pretext-html 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -10
- package/assets/preview-html.xsl +8 -4
- package/assets/preview-revealjs.xsl +85 -0
- package/assets/upstream.json +1 -1
- package/assets/xsl/LICENSE-pretext +16 -0
- package/assets/xsl/README.md +25 -24
- package/assets/xsl/entities.ent +27 -0
- package/assets/xsl/extract-biblio-csl.xsl +6 -4
- package/assets/xsl/extract-dynamic.xsl +14 -12
- package/assets/xsl/extract-interactive.xsl +2 -2
- package/assets/xsl/extract-pg.xsl +123 -306
- package/assets/xsl/extract-qrcode.xsl +12 -2
- package/assets/xsl/extract-sageplot.xsl +1 -1
- package/assets/xsl/extract-trace.xsl +3 -3
- package/assets/xsl/extract-youtube.xsl +1 -1
- package/assets/xsl/latex/pretext-latex-texstyle.xsl +4 -5
- package/assets/xsl/localizations/README.md +24 -24
- package/assets/xsl/pretext-assembly.xsl +463 -368
- package/assets/xsl/pretext-beamer.xsl +43 -146
- package/assets/xsl/pretext-braille-preprint.xsl +458 -202
- package/assets/xsl/pretext-common.xsl +486 -510
- package/assets/xsl/pretext-epub.xsl +318 -78
- package/assets/xsl/pretext-fo.xsl +80 -96
- package/assets/xsl/pretext-html.xsl +413 -318
- package/assets/xsl/pretext-jupyter.xsl +534 -322
- package/assets/xsl/pretext-latex-classic.xsl +14 -15
- package/assets/xsl/pretext-latex-common.xsl +393 -2397
- package/assets/xsl/pretext-latex.xsl +1995 -5
- package/assets/xsl/pretext-markdown.xsl +919 -0
- package/assets/xsl/pretext-numbers.xsl +57 -39
- package/assets/xsl/pretext-revealjs.xsl +241 -33
- package/assets/xsl/pretext-runestone-fitb.xsl +34 -35
- package/assets/xsl/pretext-runestone-static.xsl +17 -17
- package/assets/xsl/pretext-runestone.xsl +36 -34
- package/assets/xsl/pretext-sage-doctest.xsl +2 -2
- package/assets/xsl/pretext-text-utilities.xsl +69 -1
- package/assets/xsl/pretext-text.xsl +1077 -107
- package/assets/xsl/pretext-view-source.xsl +5 -3
- package/assets/xsl/pretext-ww-problem-sets.xsl +6 -1
- package/assets/xsl/publisher-variables.xsl +397 -477
- package/assets/xsl/support/play-button/README.md +1 -3
- package/assets/xsl/tests/README.md +1 -1
- package/assets/xsl/utilities/README.md +6 -8
- package/assets/xsl/utilities/report-publisher-variables.xsl +15 -0
- package/assets/xsl-bundle.json +1 -1
- package/dist/cli-DZsyZERX.js +694 -0
- package/dist/cli.js +1 -1
- package/dist/index.browser.d.ts +5 -0
- package/dist/index.browser.js +499 -344
- package/dist/index.d.ts +5 -0
- package/dist/index.js +23 -18
- package/dist/publication.d.ts +26 -12
- package/dist/renderer.d.ts +68 -0
- package/dist/reveal.d.ts +77 -0
- package/dist/reveal.js +110 -0
- package/dist/target.d.ts +34 -0
- package/package.json +12 -1
- package/dist/cli-CzoinNle.js +0 -639
|
@@ -112,89 +112,89 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
112
112
|
<!-- content, which may generally just produce a lot of text. -->
|
|
113
113
|
<!-- Which is no good, say as an attribute value. -->
|
|
114
114
|
|
|
115
|
-
<!-- This stylesheet runs as a chain of full-tree passes. Each
|
|
116
|
-
<!-- pass is a modal traversal that copies the previous tree and
|
|
117
|
-
<!-- alters only the elements it cares about, yielding a new
|
|
118
|
-
<!-- tree. The new tree is built as a result tree fragment and
|
|
119
|
-
<!-- immediately turned into a real node-set with
|
|
120
|
-
<!-- exsl:node-set(), so the next pass can walk it. The chain is
|
|
121
|
-
<!-- wired in "The Assembly Pipeline" section as a sequence of
|
|
122
|
-
<!-- variables ($version, $assembly, ...); that sequence, not the
|
|
123
|
-
<!-- order of templates in this file, is the authoritative pass
|
|
124
|
-
<!-- order.
|
|
125
|
-
<!--
|
|
126
|
-
<!-- Most passes are the identity for almost every node. The
|
|
127
|
-
<!-- low-priority identity templates that make each pass a
|
|
128
|
-
<!-- faithful copy by default are collected in "Source Assembly
|
|
129
|
-
<!-- Infrastructure"; the section for a pass then overrides them
|
|
130
|
-
<!-- (one section per pass, below, in execution order) for just
|
|
131
|
-
<!-- the handful of elements that pass transforms.
|
|
132
|
-
<!--
|
|
133
|
-
<!-- The passes, in the order they run (the identifier in
|
|
134
|
-
<!-- parentheses is the node-set each one produces):
|
|
135
|
-
<!--
|
|
136
|
-
<!-- 1. private-solutions ($private-solutions)
|
|
137
|
-
<!-- Splice in an external file of instructor solutions.
|
|
138
|
-
<!-- Identity, and skipped, when no such file is named.
|
|
139
|
-
<!-- 2. version ($version)
|
|
140
|
-
<!-- Resolve "version" and "custom" elements, *removing*
|
|
141
|
-
<!-- excluded content. Result should be valid PreTeXt.
|
|
142
|
-
<!-- 3. id-attribute ($original-labeled) @original-id
|
|
143
|
-
<!-- First of three identification stamps (see below).
|
|
144
|
-
<!-- 4. assembly ($assembly)
|
|
145
|
-
<!-- *Add* computed content: the assembled bibliography,
|
|
146
|
-
<!-- copied WeBWorK problems, matching/card-sort pieces.
|
|
147
|
-
<!-- 5. exercise ($exercise)
|
|
148
|
-
<!-- Tag each exercise with its kind (inline, divisional,
|
|
149
|
-
<!-- worksheet, ...) for later decisions.
|
|
150
|
-
<!-- 6. id-attribute ($assembly-label) @assembly-id
|
|
151
|
-
<!-- Second stamp: the early id passes coordinate on.
|
|
152
|
-
<!-- 7. dynamic-substitution ($dynamic)
|
|
153
|
-
<!-- Splice computed answers into fill-in-the-blank and
|
|
154
|
-
<!-- kindred dynamic exercises. Skipped when none exist.
|
|
155
|
-
<!-- 8. representations ($representations)
|
|
156
|
-
<!-- Render interactive exercises as static or dynamic
|
|
157
|
-
<!-- equivalents, per $exercise-style.
|
|
158
|
-
<!-- 9. repair ($repair)
|
|
159
|
-
<!-- *Change* source: fix deprecated constructions and
|
|
160
|
-
<!-- apply conveniences, for a canonical tree.
|
|
161
|
-
<!-- 10. enrichment ($enrichment)
|
|
162
|
-
<!-- *Add* generated material, e.g. a GeoGebra preview
|
|
163
|
-
<!-- or visual text for a bare url.
|
|
164
|
-
<!-- 11. labels ($labels)
|
|
165
|
-
<!-- Promote an authored @xml:id to @label and record
|
|
166
|
-
<!-- localization support. See "Labels".
|
|
167
|
-
<!-- 12. id-attribute ($identification) @unique-id
|
|
168
|
-
<!-- Third stamp: the final id conversions consume.
|
|
169
|
-
<!-- 13. augment ($augment)
|
|
170
|
-
<!-- Annotate divisions with @level (and ordered lists
|
|
171
|
-
<!-- with @ordered-list-level), as numbering needs.
|
|
172
|
-
<!-- 14. serial-stamp ($serial-stamp)
|
|
173
|
-
<!-- Stamp @serial on every numbered item. See
|
|
174
|
-
<!-- "Numbering".
|
|
175
|
-
<!--
|
|
176
|
-
<!-- After the chain, $root, $docinfo, $document-root and
|
|
177
|
-
<!-- $bibinfo are derived from the final tree for the conversion
|
|
178
|
-
<!-- stylesheets that import this one.
|
|
179
|
-
<!--
|
|
180
|
-
<!-- Three identifiers, one mechanism. The id-attribute pass
|
|
181
|
-
<!-- runs three times (passes 3, 6, 12), each stamping one
|
|
182
|
-
<!-- attribute by a deterministic depth-first walk: @original-id
|
|
183
|
-
<!-- (authored structure), @assembly-id (early, so passes can
|
|
184
|
-
<!-- coordinate before filenames exist) and @unique-id (the final
|
|
185
|
-
<!-- identifier). The three agree element-for-element only
|
|
186
|
-
<!-- because no intervening pass reorders siblings; that
|
|
187
|
-
<!-- invariant is stated in full at "Structural Contract for
|
|
188
|
-
<!-- Identification Passes" and checked, when assembly.debug is
|
|
189
|
-
<!-- set, by the id-coherence-check.
|
|
190
|
-
<!--
|
|
191
|
-
<!-- Two-pass extraction and substitution. A few constructs
|
|
192
|
-
<!-- (fill-in-the-blank answers, WeBWorK, MOM, ...) need an
|
|
193
|
-
<!-- external round trip: this stylesheet first emits a tree that
|
|
194
|
-
<!-- drives the trip, then on a later run reads the results back.
|
|
195
|
-
<!-- The $b-extracting-* switches that select that mode are
|
|
196
|
-
<!-- described at "Controlling Two-Pass Extraction and
|
|
197
|
-
<!-- Substitution".
|
|
115
|
+
<!-- This stylesheet runs as a chain of full-tree passes. Each -->
|
|
116
|
+
<!-- pass is a modal traversal that copies the previous tree and -->
|
|
117
|
+
<!-- alters only the elements it cares about, yielding a new -->
|
|
118
|
+
<!-- tree. The new tree is built as a result tree fragment and -->
|
|
119
|
+
<!-- immediately turned into a real node-set with -->
|
|
120
|
+
<!-- exsl:node-set(), so the next pass can walk it. The chain is -->
|
|
121
|
+
<!-- wired in "The Assembly Pipeline" section as a sequence of -->
|
|
122
|
+
<!-- variables ($version, $assembly, ...); that sequence, not the -->
|
|
123
|
+
<!-- order of templates in this file, is the authoritative pass -->
|
|
124
|
+
<!-- order. -->
|
|
125
|
+
<!-- -->
|
|
126
|
+
<!-- Most passes are the identity for almost every node. The -->
|
|
127
|
+
<!-- low-priority identity templates that make each pass a -->
|
|
128
|
+
<!-- faithful copy by default are collected in "Source Assembly -->
|
|
129
|
+
<!-- Infrastructure"; the section for a pass then overrides them -->
|
|
130
|
+
<!-- (one section per pass, below, in execution order) for just -->
|
|
131
|
+
<!-- the handful of elements that pass transforms. -->
|
|
132
|
+
<!-- -->
|
|
133
|
+
<!-- The passes, in the order they run (the identifier in -->
|
|
134
|
+
<!-- parentheses is the node-set each one produces): -->
|
|
135
|
+
<!-- -->
|
|
136
|
+
<!-- 1. private-solutions ($private-solutions) -->
|
|
137
|
+
<!-- Splice in an external file of instructor solutions. -->
|
|
138
|
+
<!-- Identity, and skipped, when no such file is named. -->
|
|
139
|
+
<!-- 2. version ($version) -->
|
|
140
|
+
<!-- Resolve "version" and "custom" elements, *removing* -->
|
|
141
|
+
<!-- excluded content. Result should be valid PreTeXt. -->
|
|
142
|
+
<!-- 3. id-attribute ($original-labeled) @pi:original-id -->
|
|
143
|
+
<!-- First of three identification stamps (see below). -->
|
|
144
|
+
<!-- 4. assembly ($assembly) -->
|
|
145
|
+
<!-- *Add* computed content: the assembled bibliography, -->
|
|
146
|
+
<!-- copied WeBWorK problems, matching/card-sort pieces. -->
|
|
147
|
+
<!-- 5. exercise ($exercise) -->
|
|
148
|
+
<!-- Tag each exercise with its kind (inline, divisional, -->
|
|
149
|
+
<!-- worksheet, ...) for later decisions. -->
|
|
150
|
+
<!-- 6. id-attribute ($assembly-label) @pi:assembly-id -->
|
|
151
|
+
<!-- Second stamp: the early id passes coordinate on. -->
|
|
152
|
+
<!-- 7. dynamic-substitution ($dynamic) -->
|
|
153
|
+
<!-- Splice computed answers into fill-in-the-blank and -->
|
|
154
|
+
<!-- kindred dynamic exercises. Skipped when none exist. -->
|
|
155
|
+
<!-- 8. representations ($representations) -->
|
|
156
|
+
<!-- Render interactive exercises as static or dynamic -->
|
|
157
|
+
<!-- equivalents, per $exercise-style. -->
|
|
158
|
+
<!-- 9. repair ($repair) -->
|
|
159
|
+
<!-- *Change* source: fix deprecated constructions and -->
|
|
160
|
+
<!-- apply conveniences, for a canonical tree. -->
|
|
161
|
+
<!-- 10. enrichment ($enrichment) -->
|
|
162
|
+
<!-- *Add* generated material, e.g. a GeoGebra preview -->
|
|
163
|
+
<!-- or visual text for a bare url. -->
|
|
164
|
+
<!-- 11. labels ($labels) -->
|
|
165
|
+
<!-- Promote an authored @xml:id to @label and record -->
|
|
166
|
+
<!-- localization support. See "Labels". -->
|
|
167
|
+
<!-- 12. id-attribute ($identification) @pi:unique-id -->
|
|
168
|
+
<!-- Third stamp: the final id conversions consume. -->
|
|
169
|
+
<!-- 13. augment ($augment) -->
|
|
170
|
+
<!-- Annotate divisions with @pi:level (and ordered lists -->
|
|
171
|
+
<!-- with @pi:ordered-list-level), as numbering needs. -->
|
|
172
|
+
<!-- 14. serial-stamp ($serial-stamp) -->
|
|
173
|
+
<!-- Stamp @pi:serial on every numbered item. See -->
|
|
174
|
+
<!-- "Numbering". -->
|
|
175
|
+
<!-- -->
|
|
176
|
+
<!-- After the chain, $root, $docinfo, $document-root and -->
|
|
177
|
+
<!-- $bibinfo are derived from the final tree for the conversion -->
|
|
178
|
+
<!-- stylesheets that import this one. -->
|
|
179
|
+
<!-- -->
|
|
180
|
+
<!-- Three identifiers, one mechanism. The id-attribute pass -->
|
|
181
|
+
<!-- runs three times (passes 3, 6, 12), each stamping one -->
|
|
182
|
+
<!-- attribute by a deterministic depth-first walk: @pi:original-id -->
|
|
183
|
+
<!-- (authored structure), @pi:assembly-id (early, so passes can -->
|
|
184
|
+
<!-- coordinate before filenames exist) and @pi:unique-id (the final -->
|
|
185
|
+
<!-- identifier). The three agree element-for-element only -->
|
|
186
|
+
<!-- because no intervening pass reorders siblings; that -->
|
|
187
|
+
<!-- invariant is stated in full at "Structural Contract for -->
|
|
188
|
+
<!-- Identification Passes" and checked, when assembly.debug is -->
|
|
189
|
+
<!-- set, by the id-coherence-check. -->
|
|
190
|
+
<!-- -->
|
|
191
|
+
<!-- Two-pass extraction and substitution. A few constructs -->
|
|
192
|
+
<!-- (fill-in-the-blank answers, WeBWorK, MOM, ...) need an -->
|
|
193
|
+
<!-- external round trip: this stylesheet first emits a tree that -->
|
|
194
|
+
<!-- drives the trip, then on a later run reads the results back. -->
|
|
195
|
+
<!-- The $b-extracting-* switches that select that mode are -->
|
|
196
|
+
<!-- described at "Controlling Two-Pass Extraction and -->
|
|
197
|
+
<!-- Substitution". -->
|
|
198
198
|
|
|
199
199
|
<!-- Isolate conversion of Runestone/interactive to PreTeXt/static -->
|
|
200
200
|
<xsl:import href="./pretext-runestone-static.xsl"/>
|
|
@@ -204,7 +204,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
204
204
|
<!-- dependencies. In almost every rational use, the "-common" -->
|
|
205
205
|
<!-- stylesheet is imported by a conversion, so it is easy to -->
|
|
206
206
|
<!-- miss these dependencies. An example in 2022-06 was the use -->
|
|
207
|
-
<!-- of the "
|
|
207
|
+
<!-- of the "unique-id" template to coordinate construction and -->
|
|
208
208
|
<!-- insertion of WeBWorK problems with an intervening trip to a -->
|
|
209
209
|
<!-- WW server. The "pretext-enhanced-source.xsl" stylesheet is -->
|
|
210
210
|
<!-- one place where "-common" does not creep in. Use of a modal -->
|
|
@@ -232,7 +232,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
232
232
|
<!-- Sometimes we only want to stop at an intermediate tree. For example, -->
|
|
233
233
|
<!-- we may convert only to a "version" (valid PreTeXt) via resolution of -->
|
|
234
234
|
<!-- version support and customizations, or stop at the tree that has -->
|
|
235
|
-
<!-- @assembly-id attributes but has not yet loaded exercise components
|
|
235
|
+
<!-- @pi:assembly-id attributes but has not yet loaded exercise components.-->
|
|
236
236
|
<!-- We control this with internal variables, not documented as author or -->
|
|
237
237
|
<!-- publisher features. When we stop this early, "exercise-style" is -->
|
|
238
238
|
<!-- irrelevant. -->
|
|
@@ -241,9 +241,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
241
241
|
<xsl:param name="assembly.version-only" select="''"/>
|
|
242
242
|
<xsl:param name="assembly.assembly-id-only" select="''"/>
|
|
243
243
|
|
|
244
|
-
<!-- Set to 'yes' to enable diagnostic checks, such as
|
|
245
|
-
<!-- verifying coherence of @assembly-id and @unique-id. -->
|
|
246
|
-
<!-- Not documented as an author or publisher feature.
|
|
244
|
+
<!-- Set to 'yes' to enable diagnostic checks, such as -->
|
|
245
|
+
<!-- verifying coherence of @pi:assembly-id and @pi:unique-id. -->
|
|
246
|
+
<!-- Not documented as an author or publisher feature. -->
|
|
247
247
|
<xsl:param name="assembly.debug" select="''"/>
|
|
248
248
|
<xsl:variable name="b-assembly-debug" select="$assembly.debug = 'yes'"/>
|
|
249
249
|
|
|
@@ -349,16 +349,23 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
349
349
|
<!-- Source Assembly Infrastructure -->
|
|
350
350
|
<!-- ############################## -->
|
|
351
351
|
|
|
352
|
-
<!-- When building duplicates, we have occasion
|
|
353
|
-
<!-- to inspect the original in various places
|
|
354
|
-
<!-- We do not know if we have "fixed" the
|
|
355
|
-
<!-- deprecated overall element, so need to
|
|
356
|
-
<!-- try both. For example, this variable is
|
|
357
|
-
<!-- employed by the warnings and deprecation
|
|
358
|
-
<!-- messages that result from analyzing an
|
|
359
|
-
<!-- author's source, since we may "repair"
|
|
360
|
-
<!-- some of them later, so we have to catch
|
|
361
|
-
<!-- them early.
|
|
352
|
+
<!-- When building duplicates, we have occasion -->
|
|
353
|
+
<!-- to inspect the original in various places -->
|
|
354
|
+
<!-- We do not know if we have "fixed" the -->
|
|
355
|
+
<!-- deprecated overall element, so need to -->
|
|
356
|
+
<!-- try both. For example, this variable is -->
|
|
357
|
+
<!-- employed by the warnings and deprecation -->
|
|
358
|
+
<!-- messages that result from analyzing an -->
|
|
359
|
+
<!-- author's source, since we may "repair" -->
|
|
360
|
+
<!-- some of them later, so we have to catch -->
|
|
361
|
+
<!-- them early. -->
|
|
362
|
+
<!-- The author's source, as parsed. Kept for duties genuinely -->
|
|
363
|
+
<!-- about the source document: resolving relative filenames via -->
|
|
364
|
+
<!-- the second argument of the document() function, and -->
|
|
365
|
+
<!-- warnings/views that inspect exactly what the author wrote -->
|
|
366
|
+
<!-- ("generic-warnings", view-source). Checks and lookups against -->
|
|
367
|
+
<!-- the document's *content* belong on the assembled tree, $root, -->
|
|
368
|
+
<!-- where private solutions are merged and versions are resolved. -->
|
|
362
369
|
<xsl:variable name="original" select="/mathbook|/pretext"/>
|
|
363
370
|
|
|
364
371
|
<!-- These modal templates duplicate the source exactly for each -->
|
|
@@ -519,6 +526,12 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
519
526
|
<!-- Also, note that this tree is useful for certain tasks, like -->
|
|
520
527
|
<!-- validation, or reporting values of publisher variables, without -->
|
|
521
528
|
<!-- regard to the subsequent passes. -->
|
|
529
|
+
<!-- The version tree is the earliest assembly product a publisher -->
|
|
530
|
+
<!-- variable may consult (structure can differ by version). The -->
|
|
531
|
+
<!-- passes up to, and including, "version" must never consult a -->
|
|
532
|
+
<!-- variable defined from this tree — that is a circular reference, -->
|
|
533
|
+
<!-- detected only at runtime. The "crossing point" facts in -->
|
|
534
|
+
<!-- publisher-variables.xsl enumerate the consumers. -->
|
|
522
535
|
<xsl:variable name="version-root" select="$version/pretext"/>
|
|
523
536
|
<xsl:variable name="version-docinfo" select="$version-root/docinfo"/>
|
|
524
537
|
<xsl:variable name="version-document-root" select="$version-root/*[not(self::docinfo)]"/>
|
|
@@ -545,6 +558,23 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
545
558
|
<xsl:when test="$b-version-only"/>
|
|
546
559
|
<!-- build on "version" to add original id's -->
|
|
547
560
|
<xsl:otherwise>
|
|
561
|
+
<!-- Duplicate identifiers are an authoring error, so the checks -->
|
|
562
|
+
<!-- run on the version tree: private solutions are merged by -->
|
|
563
|
+
<!-- now (authored content in companion files), while version -->
|
|
564
|
+
<!-- resolution has already discarded the deliberate duplicates -->
|
|
565
|
+
<!-- that multi-version source may carry. Later phases -->
|
|
566
|
+
<!-- manufacture copies of authored content (e.g. static -->
|
|
567
|
+
<!-- representations of interactive exercises), and those must -->
|
|
568
|
+
<!-- not be blamed on the author. -->
|
|
569
|
+
<xsl:call-template name="duplication-check-xmlid">
|
|
570
|
+
<xsl:with-param name="nodes" select="$version//*[@xml:id]"/>
|
|
571
|
+
<xsl:with-param name="purpose" select="'authored'"/>
|
|
572
|
+
</xsl:call-template>
|
|
573
|
+
<xsl:call-template name="duplication-check-label">
|
|
574
|
+
<xsl:with-param name="nodes" select="$version//*[@label]"/>
|
|
575
|
+
<xsl:with-param name="purpose" select="'authored'"/>
|
|
576
|
+
</xsl:call-template>
|
|
577
|
+
<!-- checks are done, now add the "original-id" identification -->
|
|
548
578
|
<xsl:apply-templates select="$version" mode="id-attribute">
|
|
549
579
|
<!-- $parent-id defaults to 'root' in template -->
|
|
550
580
|
<xsl:with-param name="attr-name" select="'original-id'"/>
|
|
@@ -580,16 +610,16 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
580
610
|
</xsl:variable>
|
|
581
611
|
<xsl:variable name="assembly-label" select="exsl:node-set($assembly-label-rtf)"/>
|
|
582
612
|
|
|
583
|
-
<!-- Make static substitutions for dynamic exercises. This runs AFTER
|
|
584
|
-
<!-- the @assembly-id stamp because the substitution round trip keys on -->
|
|
585
|
-
<!-- @assembly-id: extract-dynamic.xsl writes it as the exercise_id, and -->
|
|
586
|
-
<!-- the lookup below reads it. @assembly-id is the early identifier -->
|
|
587
|
-
<!-- both ends can compute consistently (the authored @label would only
|
|
588
|
-
<!-- match for labeled exercises, missing unlabeled ones and tasks).
|
|
589
|
-
<!-- The pass only acts on the elements enumerated in this presence
|
|
590
|
-
<!-- test (see the "dynamic-substitution" templates); without any of
|
|
591
|
-
<!-- them it is the identity, so we skip the full-tree copy. NB: a
|
|
592
|
-
<!-- new template in the mode must be reflected in this test.
|
|
613
|
+
<!-- Make static substitutions for dynamic exercises. This runs AFTER -->
|
|
614
|
+
<!-- the @pi:assembly-id stamp because the substitution round trip keys on -->
|
|
615
|
+
<!-- @pi:assembly-id: extract-dynamic.xsl writes it as the exercise_id, and -->
|
|
616
|
+
<!-- the lookup below reads it. @pi:assembly-id is the early identifier -->
|
|
617
|
+
<!-- both ends can compute consistently (the authored @label would only -->
|
|
618
|
+
<!-- match for labeled exercises, missing unlabeled ones and tasks). -->
|
|
619
|
+
<!-- The pass only acts on the elements enumerated in this presence -->
|
|
620
|
+
<!-- test (see the "dynamic-substitution" templates); without any of -->
|
|
621
|
+
<!-- them it is the identity, so we skip the full-tree copy. NB: a -->
|
|
622
|
+
<!-- new template in the mode must be reflected in this test. -->
|
|
593
623
|
<xsl:variable name="b-has-dynamic-markup" select="boolean($assembly-label//setup | $assembly-label//numcmp | $assembly-label//strcmp | $assembly-label//jscmp | $assembly-label//mathcmp | $assembly-label//logic | $assembly-label//fillin[@ansobj] | $assembly-label//eval[@obj])"/>
|
|
594
624
|
<xsl:variable name="dynamic-rtf">
|
|
595
625
|
<xsl:if test="$b-has-dynamic-markup">
|
|
@@ -600,7 +630,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
600
630
|
|
|
601
631
|
<xsl:variable name="representations-rtf">
|
|
602
632
|
<xsl:choose>
|
|
603
|
-
<!-- short-circuit to stop after adding @assembly-id -->
|
|
633
|
+
<!-- short-circuit to stop after adding @pi:assembly-id -->
|
|
604
634
|
<xsl:when test="$b-assembly-id-only"/>
|
|
605
635
|
<xsl:otherwise>
|
|
606
636
|
<xsl:apply-templates select="$dynamic" mode="representations"/>
|
|
@@ -629,18 +659,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
629
659
|
<!-- out of the "identification" pass, so is located here. Perhaps -->
|
|
630
660
|
<!-- it can/should move earlier, maybe not. -->
|
|
631
661
|
<xsl:variable name="labels-rtf">
|
|
632
|
-
<!-- pass in all elements with authored @xml:id -->
|
|
633
|
-
<!-- to look for authored duplicates -->
|
|
634
|
-
<xsl:call-template name="duplication-check-xmlid">
|
|
635
|
-
<xsl:with-param name="nodes" select="$enrichment//*[@xml:id]"/>
|
|
636
|
-
<xsl:with-param name="purpose" select="'authored'"/>
|
|
637
|
-
</xsl:call-template>
|
|
638
|
-
<!-- pass in all elements with authored @label -->
|
|
639
|
-
<!-- to look for authored duplicates -->
|
|
640
|
-
<xsl:call-template name="duplication-check-label">
|
|
641
|
-
<xsl:with-param name="nodes" select="$enrichment//*[@label]"/>
|
|
642
|
-
<xsl:with-param name="purpose" select="'authored'"/>
|
|
643
|
-
</xsl:call-template>
|
|
644
662
|
<xsl:apply-templates select="$enrichment" mode="labels"/>
|
|
645
663
|
</xsl:variable>
|
|
646
664
|
<xsl:variable name="labels" select="exsl:node-set($labels-rtf)"/>
|
|
@@ -872,7 +890,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
872
890
|
<!-- This is an AWOL node, not empty content (which is allowed) -->
|
|
873
891
|
<xsl:if test="not($the-lookup)">
|
|
874
892
|
<xsl:text>[MISSING CUSTOM CONTENT HERE]</xsl:text>
|
|
875
|
-
<xsl:message>PTX:
|
|
893
|
+
<xsl:message>PTX:ERROR: lookup for a "custom" element with @name set to "<xsl:value-of select="$the-ref"/>" has failed, while consulting the customization file "<xsl:value-of select="$customizations-file"/>". Output will contain "[MISSING CUSTOM CONTENT HERE]" instead</xsl:message>
|
|
876
894
|
<xsl:apply-templates select="$the-custom" mode="location-report"/>
|
|
877
895
|
</xsl:if>
|
|
878
896
|
<!-- Copying the contents of "custom" via the "version" templates -->
|
|
@@ -893,10 +911,10 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
893
911
|
|
|
894
912
|
<!-- This section is the id-attribute pass. One mechanism (the -->
|
|
895
913
|
<!-- "id-attribute" templates below) is applied three times by -->
|
|
896
|
-
<!-- the chain (passes 3, 6 and 12), stamping @original-id,
|
|
897
|
-
<!-- @assembly-id and @unique-id in turn. The "labels" pass
|
|
914
|
+
<!-- the chain (passes 3, 6 and 12), stamping @pi:original-id, -->
|
|
915
|
+
<!-- @pi:assembly-id and @pi:unique-id in turn. The "labels" pass -->
|
|
898
916
|
<!-- runs between the second and third of these (see "Labels"), -->
|
|
899
|
-
<!-- and the @label values it creates are what the @unique-id
|
|
917
|
+
<!-- and the @label values it creates are what the @pi:unique-id -->
|
|
900
918
|
<!-- stamp reads here. The contract that follows is what lets -->
|
|
901
919
|
<!-- the three stampings agree element-for-element. -->
|
|
902
920
|
|
|
@@ -914,11 +932,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
914
932
|
<!-- This template is applied three times, producing three -->
|
|
915
933
|
<!-- attributes on every element: -->
|
|
916
934
|
<!-- -->
|
|
917
|
-
<!-- @original-id
|
|
935
|
+
<!-- @pi:original-id -->
|
|
918
936
|
<!-- after "version", before any additions -->
|
|
919
|
-
<!-- @assembly-id
|
|
937
|
+
<!-- @pi:assembly-id -->
|
|
920
938
|
<!-- after "exercise", before "representations" -->
|
|
921
|
-
<!-- @unique-id
|
|
939
|
+
<!-- @pi:unique-id -->
|
|
922
940
|
<!-- after "labels", the final structural form -->
|
|
923
941
|
<!-- -->
|
|
924
942
|
<!-- The architecture relies on one critical invariant: -->
|
|
@@ -971,7 +989,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
971
989
|
<xsl:copy>
|
|
972
990
|
<!-- duplicate all attributes -->
|
|
973
991
|
<xsl:apply-templates select="@*" mode="id-attribute"/>
|
|
974
|
-
<!-- * Strategy is much like @original-id but maybe needs as much care
|
|
992
|
+
<!-- * Strategy is much like @pi:original-id but maybe needs as much care -->
|
|
975
993
|
<!-- * Element counts are used to reflect document tree structure -->
|
|
976
994
|
<!-- * Non-numeric separator needed to preserve uniqueness (e.g.1-12 != 11-2). -->
|
|
977
995
|
<!-- * Separators are therefore hyphens -->
|
|
@@ -1003,7 +1021,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1003
1021
|
</xsl:otherwise>
|
|
1004
1022
|
</xsl:choose>
|
|
1005
1023
|
</xsl:variable>
|
|
1006
|
-
<xsl:attribute name="{$attr-name}">
|
|
1024
|
+
<xsl:attribute name="pi:{$attr-name}">
|
|
1007
1025
|
<xsl:value-of select="$new-id"/>
|
|
1008
1026
|
</xsl:attribute>
|
|
1009
1027
|
<!-- recurse -->
|
|
@@ -1022,23 +1040,23 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1022
1040
|
</xsl:copy>
|
|
1023
1041
|
</xsl:template>
|
|
1024
1042
|
|
|
1025
|
-
<!-- Diagnostic: verify @assembly-id equals @unique-id for
|
|
1026
|
-
<!-- every element that carries both. A mismatch indicates
|
|
1027
|
-
<!-- a structural change between the two ID-stamping passes
|
|
1028
|
-
<!-- that violates the identification contract documented
|
|
1029
|
-
<!-- near the top of this stylesheet. Gated by the
|
|
1030
|
-
<!-- assembly.debug parameter; does nothing when off.
|
|
1043
|
+
<!-- Diagnostic: verify @pi:assembly-id equals @pi:unique-id for -->
|
|
1044
|
+
<!-- every element that carries both. A mismatch indicates -->
|
|
1045
|
+
<!-- a structural change between the two ID-stamping passes -->
|
|
1046
|
+
<!-- that violates the identification contract documented -->
|
|
1047
|
+
<!-- near the top of this stylesheet. Gated by the -->
|
|
1048
|
+
<!-- assembly.debug parameter; does nothing when off. -->
|
|
1031
1049
|
|
|
1032
1050
|
<xsl:template match="node()|@*" mode="id-coherence-check">
|
|
1033
1051
|
<xsl:if test="$b-assembly-debug">
|
|
1034
|
-
<xsl:for-each select=".//*[@assembly-id and @unique-id and not(@assembly-id = @unique-id)]">
|
|
1052
|
+
<xsl:for-each select=".//*[@pi:assembly-id and @pi:unique-id and not(@pi:assembly-id = @pi:unique-id)]">
|
|
1035
1053
|
<xsl:message>
|
|
1036
|
-
<xsl:text>PTX:DEBUG: @assembly-id / @unique-id mismatch on <</xsl:text>
|
|
1054
|
+
<xsl:text>PTX:DEBUG: @pi:assembly-id / @pi:unique-id mismatch on <</xsl:text>
|
|
1037
1055
|
<xsl:value-of select="local-name()"/>
|
|
1038
1056
|
<xsl:text>>: assembly-id="</xsl:text>
|
|
1039
|
-
<xsl:value-of select="@assembly-id"/>
|
|
1057
|
+
<xsl:value-of select="@pi:assembly-id"/>
|
|
1040
1058
|
<xsl:text>" unique-id="</xsl:text>
|
|
1041
|
-
<xsl:value-of select="@unique-id"/>
|
|
1059
|
+
<xsl:value-of select="@pi:unique-id"/>
|
|
1042
1060
|
<xsl:text>"</xsl:text>
|
|
1043
1061
|
</xsl:message>
|
|
1044
1062
|
</xsl:for-each>
|
|
@@ -1058,9 +1076,10 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1058
1076
|
<!-- $biblios in -common, and then mined for matches not -->
|
|
1059
1077
|
<!-- explicitly present? -->
|
|
1060
1078
|
<xsl:template match="backmatter/references[@source]" mode="assembly">
|
|
1061
|
-
<!-- Grab the list
|
|
1062
|
-
<!--
|
|
1063
|
-
|
|
1079
|
+
<!-- Grab the list. The filename is relative to the authored -->
|
|
1080
|
+
<!-- document, so the lookup anchors on $original: the context -->
|
|
1081
|
+
<!-- node lives in a constructed tree, which has no base URI -->
|
|
1082
|
+
<xsl:variable name="biblios" select="document(@source, $original)"/>
|
|
1064
1083
|
<!-- Copy the "references" element (could be literal, but maybe not in "text" output mode) -->
|
|
1065
1084
|
<xsl:copy>
|
|
1066
1085
|
<!-- @source attribute not needed in enhanced source -->
|
|
@@ -1070,11 +1089,12 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1070
1089
|
<!-- Look at each "biblio" in the external file -->
|
|
1071
1090
|
<xsl:for-each select="$biblios/pretext-biblios/biblio">
|
|
1072
1091
|
<xsl:variable name="the-id" select="@xml:id"/>
|
|
1073
|
-
<xsl:message
|
|
1074
|
-
<!-- Building duplicate, so look
|
|
1075
|
-
<!--
|
|
1076
|
-
|
|
1077
|
-
|
|
1092
|
+
<xsl:message>PTX:DEBUG: @xml:id of <biblio> in bibliography file: <xsl:value-of select="$the-id"/></xsl:message>
|
|
1093
|
+
<!-- Building duplicate, so look in this pass's input -->
|
|
1094
|
+
<!-- tree (the version in play) for an "xref" pointing -->
|
|
1095
|
+
<!-- to the current context "biblio" -->
|
|
1096
|
+
<xsl:if test="$original-labeled//xref[@ref = $the-id]">
|
|
1097
|
+
<xsl:message>PTX:DEBUG: Located this <biblio> cited in original source</xsl:message>
|
|
1078
1098
|
<xsl:apply-templates select="." mode="assembly"/>
|
|
1079
1099
|
</xsl:if>
|
|
1080
1100
|
</xsl:for-each>
|
|
@@ -1254,17 +1274,16 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1254
1274
|
<xsl:variable name="first-ref">
|
|
1255
1275
|
<xsl:value-of select="$tokenized-refs[1]"/>
|
|
1256
1276
|
</xsl:variable>
|
|
1257
|
-
<!-- context
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
</xsl:for-each>
|
|
1277
|
+
<!-- The context "xref" sits in this pass's input tree, so -->
|
|
1278
|
+
<!-- id() searches exactly the version in play -->
|
|
1279
|
+
<xsl:choose>
|
|
1280
|
+
<xsl:when test="id($first-ref)/self::biblio/parent::references/parent::backmatter">
|
|
1281
|
+
<xsl:text>yes</xsl:text>
|
|
1282
|
+
</xsl:when>
|
|
1283
|
+
<xsl:otherwise>
|
|
1284
|
+
<xsl:text>no</xsl:text>
|
|
1285
|
+
</xsl:otherwise>
|
|
1286
|
+
</xsl:choose>
|
|
1268
1287
|
</xsl:otherwise>
|
|
1269
1288
|
</xsl:choose>
|
|
1270
1289
|
</xsl:variable>
|
|
@@ -1284,7 +1303,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1284
1303
|
<!-- a candidate for replacement -->
|
|
1285
1304
|
<xsl:otherwise>
|
|
1286
1305
|
<xsl:variable name="the-xref-id">
|
|
1287
|
-
<xsl:value-of select="@original-id"/>
|
|
1306
|
+
<xsl:value-of select="@pi:original-id"/>
|
|
1288
1307
|
</xsl:variable>
|
|
1289
1308
|
<xsl:variable name="matched-citation" select="document('gen/references/csl-bibliography.xml', $original)/pi:csl-references/pi:csl-citation[@xml:id = $the-xref-id]"/>
|
|
1290
1309
|
<xsl:copy-of select="$matched-citation"/>
|
|
@@ -1364,7 +1383,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1364
1383
|
<!-- no error means to proceed with copy -->
|
|
1365
1384
|
<xsl:when test="$error-message-for-copy = ''">
|
|
1366
1385
|
<xsl:copy>
|
|
1367
|
-
<xsl:attribute name="copied-from">
|
|
1386
|
+
<xsl:attribute name="pi:copied-from">
|
|
1368
1387
|
<xsl:value-of select="@copy"/>
|
|
1369
1388
|
</xsl:attribute>
|
|
1370
1389
|
<!-- Duplicate attributes, but remove the @copy attribute -->
|
|
@@ -1487,7 +1506,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1487
1506
|
<!-- problems are interactive or static, inline or not, based -->
|
|
1488
1507
|
<!-- on publisher options. -->
|
|
1489
1508
|
<xsl:if test="not(self::task)">
|
|
1490
|
-
<xsl:attribute name="exercise-customization">
|
|
1509
|
+
<xsl:attribute name="pi:exercise-customization">
|
|
1491
1510
|
<xsl:choose>
|
|
1492
1511
|
<xsl:when test="&PROJECT-FILTER;">
|
|
1493
1512
|
<xsl:text>project</xsl:text>
|
|
@@ -1517,7 +1536,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1517
1536
|
<!-- These "interactivity types" are meant for Runestone-enabled -->
|
|
1518
1537
|
<!-- interactive exercises and projects -->
|
|
1519
1538
|
<xsl:template match="*" mode="exercise-interactive-attribute">
|
|
1520
|
-
<xsl:attribute name="exercise-interactive">
|
|
1539
|
+
<xsl:attribute name="pi:exercise-interactive">
|
|
1521
1540
|
<xsl:choose>
|
|
1522
1541
|
<!-- This is defensive, so statement//var below does not -->
|
|
1523
1542
|
<!-- match for WeBWorK. -->
|
|
@@ -1537,14 +1556,14 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1537
1556
|
<xsl:when test="stack">
|
|
1538
1557
|
<xsl:text>stack</xsl:text>
|
|
1539
1558
|
</xsl:when>
|
|
1540
|
-
<!-- @runestone was once used to signify a Runestone exercise given
|
|
1541
|
-
<!-- just by raw HTML. The @exercise-interactive value uses was,
|
|
1542
|
-
<!-- appropriately, "htmlhack". We now replace it with an old-time,
|
|
1543
|
-
<!-- static PreTeXt style (dumb) exercise. Changing the value here
|
|
1544
|
-
<!-- is a quick way to nullify activity in later passes. See below
|
|
1545
|
-
<!-- where the "repair" phase removes the @runestone attribute and
|
|
1546
|
-
<!-- creates the (dumb) exercise, in order to understand more fully.
|
|
1547
|
-
<!-- The commit with these changes might also help. (2025-11-04)
|
|
1559
|
+
<!-- @runestone was once used to signify a Runestone exercise given -->
|
|
1560
|
+
<!-- just by raw HTML. The @pi:exercise-interactive value uses was, -->
|
|
1561
|
+
<!-- appropriately, "htmlhack". We now replace it with an old-time, -->
|
|
1562
|
+
<!-- static PreTeXt style (dumb) exercise. Changing the value here -->
|
|
1563
|
+
<!-- is a quick way to nullify activity in later passes. See below -->
|
|
1564
|
+
<!-- where the "repair" phase removes the @runestone attribute and -->
|
|
1565
|
+
<!-- creates the (dumb) exercise, in order to understand more fully. -->
|
|
1566
|
+
<!-- The commit with these changes might also help. (2025-11-04) -->
|
|
1548
1567
|
<xsl:when test="@runestone">
|
|
1549
1568
|
<xsl:text>static</xsl:text>
|
|
1550
1569
|
</xsl:when>
|
|
@@ -1613,6 +1632,78 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1613
1632
|
</xsl:attribute>
|
|
1614
1633
|
</xsl:template>
|
|
1615
1634
|
|
|
1635
|
+
<!-- Insert a default correct "test" for a FITB "exercise" or -->
|
|
1636
|
+
<!-- PROJECT-LIKE when an "evaluate" has no explicit correct -->
|
|
1637
|
+
<!-- "test": the corresponding "fillin" has a static @answer, -->
|
|
1638
|
+
<!-- so synthesize a "test" and let all downstream processing -->
|
|
1639
|
+
<!-- follow a single code path. Only @mode "string" and -->
|
|
1640
|
+
<!-- "number" are handled here; "math" uses separate logic. -->
|
|
1641
|
+
<xsl:template match="evaluation/evaluate[
|
|
1642
|
+
not(@all = 'yes') and
|
|
1643
|
+
not(test[@correct = 'yes']) and
|
|
1644
|
+
not(
|
|
1645
|
+
count(../../statement//fillin) > 1
|
|
1646
|
+
and
|
|
1647
|
+
../evaluate[@all = 'yes']/test
|
|
1648
|
+
)
|
|
1649
|
+
]" mode="exercise">
|
|
1650
|
+
<xsl:param name="division"/>
|
|
1651
|
+
|
|
1652
|
+
<!-- Identify this evaluate's position among its siblings and its name, -->
|
|
1653
|
+
<!-- to locate the corresponding fillin by name first, position second. -->
|
|
1654
|
+
<xsl:variable name="eval-position" select="count(preceding-sibling::evaluate) + 1"/>
|
|
1655
|
+
<xsl:variable name="eval-name" select="@name"/>
|
|
1656
|
+
|
|
1657
|
+
<!-- Navigate to the exercise/project/task parent of evaluation -->
|
|
1658
|
+
<xsl:variable name="exercise-parent" select="parent::evaluation/parent::*"/>
|
|
1659
|
+
|
|
1660
|
+
<!-- Find the corresponding fillin (name-based match takes priority) -->
|
|
1661
|
+
<xsl:variable name="match-fillin">
|
|
1662
|
+
<xsl:choose>
|
|
1663
|
+
<xsl:when test="$eval-name != '' and
|
|
1664
|
+
$exercise-parent/statement//fillin[@name = $eval-name]">
|
|
1665
|
+
<xsl:copy-of select="$exercise-parent/statement//fillin[@name = $eval-name]"/>
|
|
1666
|
+
</xsl:when>
|
|
1667
|
+
<xsl:otherwise>
|
|
1668
|
+
<xsl:copy-of select="($exercise-parent/statement//fillin)[$eval-position]"/>
|
|
1669
|
+
</xsl:otherwise>
|
|
1670
|
+
</xsl:choose>
|
|
1671
|
+
</xsl:variable>
|
|
1672
|
+
<xsl:variable name="fillin" select="exsl:node-set($match-fillin)/fillin"/>
|
|
1673
|
+
|
|
1674
|
+
<xsl:copy>
|
|
1675
|
+
<xsl:apply-templates select="@*" mode="exercise">
|
|
1676
|
+
<xsl:with-param name="division" select="$division"/>
|
|
1677
|
+
</xsl:apply-templates>
|
|
1678
|
+
<!-- Synthesize a correct test when the fillin has a static @answer -->
|
|
1679
|
+
<!-- and a recognized mode. Place it first so it takes precedence. -->
|
|
1680
|
+
<xsl:if test="$fillin/@answer and not($fillin/@ansobj)">
|
|
1681
|
+
<xsl:choose>
|
|
1682
|
+
<xsl:when test="$fillin/@mode = 'number'">
|
|
1683
|
+
<test correct="yes">
|
|
1684
|
+
<numcmp use-answer="yes"/>
|
|
1685
|
+
</test>
|
|
1686
|
+
</xsl:when>
|
|
1687
|
+
<xsl:when test="$fillin/@mode = 'string'">
|
|
1688
|
+
<test correct="yes">
|
|
1689
|
+
<strcmp use-answer="yes"/>
|
|
1690
|
+
</test>
|
|
1691
|
+
</xsl:when>
|
|
1692
|
+
<xsl:otherwise>
|
|
1693
|
+
<xsl:message>PTX:WARNING: fillin in "<xsl:value-of
|
|
1694
|
+
select="$exercise-parent/@visible-id"/>" has @answer but
|
|
1695
|
+
@mode is missing or not recognized (expected 'number' or
|
|
1696
|
+
'string'). No default correct test synthesized.</xsl:message>
|
|
1697
|
+
</xsl:otherwise>
|
|
1698
|
+
</xsl:choose>
|
|
1699
|
+
</xsl:if>
|
|
1700
|
+
<!-- Copy existing children (non-correct tests, feedback, etc.) -->
|
|
1701
|
+
<xsl:apply-templates select="node()" mode="exercise">
|
|
1702
|
+
<xsl:with-param name="division" select="$division"/>
|
|
1703
|
+
</xsl:apply-templates>
|
|
1704
|
+
</xsl:copy>
|
|
1705
|
+
</xsl:template>
|
|
1706
|
+
|
|
1616
1707
|
<!-- ##################################################### -->
|
|
1617
1708
|
<!-- Dynamic Substitutions -->
|
|
1618
1709
|
<!-- Cut out dynamic setup and evaluation for static mode. -->
|
|
@@ -1638,9 +1729,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1638
1729
|
<xsl:template match="fillin[@ansobj]" mode="dynamic-substitution">
|
|
1639
1730
|
<xsl:choose>
|
|
1640
1731
|
<xsl:when test="($exercise-style = 'static') and not($b-extracting)">
|
|
1641
|
-
<!-- The substitutions file is keyed by @assembly-id, which
|
|
1642
|
-
<!-- extract-dynamic.xsl writes as the exercise_id. This pass
|
|
1643
|
-
<!-- runs after the @assembly-id stamp, so the owner carries it. -->
|
|
1732
|
+
<!-- The substitutions file is keyed by @pi:assembly-id, which -->
|
|
1733
|
+
<!-- extract-dynamic.xsl writes as the exercise_id. This pass -->
|
|
1734
|
+
<!-- runs after the @pi:assembly-id stamp, so the owner carries it. -->
|
|
1644
1735
|
<xsl:variable name="owner" select="ancestor::statement/.."/>
|
|
1645
1736
|
<xsl:variable name="parent-id">
|
|
1646
1737
|
<xsl:apply-templates select="$owner" mode="assembly-id"/>
|
|
@@ -1669,9 +1760,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1669
1760
|
<xsl:choose>
|
|
1670
1761
|
<!-- static, for multiple conversions, but primarily LaTeX -->
|
|
1671
1762
|
<xsl:when test="($exercise-style = 'static') and not($b-extracting)">
|
|
1672
|
-
<!-- The substitutions file is keyed by @assembly-id, which
|
|
1673
|
-
<!-- extract-dynamic.xsl writes as the exercise_id. This pass
|
|
1674
|
-
<!-- runs after the @assembly-id stamp, so the owner carries it. -->
|
|
1763
|
+
<!-- The substitutions file is keyed by @pi:assembly-id, which -->
|
|
1764
|
+
<!-- extract-dynamic.xsl writes as the exercise_id. This pass -->
|
|
1765
|
+
<!-- runs after the @pi:assembly-id stamp, so the owner carries it. -->
|
|
1675
1766
|
<xsl:variable name="owner" select="(ancestor::statement|ancestor::solution|ancestor::evaluation)/.."/>
|
|
1676
1767
|
<xsl:variable name="parent-id">
|
|
1677
1768
|
<xsl:apply-templates select="$owner" mode="assembly-id"/>
|
|
@@ -1739,15 +1830,15 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1739
1830
|
<!-- The pattern grammar does not permit variable references, so the -->
|
|
1740
1831
|
<!-- list of Runestone interactivity types is a literal, fenced string -->
|
|
1741
1832
|
<!-- repeated for each element that can carry one. Match exactly -->
|
|
1742
|
-
<!-- whenever @exercise-interactive is one of the fenced values.
|
|
1833
|
+
<!-- whenever @pi:exercise-interactive is one of the fenced values. -->
|
|
1743
1834
|
<!-- NB: also consulted in Runestone manifest creation. -->
|
|
1744
1835
|
|
|
1745
|
-
<xsl:template match="exercise[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @exercise-interactive, '|'))]
|
|
1746
|
-
| project[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @exercise-interactive, '|'))]
|
|
1747
|
-
| activity[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @exercise-interactive, '|'))]
|
|
1748
|
-
| exploration[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @exercise-interactive, '|'))]
|
|
1749
|
-
| investigation[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @exercise-interactive, '|'))]
|
|
1750
|
-
| task[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @exercise-interactive, '|'))]" mode="representations">
|
|
1836
|
+
<xsl:template match="exercise[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @pi:exercise-interactive, '|'))]
|
|
1837
|
+
| project[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @pi:exercise-interactive, '|'))]
|
|
1838
|
+
| activity[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @pi:exercise-interactive, '|'))]
|
|
1839
|
+
| exploration[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @pi:exercise-interactive, '|'))]
|
|
1840
|
+
| investigation[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @pi:exercise-interactive, '|'))]
|
|
1841
|
+
| task[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @pi:exercise-interactive, '|'))]" mode="representations">
|
|
1751
1842
|
<!-- always preserve "exercise/project" container here, with attributes -->
|
|
1752
1843
|
<xsl:copy>
|
|
1753
1844
|
<xsl:apply-templates select="@*" mode="representations"/>
|
|
@@ -1757,7 +1848,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1757
1848
|
<!-- for use naturally by most conversions -->
|
|
1758
1849
|
<xsl:when test="$exercise-style = 'static'">
|
|
1759
1850
|
<!-- overwrite classification as purely static now -->
|
|
1760
|
-
<xsl:attribute name="exercise-interactive">
|
|
1851
|
+
<xsl:attribute name="pi:exercise-interactive">
|
|
1761
1852
|
<xsl:text>static</xsl:text>
|
|
1762
1853
|
</xsl:attribute>
|
|
1763
1854
|
<xsl:apply-templates select="." mode="runestone-to-static"/>
|
|
@@ -1774,18 +1865,18 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1774
1865
|
<!-- assembling for dynamic exercises, and not hosting on Runestone, go instead -->
|
|
1775
1866
|
<!-- with the static version. We have three scenarios, handled with variations. -->
|
|
1776
1867
|
<!-- Note that these matches have been carved out from the above massive match. -->
|
|
1777
|
-
<xsl:template match="exercise[(@exercise-interactive = 'select')]
|
|
1778
|
-
| project[(@exercise-interactive = 'select')]
|
|
1779
|
-
| activity[(@exercise-interactive = 'select')]
|
|
1780
|
-
| exploration[(@exercise-interactive = 'select')]
|
|
1781
|
-
| investigation[(@exercise-interactive = 'select')]
|
|
1782
|
-
| task[(@exercise-interactive = 'select')]" mode="representations">
|
|
1868
|
+
<xsl:template match="exercise[(@pi:exercise-interactive = 'select')]
|
|
1869
|
+
| project[(@pi:exercise-interactive = 'select')]
|
|
1870
|
+
| activity[(@pi:exercise-interactive = 'select')]
|
|
1871
|
+
| exploration[(@pi:exercise-interactive = 'select')]
|
|
1872
|
+
| investigation[(@pi:exercise-interactive = 'select')]
|
|
1873
|
+
| task[(@pi:exercise-interactive = 'select')]" mode="representations">
|
|
1783
1874
|
<xsl:copy>
|
|
1784
1875
|
<xsl:choose>
|
|
1785
1876
|
<xsl:when test="($exercise-style = 'static')">
|
|
1786
1877
|
<xsl:apply-templates select="@*" mode="representations"/>
|
|
1787
1878
|
<!-- overwrite classification as purely static now -->
|
|
1788
|
-
<xsl:attribute name="exercise-interactive">
|
|
1879
|
+
<xsl:attribute name="pi:exercise-interactive">
|
|
1789
1880
|
<xsl:text>static</xsl:text>
|
|
1790
1881
|
</xsl:attribute>
|
|
1791
1882
|
<xsl:apply-templates select="." mode="runestone-to-static"/>
|
|
@@ -1795,7 +1886,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1795
1886
|
<xsl:when test="($exercise-style = 'dynamic') and not($b-host-runestone)">
|
|
1796
1887
|
<xsl:apply-templates select="@*" mode="representations"/>
|
|
1797
1888
|
<!-- overwrite classification as purely static now -->
|
|
1798
|
-
<xsl:attribute name="exercise-interactive">
|
|
1889
|
+
<xsl:attribute name="pi:exercise-interactive">
|
|
1799
1890
|
<xsl:text>static</xsl:text>
|
|
1800
1891
|
</xsl:attribute>
|
|
1801
1892
|
<xsl:apply-templates select="." mode="runestone-to-static"/>
|
|
@@ -1811,18 +1902,18 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1811
1902
|
|
|
1812
1903
|
<!-- dual copy (not copy-of) -->
|
|
1813
1904
|
|
|
1814
|
-
<xsl:template match="exercise[(@exercise-interactive = 'dual')]
|
|
1815
|
-
| project[(@exercise-interactive = 'dual')]
|
|
1816
|
-
| activity[(@exercise-interactive = 'dual')]
|
|
1817
|
-
| exploration[(@exercise-interactive = 'dual')]
|
|
1818
|
-
| investigation[(@exercise-interactive = 'dual')]
|
|
1819
|
-
| task[(@exercise-interactive = 'dual')]" mode="representations">
|
|
1905
|
+
<xsl:template match="exercise[(@pi:exercise-interactive = 'dual')]
|
|
1906
|
+
| project[(@pi:exercise-interactive = 'dual')]
|
|
1907
|
+
| activity[(@pi:exercise-interactive = 'dual')]
|
|
1908
|
+
| exploration[(@pi:exercise-interactive = 'dual')]
|
|
1909
|
+
| investigation[(@pi:exercise-interactive = 'dual')]
|
|
1910
|
+
| task[(@pi:exercise-interactive = 'dual')]" mode="representations">
|
|
1820
1911
|
<xsl:copy>
|
|
1821
1912
|
<xsl:apply-templates select="@*" mode="representations"/>
|
|
1822
1913
|
<xsl:choose>
|
|
1823
1914
|
<xsl:when test="($exercise-style = 'static')">
|
|
1824
1915
|
<!-- make a "static" classification, over-writing a "dual" -->
|
|
1825
|
-
<xsl:attribute name="exercise-interactive">
|
|
1916
|
+
<xsl:attribute name="pi:exercise-interactive">
|
|
1826
1917
|
<xsl:text>static</xsl:text>
|
|
1827
1918
|
</xsl:attribute>
|
|
1828
1919
|
<!-- copy overall title and idx, METADATA-FILTER feels too broad -->
|
|
@@ -1839,24 +1930,24 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1839
1930
|
</xsl:template>
|
|
1840
1931
|
|
|
1841
1932
|
|
|
1842
|
-
<!-- Static (non-interactive)
|
|
1843
|
-
<!-- @exercise-interactive = 'static' needs no adjustments -->
|
|
1933
|
+
<!-- Static (non-interactive) -->
|
|
1934
|
+
<!-- @pi:exercise-interactive = 'static' needs no adjustments -->
|
|
1844
1935
|
|
|
1845
1936
|
<!-- Mine webwork-reps for relevant application -->
|
|
1846
1937
|
|
|
1847
1938
|
<!-- WeBWorK exercises retain a "webwork" child element through the -->
|
|
1848
1939
|
<!-- pipeline. Here in the representations pass, we look up the -->
|
|
1849
1940
|
<!-- corresponding "webwork-reps" from the representations file using -->
|
|
1850
|
-
<!-- the parent exercise's @assembly-id, and substitute it in place
|
|
1941
|
+
<!-- the parent exercise's @pi:assembly-id, and substitute it in place -->
|
|
1851
1942
|
<!-- of the "webwork" element. We then split three ways, for PGML, -->
|
|
1852
1943
|
<!-- static, and dynamic (HTML) employment, via modal templates. -->
|
|
1853
1944
|
<!-- During extraction, the "webwork" child is left intact. -->
|
|
1854
1945
|
<!-- NB: including "task" though this may not be supported. -->
|
|
1855
|
-
<xsl:template match="exercise[(@exercise-interactive = 'webwork')]
|
|
1856
|
-
| project[(@exercise-interactive = 'webwork')]
|
|
1857
|
-
| activity[(@exercise-interactive = 'webwork')]
|
|
1858
|
-
| exploration[(@exercise-interactive = 'webwork')]
|
|
1859
|
-
| investigation[(@exercise-interactive = 'webwork')]" mode="representations">
|
|
1946
|
+
<xsl:template match="exercise[(@pi:exercise-interactive = 'webwork')]
|
|
1947
|
+
| project[(@pi:exercise-interactive = 'webwork')]
|
|
1948
|
+
| activity[(@pi:exercise-interactive = 'webwork')]
|
|
1949
|
+
| exploration[(@pi:exercise-interactive = 'webwork')]
|
|
1950
|
+
| investigation[(@pi:exercise-interactive = 'webwork')]" mode="representations">
|
|
1860
1951
|
<xsl:choose>
|
|
1861
1952
|
<!-- During extraction, pass through the exercise with its -->
|
|
1862
1953
|
<!-- "webwork" child intact for the extraction stylesheet -->
|
|
@@ -1868,9 +1959,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1868
1959
|
</xsl:when>
|
|
1869
1960
|
<xsl:otherwise>
|
|
1870
1961
|
<!-- Load the per-exercise representation file for this -->
|
|
1871
|
-
<!-- exercise, identified by its @assembly-id.
|
|
1962
|
+
<!-- exercise, identified by its @pi:assembly-id. -->
|
|
1872
1963
|
<xsl:variable name="webwork-rep-uri"
|
|
1873
|
-
select="concat($webwork-representations-dir, @assembly-id, '.xml')"/>
|
|
1964
|
+
select="concat($webwork-representations-dir, @pi:assembly-id, '.xml')"/>
|
|
1874
1965
|
<xsl:variable name="the-webwork-rep"
|
|
1875
1966
|
select="document($webwork-rep-uri, $original)/webwork-reps"/>
|
|
1876
1967
|
<xsl:choose>
|
|
@@ -1882,14 +1973,14 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1882
1973
|
<xsl:copy>
|
|
1883
1974
|
<xsl:apply-templates select="node()|@*" mode="representations"/>
|
|
1884
1975
|
</xsl:copy>
|
|
1885
|
-
<xsl:message>PTX:ERROR: no WeBWorK representations directory configured in the publication file; WeBWorK exercise with @assembly-id "<xsl:value-of select="@assembly-id"/>" will be empty.</xsl:message>
|
|
1976
|
+
<xsl:message>PTX:ERROR: no WeBWorK representations directory configured in the publication file; WeBWorK exercise with @pi:assembly-id "<xsl:value-of select="@pi:assembly-id"/>" will be empty.</xsl:message>
|
|
1886
1977
|
</xsl:when>
|
|
1887
1978
|
<!-- This should only fail if the file is missing or stale. Repeatedly. -->
|
|
1888
1979
|
<xsl:when test="not($the-webwork-rep)">
|
|
1889
1980
|
<xsl:copy>
|
|
1890
1981
|
<xsl:apply-templates select="node()|@*" mode="representations"/>
|
|
1891
1982
|
</xsl:copy>
|
|
1892
|
-
<xsl:message>PTX:ERROR: could not load WeBWorK representation file "<xsl:value-of select="$webwork-rep-uri"/>" for @assembly-id "<xsl:value-of select="@assembly-id"/>"; re-generate the WeBWorK representations. A "webwork-representations.xml" in that directory indicates old-format files that need replacing.</xsl:message>
|
|
1983
|
+
<xsl:message>PTX:ERROR: could not load WeBWorK representation file "<xsl:value-of select="$webwork-rep-uri"/>" for @pi:assembly-id "<xsl:value-of select="@pi:assembly-id"/>"; re-generate the WeBWorK representations. A "webwork-representations.xml" in that directory indicates old-format files that need replacing.</xsl:message>
|
|
1893
1984
|
</xsl:when>
|
|
1894
1985
|
<xsl:otherwise>
|
|
1895
1986
|
<!-- The representation file may record a server failure -->
|
|
@@ -1899,7 +1990,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1899
1990
|
<!-- but warn the author so the failure does not go -->
|
|
1900
1991
|
<!-- unnoticed in later builds. -->
|
|
1901
1992
|
<xsl:if test="$the-webwork-rep/static/@failure">
|
|
1902
|
-
<xsl:message>PTX:WARNING: the WeBWorK problem with @assembly-id "<xsl:value-of select="@assembly-id"/>" has a stored "<xsl:value-of select="$the-webwork-rep/static/@failure"/>" failure recorded when the WeBWorK representations were last generated. A placeholder is being rendered in its place. Re-generate the WeBWorK representations (and watch for errors) to retry.</xsl:message>
|
|
1993
|
+
<xsl:message>PTX:WARNING: the WeBWorK problem with @pi:assembly-id "<xsl:value-of select="@pi:assembly-id"/>" has a stored "<xsl:value-of select="$the-webwork-rep/static/@failure"/>" failure recorded when the WeBWorK representations were last generated. A placeholder is being rendered in its place. Re-generate the WeBWorK representations (and watch for errors) to retry.</xsl:message>
|
|
1903
1994
|
</xsl:if>
|
|
1904
1995
|
<!-- Build a temporary exercise with "webwork-reps" from the -->
|
|
1905
1996
|
<!-- representations file substituted in place of "webwork". -->
|
|
@@ -1937,7 +2028,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1937
2028
|
<xsl:when test="$exercise-style = 'static'">
|
|
1938
2029
|
<xsl:copy>
|
|
1939
2030
|
<xsl:apply-templates select="@*" mode="webwork-rep-to-static"/>
|
|
1940
|
-
<xsl:attribute name="exercise-interactive">
|
|
2031
|
+
<xsl:attribute name="pi:exercise-interactive">
|
|
1941
2032
|
<xsl:text>static</xsl:text>
|
|
1942
2033
|
</xsl:attribute>
|
|
1943
2034
|
<xsl:apply-templates select="$exercise-with-reps/node()" mode="webwork-rep-to-static"/>
|
|
@@ -2184,11 +2275,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2184
2275
|
<!-- PreTeXt introduction and conclusion, into a "regular" PreTeXt -->
|
|
2185
2276
|
<!-- format, for any conversion to a static format to use. -->
|
|
2186
2277
|
<!-- NB: very similar to STACK template below -->
|
|
2187
|
-
<xsl:template match="exercise[(@exercise-interactive = 'myopenmath')]
|
|
2188
|
-
| project[(@exercise-interactive = 'myopenmath')]
|
|
2189
|
-
| activity[(@exercise-interactive = 'myopenmath')]
|
|
2190
|
-
| exploration[(@exercise-interactive = 'myopenmath')]
|
|
2191
|
-
| investigation[(@exercise-interactive = 'myopenmath')]" mode="representations">
|
|
2278
|
+
<xsl:template match="exercise[(@pi:exercise-interactive = 'myopenmath')]
|
|
2279
|
+
| project[(@pi:exercise-interactive = 'myopenmath')]
|
|
2280
|
+
| activity[(@pi:exercise-interactive = 'myopenmath')]
|
|
2281
|
+
| exploration[(@pi:exercise-interactive = 'myopenmath')]
|
|
2282
|
+
| investigation[(@pi:exercise-interactive = 'myopenmath')]" mode="representations">
|
|
2192
2283
|
<!-- duplicate the exercise/project -->
|
|
2193
2284
|
<xsl:copy>
|
|
2194
2285
|
<!-- and preserve attributes on the exercise/project -->
|
|
@@ -2197,7 +2288,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2197
2288
|
<xsl:choose>
|
|
2198
2289
|
<xsl:when test="($exercise-style = 'static') and not($b-extracting)">
|
|
2199
2290
|
<!-- overwrite classification as purely static now -->
|
|
2200
|
-
<xsl:attribute name="exercise-interactive">
|
|
2291
|
+
<xsl:attribute name="pi:exercise-interactive">
|
|
2201
2292
|
<xsl:text>static</xsl:text>
|
|
2202
2293
|
</xsl:attribute>
|
|
2203
2294
|
<!-- locate the static representation in a file, generated independently -->
|
|
@@ -2210,7 +2301,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2210
2301
|
<xsl:value-of select="myopenmath/@problem"/>
|
|
2211
2302
|
<xsl:text>.xml</xsl:text>
|
|
2212
2303
|
</xsl:variable>
|
|
2213
|
-
<!-- "myopenmath" child guaranteed by @exercise-interactive value -->
|
|
2304
|
+
<!-- "myopenmath" child guaranteed by @pi:exercise-interactive value -->
|
|
2214
2305
|
<xsl:variable name="mom-static-rep" select="document($filename, $original)/myopenmath"/>
|
|
2215
2306
|
<!-- duplicate metadata first -->
|
|
2216
2307
|
<xsl:apply-templates select="title|idx" mode="representations"/>
|
|
@@ -2244,11 +2335,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2244
2335
|
<!-- PreTeXt introduction and conclusion, into a "regular" PreTeXt -->
|
|
2245
2336
|
<!-- format, for any conversion to a static format to use. -->
|
|
2246
2337
|
<!-- NB: very similar to MyOpenMath template above -->
|
|
2247
|
-
<xsl:template match="exercise[(@exercise-interactive = 'stack')]
|
|
2248
|
-
| project[(@exercise-interactive = 'stack')]
|
|
2249
|
-
| activity[(@exercise-interactive = 'stack')]
|
|
2250
|
-
| exploration[(@exercise-interactive = 'stack')]
|
|
2251
|
-
| investigation[(@exercise-interactive = 'stack')]" mode="representations">
|
|
2338
|
+
<xsl:template match="exercise[(@pi:exercise-interactive = 'stack')]
|
|
2339
|
+
| project[(@pi:exercise-interactive = 'stack')]
|
|
2340
|
+
| activity[(@pi:exercise-interactive = 'stack')]
|
|
2341
|
+
| exploration[(@pi:exercise-interactive = 'stack')]
|
|
2342
|
+
| investigation[(@pi:exercise-interactive = 'stack')]" mode="representations">
|
|
2252
2343
|
<!-- duplicate the exercise/project -->
|
|
2253
2344
|
<xsl:copy>
|
|
2254
2345
|
<!-- and preserve attributes on the exercise/project -->
|
|
@@ -2257,7 +2348,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2257
2348
|
<xsl:choose>
|
|
2258
2349
|
<xsl:when test="($exercise-style = 'static') and not($b-extracting)">
|
|
2259
2350
|
<!-- overwrite classification as purely static now -->
|
|
2260
|
-
<xsl:attribute name="exercise-interactive">
|
|
2351
|
+
<xsl:attribute name="pi:exercise-interactive">
|
|
2261
2352
|
<xsl:text>static</xsl:text>
|
|
2262
2353
|
</xsl:attribute>
|
|
2263
2354
|
<!-- locate the static representation in a file, generated independently -->
|
|
@@ -2338,7 +2429,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2338
2429
|
<!-- Read pre-computed URLs from sidecar file -->
|
|
2339
2430
|
<!-- But not if doing an extraction -->
|
|
2340
2431
|
<xsl:variable name="url-file"
|
|
2341
|
-
select="document(concat($generated-directory-source, 'qrcode/', @assembly-id, '-url.xml'), $original)"/>
|
|
2432
|
+
select="document(concat($generated-directory-source, 'qrcode/', @pi:assembly-id, '-url.xml'), $original)"/>
|
|
2342
2433
|
<!-- panel widths are experimental -->
|
|
2343
2434
|
<sidebyside margins="7.5% 7.5%" widths="47% 21%" valign="top" halign="center">
|
|
2344
2435
|
<!-- copy over @xml:id, which may be in use by -->
|
|
@@ -2987,11 +3078,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2987
3078
|
</xsl:if>
|
|
2988
3079
|
</xsl:template>
|
|
2989
3080
|
|
|
2990
|
-
<!-- 2025-08-15: Ensure that interactives all have a @interactive-platform -->
|
|
2991
|
-
<!-- that identifies their basic type
|
|
3081
|
+
<!-- 2025-08-15: Ensure that interactives all have a @pi:interactive-platform -->
|
|
3082
|
+
<!-- that identifies their basic type -->
|
|
2992
3083
|
<xsl:template match="interactive" mode="repair">
|
|
2993
3084
|
<xsl:copy>
|
|
2994
|
-
<xsl:attribute name="interactive-platform">
|
|
3085
|
+
<xsl:attribute name="pi:interactive-platform">
|
|
2995
3086
|
<xsl:choose>
|
|
2996
3087
|
<xsl:when test="@platform">
|
|
2997
3088
|
<xsl:value-of select="@platform"/>
|
|
@@ -3357,6 +3448,14 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3357
3448
|
<!-- which have not been schema-compliant since circa 2017 -->
|
|
3358
3449
|
<xsl:template match="sidebyside/*[&METADATA-FILTER;]" mode="repair"/>
|
|
3359
3450
|
|
|
3451
|
+
<!-- 2026-07-08 "title" deprecated on "introduction"/"conclusion" of a traditional division -->
|
|
3452
|
+
|
|
3453
|
+
<!-- The title is dropped, silently; conversions provide a localized -->
|
|
3454
|
+
<!-- heading whenever a heading is called for. Titles remain within -->
|
|
3455
|
+
<!-- specialized divisions, which are never structured, and so are -->
|
|
3456
|
+
<!-- never summary pages (the situation that demands the heading) -->
|
|
3457
|
+
<xsl:template match="introduction[parent::article or parent::chapter or parent::appendix or parent::section or parent::subsection]/title|conclusion[parent::article or parent::chapter or parent::appendix or parent::section or parent::subsection]/title" mode="repair"/>
|
|
3458
|
+
|
|
3360
3459
|
<!-- ########## -->
|
|
3361
3460
|
<!-- Enrichment -->
|
|
3362
3461
|
<!-- ########## -->
|
|
@@ -3489,8 +3588,12 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3489
3588
|
<!-- done with attributes, copy the content -->
|
|
3490
3589
|
<xsl:apply-templates select="node()" mode="enrichment"/>
|
|
3491
3590
|
<slate>
|
|
3591
|
+
<!-- A manufactured "slate" carries a genuine @xml:id (not a -->
|
|
3592
|
+
<!-- pi: stamp): the interactive machinery locates slates by -->
|
|
3593
|
+
<!-- id, and the derived name keeps it stable and -->
|
|
3594
|
+
<!-- collision-free. -->
|
|
3492
3595
|
<xsl:attribute name="xml:id">
|
|
3493
|
-
<xsl:value-of select="@assembly-id"/>
|
|
3596
|
+
<xsl:value-of select="@pi:assembly-id"/>
|
|
3494
3597
|
<xsl:text>-ggb-slate</xsl:text>
|
|
3495
3598
|
</xsl:attribute>
|
|
3496
3599
|
<xsl:attribute name="surface">
|
|
@@ -3519,11 +3622,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3519
3622
|
<!-- The "labels" pass (pass 11). It promotes an authored -->
|
|
3520
3623
|
<!-- @xml:id to @label and records localization support. It is -->
|
|
3521
3624
|
<!-- deliberately separate from the id-attribute mechanism in -->
|
|
3522
|
-
<!-- "Identification": it runs after @assembly-id is stamped and
|
|
3523
|
-
<!-- before @unique-id, and the @label values created here are
|
|
3524
|
-
<!-- read by that final @unique-id stamp.
|
|
3625
|
+
<!-- "Identification": it runs after @pi:assembly-id is stamped and-->
|
|
3626
|
+
<!-- before @pi:unique-id, and the @label values created here are -->
|
|
3627
|
+
<!-- read by that final @pi:unique-id stamp. -->
|
|
3525
3628
|
|
|
3526
|
-
<!--
|
|
3629
|
+
<!-- Reader-facing identification switched to prefer @label, -->
|
|
3527
3630
|
<!-- rather than @xml:id (at 1779e6dbc84c6ecc). So to preserve -->
|
|
3528
3631
|
<!-- authored (crafted) identifier strings, we copy the old over -->
|
|
3529
3632
|
<!-- into the new. This preserves identifiers in output -->
|
|
@@ -3579,7 +3682,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3579
3682
|
<!-- So we drop an (empty) attribute as a boolean indicator. -->
|
|
3580
3683
|
<!-- This form will simplify checks later at "run-time". -->
|
|
3581
3684
|
<xsl:if test="@label">
|
|
3582
|
-
<xsl:attribute name="authored-label"/>
|
|
3685
|
+
<xsl:attribute name="pi:authored-label"/>
|
|
3583
3686
|
</xsl:if>
|
|
3584
3687
|
<!-- A supported @xml:lang is recorded in an internal attribute -->
|
|
3585
3688
|
<!-- for use by localizations. The root element is the -->
|
|
@@ -3589,7 +3692,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3589
3692
|
<!-- alone, as it might be relevant for future features. -->
|
|
3590
3693
|
<xsl:choose>
|
|
3591
3694
|
<xsl:when test="@xml:lang = $locales">
|
|
3592
|
-
<xsl:attribute name="locale-lang">
|
|
3695
|
+
<xsl:attribute name="pi:locale-lang">
|
|
3593
3696
|
<xsl:value-of select="@xml:lang"/>
|
|
3594
3697
|
</xsl:attribute>
|
|
3595
3698
|
</xsl:when>
|
|
@@ -3597,7 +3700,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3597
3700
|
<xsl:attribute name="xml:lang">
|
|
3598
3701
|
<xsl:text>en-US</xsl:text>
|
|
3599
3702
|
</xsl:attribute>
|
|
3600
|
-
<xsl:attribute name="locale-lang">
|
|
3703
|
+
<xsl:attribute name="pi:locale-lang">
|
|
3601
3704
|
<xsl:text>en-US</xsl:text>
|
|
3602
3705
|
</xsl:attribute>
|
|
3603
3706
|
</xsl:when>
|
|
@@ -3687,43 +3790,43 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3687
3790
|
<!-- Languages -->
|
|
3688
3791
|
<!-- ######### -->
|
|
3689
3792
|
|
|
3690
|
-
<!-- The variable $locales is a node-set of all the locales which have
|
|
3691
|
-
<!-- supported localization files. A comparison of an @xml:lang (string)
|
|
3692
|
-
<!-- with $locales (node-set) will be true if the attribute value is a
|
|
3693
|
-
<!-- string value of one of the nodes in the node-set. So it is easy to
|
|
3694
|
-
<!-- create a boolean value for localization support.
|
|
3695
|
-
<!-- The recording of language support in @locale-lang attributes is part -->
|
|
3696
|
-
<!-- of the "labels" pass, since both jobs are simple attribute additions
|
|
3697
|
-
<!-- and do not deserve separate passes through the entire source.
|
|
3793
|
+
<!-- The variable $locales is a node-set of all the locales which have -->
|
|
3794
|
+
<!-- supported localization files. A comparison of an @xml:lang (string) -->
|
|
3795
|
+
<!-- with $locales (node-set) will be true if the attribute value is a -->
|
|
3796
|
+
<!-- string value of one of the nodes in the node-set. So it is easy to -->
|
|
3797
|
+
<!-- create a boolean value for localization support. -->
|
|
3798
|
+
<!-- The recording of language support in @pi:locale-lang attributes is part -->
|
|
3799
|
+
<!-- of the "labels" pass, since both jobs are simple attribute additions -->
|
|
3800
|
+
<!-- and do not deserve separate passes through the entire source. -->
|
|
3698
3801
|
<xsl:variable name="locales" select="document('localizations/localizations.xml')/localizations/locale" />
|
|
3699
3802
|
|
|
3700
3803
|
<!-- ######### -->
|
|
3701
3804
|
<!-- Numbering -->
|
|
3702
3805
|
<!-- ######### -->
|
|
3703
3806
|
|
|
3704
|
-
<!-- We use the "augment" pass to compute, and add, partially naïve
|
|
3705
|
-
<!-- information about numbers of objects, to be interpreted later by
|
|
3706
|
-
<!-- templates in the "-common" stylesheet. By "naïve" we mean that
|
|
3707
|
-
<!-- these routines may depend on publisher variables (e.g. specification
|
|
3708
|
-
<!-- of roots of subtrees for serial numbers of blocks) but do not depend
|
|
3709
|
-
<!-- on subtlties of numbering (such as the structured/unstructured
|
|
3710
|
-
<!-- division dichotomy), which are addressed in the "-common" stylesheet.
|
|
3711
|
-
<!-- In this way, this information could be interpreted in new ways by
|
|
3712
|
-
<!-- additional conversions.
|
|
3713
|
-
<!--
|
|
3714
|
-
<!-- The manufactured @struct attribute is the (naïve) hierarchical number -->
|
|
3715
|
-
<!-- of the *container* of an element, known as the "structure number"
|
|
3716
|
-
<!-- of an element. The @serial attribute is the computed serial number -->
|
|
3717
|
-
<!-- of the element, known as the "serial number". Typically combining
|
|
3718
|
-
<!-- these two attributes forms teh number of an element. As many
|
|
3719
|
-
<!-- practical subtleties about these numbers is delayed until their
|
|
3720
|
-
<!-- interpretation by templates in the "-common" stylesheet.
|
|
3807
|
+
<!-- We use the "augment" pass to compute, and add, partially naïve -->
|
|
3808
|
+
<!-- information about numbers of objects, to be interpreted later by -->
|
|
3809
|
+
<!-- templates in the "-common" stylesheet. By "naïve" we mean that -->
|
|
3810
|
+
<!-- these routines may depend on publisher variables (e.g. specification -->
|
|
3811
|
+
<!-- of roots of subtrees for serial numbers of blocks) but do not depend -->
|
|
3812
|
+
<!-- on subtlties of numbering (such as the structured/unstructured -->
|
|
3813
|
+
<!-- division dichotomy), which are addressed in the "-common" stylesheet. -->
|
|
3814
|
+
<!-- In this way, this information could be interpreted in new ways by -->
|
|
3815
|
+
<!-- additional conversions. -->
|
|
3816
|
+
<!-- -->
|
|
3817
|
+
<!-- The manufactured @pi:struct attribute is the (naïve) hierarchical number -->
|
|
3818
|
+
<!-- of the *container* of an element, known as the "structure number" -->
|
|
3819
|
+
<!-- of an element. The @pi:serial attribute is the computed serial number -->
|
|
3820
|
+
<!-- of the element, known as the "serial number". Typically combining -->
|
|
3821
|
+
<!-- these two attributes forms teh number of an element. As many -->
|
|
3822
|
+
<!-- practical subtleties about these numbers is delayed until their -->
|
|
3823
|
+
<!-- interpretation by templates in the "-common" stylesheet. -->
|
|
3721
3824
|
|
|
3722
3825
|
<!-- For every type of division, everywhere, the "division-serial-number" -->
|
|
3723
3826
|
<!-- modal template will return a count of preceding peers at that level. -->
|
|
3724
|
-
<!-- The @struct attribute is the structure number of the *parent*
|
|
3827
|
+
<!-- The @pi:struct attribute is the structure number of the *parent* -->
|
|
3725
3828
|
<!-- (container), which seems odd here, but fits the general scheme better. -->
|
|
3726
|
-
<!-- The @level attribute is helpful, and trvislly to compute here.
|
|
3829
|
+
<!-- The @pi:level attribute is helpful, and trvislly to compute here. -->
|
|
3727
3830
|
<xsl:template match="part|chapter|appendix|section|subsection|subsubsection|exercises|solutions|reading-questions|references|glossary|worksheet|handout" mode="augment">
|
|
3728
3831
|
<xsl:param name="parent-struct"/>
|
|
3729
3832
|
<xsl:param name="level"/>
|
|
@@ -3749,7 +3852,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3749
3852
|
<!-- blocks inside them use the parent division's chain. -->
|
|
3750
3853
|
<!-- Specialized divisions are leaves of the division -->
|
|
3751
3854
|
<!-- tree, so this does not affect any descendant -->
|
|
3752
|
-
<!-- division's @struct.
|
|
3855
|
+
<!-- division's @pi:struct. -->
|
|
3753
3856
|
<xsl:when test="&SPECIALIZED-DIVISION-FILTER;">
|
|
3754
3857
|
<xsl:variable name="is-numbered">
|
|
3755
3858
|
<xsl:apply-templates select="." mode="is-specialized-own-number"/>
|
|
@@ -3788,20 +3891,20 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3788
3891
|
</xsl:choose>
|
|
3789
3892
|
</xsl:variable>
|
|
3790
3893
|
<xsl:copy>
|
|
3791
|
-
<xsl:attribute name="struct">
|
|
3894
|
+
<xsl:attribute name="pi:struct">
|
|
3792
3895
|
<xsl:value-of select="$parent-struct"/>
|
|
3793
3896
|
</xsl:attribute>
|
|
3794
|
-
<xsl:attribute name="serial">
|
|
3897
|
+
<xsl:attribute name="pi:serial">
|
|
3795
3898
|
<xsl:value-of select="$the-serial"/>
|
|
3796
3899
|
</xsl:attribute>
|
|
3797
|
-
<xsl:attribute name="level">
|
|
3900
|
+
<xsl:attribute name="pi:level">
|
|
3798
3901
|
<xsl:value-of select="$next-level"/>
|
|
3799
3902
|
</xsl:attribute>
|
|
3800
3903
|
<!-- Full structure chain including this division's -->
|
|
3801
3904
|
<!-- contribution. Decorative specialized divisions are -->
|
|
3802
3905
|
<!-- transparent (pass through parent's chain). Used by -->
|
|
3803
3906
|
<!-- block elements to compute their structure numbers. -->
|
|
3804
|
-
<xsl:attribute name="block-struct">
|
|
3907
|
+
<xsl:attribute name="pi:block-struct">
|
|
3805
3908
|
<xsl:value-of select="$new-struct"/>
|
|
3806
3909
|
</xsl:attribute>
|
|
3807
3910
|
<xsl:apply-templates select="node()|@*" mode="augment">
|
|
@@ -3817,7 +3920,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3817
3920
|
<!-- A level-0 numbering scheme counts continuously from the root. -->
|
|
3818
3921
|
<xsl:template match="book|article|slideshow|letter|memo" mode="augment">
|
|
3819
3922
|
<xsl:copy>
|
|
3820
|
-
<xsl:attribute name="level">
|
|
3923
|
+
<xsl:attribute name="pi:level">
|
|
3821
3924
|
<xsl:text>0</xsl:text>
|
|
3822
3925
|
</xsl:attribute>
|
|
3823
3926
|
<xsl:apply-templates select="node()|@*" mode="augment">
|
|
@@ -3850,7 +3953,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3850
3953
|
<!-- we only add a level (not necessary?) -->
|
|
3851
3954
|
<!-- and just pass along structure number -->
|
|
3852
3955
|
<xsl:copy>
|
|
3853
|
-
<xsl:attribute name="level">
|
|
3956
|
+
<xsl:attribute name="pi:level">
|
|
3854
3957
|
<xsl:value-of select="$next-level"/>
|
|
3855
3958
|
</xsl:attribute>
|
|
3856
3959
|
<xsl:apply-templates select="node()|@*" mode="augment">
|
|
@@ -3937,16 +4040,16 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3937
4040
|
</xsl:choose>
|
|
3938
4041
|
</xsl:variable>
|
|
3939
4042
|
<xsl:copy>
|
|
3940
|
-
<xsl:attribute name="ordered-list-level">
|
|
4043
|
+
<xsl:attribute name="pi:ordered-list-level">
|
|
3941
4044
|
<xsl:value-of select="$ordered-list-level"/>
|
|
3942
4045
|
</xsl:attribute>
|
|
3943
|
-
<xsl:attribute name="format-code">
|
|
4046
|
+
<xsl:attribute name="pi:format-code">
|
|
3944
4047
|
<xsl:value-of select="$format-code"/>
|
|
3945
4048
|
</xsl:attribute>
|
|
3946
|
-
<xsl:attribute name="marker-prefix">
|
|
4049
|
+
<xsl:attribute name="pi:marker-prefix">
|
|
3947
4050
|
<xsl:value-of select="$marker-prefix"/>
|
|
3948
4051
|
</xsl:attribute>
|
|
3949
|
-
<xsl:attribute name="marker-suffix">
|
|
4052
|
+
<xsl:attribute name="pi:marker-suffix">
|
|
3950
4053
|
<xsl:value-of select="$marker-suffix"/>
|
|
3951
4054
|
</xsl:attribute>
|
|
3952
4055
|
<xsl:apply-templates select="node()|@*" mode="augment">
|
|
@@ -3959,7 +4062,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3959
4062
|
<!-- Serial Stamp Pass -->
|
|
3960
4063
|
<!-- ##################### -->
|
|
3961
4064
|
|
|
3962
|
-
<!-- Stamps @serial during assembly, in one depth-first walk. Each
|
|
4065
|
+
<!-- Stamps @pi:serial during assembly, in one depth-first walk. Each-->
|
|
3963
4066
|
<!-- numbered family (equations and footnotes) is threaded as a -->
|
|
3964
4067
|
<!-- node-set: its items in the current counting scope, and each item -->
|
|
3965
4068
|
<!-- is stamped with its position in that node-set. How a scope is -->
|
|
@@ -3980,7 +4083,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3980
4083
|
<!-- in the current scope) and hands its children the "next" one, built -->
|
|
3981
4084
|
<!-- from the inherited node-set: -->
|
|
3982
4085
|
|
|
3983
|
-
<!-- $b-open = not($nodes) and ($b-terminal or @level >= LEVEL)
|
|
4086
|
+
<!-- $b-open = not($nodes) and ($b-terminal or @pi:level >= LEVEL) -->
|
|
3984
4087
|
<!-- $next = $nodes | self::*[$b-open]//ITEMS -->
|
|
3985
4088
|
|
|
3986
4089
|
<!-- This is three cases. Already in a scope ($nodes non-empty): $b-open -->
|
|
@@ -4012,14 +4115,19 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4012
4115
|
<xsl:param name="project-nodes"/>
|
|
4013
4116
|
<xsl:param name="exercise-nodes"/>
|
|
4014
4117
|
<xsl:param name="openproblem-nodes"/>
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
<xsl:variable name="b-
|
|
4021
|
-
<xsl:variable name="b-open-
|
|
4022
|
-
<xsl:variable name="b-open-
|
|
4118
|
+
<!-- terminal: holds content directly, so it has no child divisions of -->
|
|
4119
|
+
<!-- any kind. Specialized divisions ("worksheet", "handout", etc.) -->
|
|
4120
|
+
<!-- count here just like the traditional ones, else a division whose -->
|
|
4121
|
+
<!-- children are specialized divisions is wrongly deemed terminal and -->
|
|
4122
|
+
<!-- pools their blocks into one scope instead of one scope apiece. -->
|
|
4123
|
+
<xsl:variable name="b-terminal" select="not(part|chapter|appendix|section|subsection|subsubsection|preface|exercises|worksheet|handout|reading-questions|references|glossary|solutions)"/>
|
|
4124
|
+
<xsl:variable name="b-open-eq" select="not($eq-nodes) and ($b-terminal or (@pi:level >= $numbering-equations))"/>
|
|
4125
|
+
<xsl:variable name="b-open-fn" select="not($fn-nodes) and ($b-terminal or (@pi:level >= $numbering-footnotes))"/>
|
|
4126
|
+
<xsl:variable name="b-open-blocks" select="not($blocks-nodes) and ($b-terminal or (@pi:level >= $numbering-blocks))"/>
|
|
4127
|
+
<xsl:variable name="b-open-figure" select="$b-number-figure-distinct and not($figure-nodes) and ($b-terminal or (@pi:level >= $numbering-figures))"/>
|
|
4128
|
+
<xsl:variable name="b-open-project" select="$b-number-project-distinct and not($project-nodes) and ($b-terminal or (@pi:level >= $numbering-projects))"/>
|
|
4129
|
+
<xsl:variable name="b-open-exercise" select="$b-number-exercise-distinct and not($exercise-nodes) and ($b-terminal or (@pi:level >= $numbering-exercises))"/>
|
|
4130
|
+
<xsl:variable name="b-open-openproblem" select="$b-number-openproblem-distinct and not($openproblem-nodes) and ($b-terminal or (@pi:level >= $numbering-openproblems))"/>
|
|
4023
4131
|
<xsl:variable name="next-eq" select="$eq-nodes | self::*[$b-open-eq]//mrow[@pi:numbered = 'yes']"/>
|
|
4024
4132
|
<xsl:variable name="next-fn" select="$fn-nodes | self::*[$b-open-fn]//fn"/>
|
|
4025
4133
|
<!-- The shared "blocks" pool also gathers figure-likes, projects, -->
|
|
@@ -4087,8 +4195,8 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4087
4195
|
</xsl:copy>
|
|
4088
4196
|
</xsl:template>
|
|
4089
4197
|
|
|
4090
|
-
<!-- Numbered mrow. Stamp @serial with the position within the -->
|
|
4091
|
-
<!-- inherited node-set.
|
|
4198
|
+
<!-- Numbered mrow. Stamp @pi:serial with the position within the -->
|
|
4199
|
+
<!-- inherited node-set. -->
|
|
4092
4200
|
<xsl:template match="mrow[@pi:numbered = 'yes']" mode="serial-stamp">
|
|
4093
4201
|
<xsl:param name="eq-nodes"/>
|
|
4094
4202
|
<xsl:param name="fn-nodes"/>
|
|
@@ -4098,7 +4206,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4098
4206
|
<xsl:param name="exercise-nodes"/>
|
|
4099
4207
|
<xsl:param name="openproblem-nodes"/>
|
|
4100
4208
|
<xsl:copy>
|
|
4101
|
-
<xsl:attribute name="serial">
|
|
4209
|
+
<xsl:attribute name="pi:serial">
|
|
4102
4210
|
<xsl:apply-templates select="." mode="position-in-node-set">
|
|
4103
4211
|
<xsl:with-param name="nodes" select="$eq-nodes"/>
|
|
4104
4212
|
</xsl:apply-templates>
|
|
@@ -4115,8 +4223,8 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4115
4223
|
</xsl:copy>
|
|
4116
4224
|
</xsl:template>
|
|
4117
4225
|
|
|
4118
|
-
<!-- Every fn is numbered. Stamp @serial with the position -->
|
|
4119
|
-
<!-- within the inherited footnote node-set.
|
|
4226
|
+
<!-- Every fn is numbered. Stamp @pi:serial with the position -->
|
|
4227
|
+
<!-- within the inherited footnote node-set. -->
|
|
4120
4228
|
<xsl:template match="fn" mode="serial-stamp">
|
|
4121
4229
|
<xsl:param name="eq-nodes"/>
|
|
4122
4230
|
<xsl:param name="fn-nodes"/>
|
|
@@ -4126,7 +4234,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4126
4234
|
<xsl:param name="exercise-nodes"/>
|
|
4127
4235
|
<xsl:param name="openproblem-nodes"/>
|
|
4128
4236
|
<xsl:copy>
|
|
4129
|
-
<xsl:attribute name="serial">
|
|
4237
|
+
<xsl:attribute name="pi:serial">
|
|
4130
4238
|
<xsl:apply-templates select="." mode="position-in-node-set">
|
|
4131
4239
|
<xsl:with-param name="nodes" select="$fn-nodes"/>
|
|
4132
4240
|
</xsl:apply-templates>
|
|
@@ -4145,7 +4253,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4145
4253
|
|
|
4146
4254
|
<!-- Block stamps: serial from the group's distinct counter, else the shared "blocks". -->
|
|
4147
4255
|
<!-- A subnumbered side-by-side panel is not a "top" figure, so it falls to the -->
|
|
4148
|
-
<!-- catch-all (no @serial) and earns a letter downstream instead.
|
|
4256
|
+
<!-- catch-all (no @pi:serial) and earns a letter downstream instead. -->
|
|
4149
4257
|
|
|
4150
4258
|
<!-- Fundamental blocks always share the "blocks" counter. -->
|
|
4151
4259
|
<xsl:template match="&DEFINITION-LIKE;|&THEOREM-LIKE;|&AXIOM-LIKE;|&REMARK-LIKE;|&COMPUTATION-LIKE;|&EXAMPLE-LIKE;" mode="serial-stamp">
|
|
@@ -4157,7 +4265,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4157
4265
|
<xsl:param name="exercise-nodes"/>
|
|
4158
4266
|
<xsl:param name="openproblem-nodes"/>
|
|
4159
4267
|
<xsl:copy>
|
|
4160
|
-
<xsl:attribute name="serial">
|
|
4268
|
+
<xsl:attribute name="pi:serial">
|
|
4161
4269
|
<xsl:apply-templates select="." mode="position-in-node-set">
|
|
4162
4270
|
<xsl:with-param name="nodes" select="$blocks-nodes"/>
|
|
4163
4271
|
</xsl:apply-templates>
|
|
@@ -4184,7 +4292,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4184
4292
|
<xsl:param name="exercise-nodes"/>
|
|
4185
4293
|
<xsl:param name="openproblem-nodes"/>
|
|
4186
4294
|
<xsl:copy>
|
|
4187
|
-
<xsl:attribute name="serial">
|
|
4295
|
+
<xsl:attribute name="pi:serial">
|
|
4188
4296
|
<xsl:apply-templates select="." mode="position-in-node-set">
|
|
4189
4297
|
<xsl:with-param name="nodes" select="$project-nodes[$b-number-project-distinct] | $blocks-nodes[not($b-number-project-distinct)]"/>
|
|
4190
4298
|
</xsl:apply-templates>
|
|
@@ -4211,7 +4319,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4211
4319
|
<xsl:param name="exercise-nodes"/>
|
|
4212
4320
|
<xsl:param name="openproblem-nodes"/>
|
|
4213
4321
|
<xsl:copy>
|
|
4214
|
-
<xsl:attribute name="serial">
|
|
4322
|
+
<xsl:attribute name="pi:serial">
|
|
4215
4323
|
<xsl:apply-templates select="." mode="position-in-node-set">
|
|
4216
4324
|
<xsl:with-param name="nodes" select="$figure-nodes[$b-number-figure-distinct] | $blocks-nodes[not($b-number-figure-distinct)]"/>
|
|
4217
4325
|
</xsl:apply-templates>
|
|
@@ -4238,7 +4346,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4238
4346
|
<xsl:param name="exercise-nodes"/>
|
|
4239
4347
|
<xsl:param name="openproblem-nodes"/>
|
|
4240
4348
|
<xsl:copy>
|
|
4241
|
-
<xsl:attribute name="serial">
|
|
4349
|
+
<xsl:attribute name="pi:serial">
|
|
4242
4350
|
<xsl:apply-templates select="." mode="position-in-node-set">
|
|
4243
4351
|
<xsl:with-param name="nodes" select="$exercise-nodes[$b-number-exercise-distinct] | $blocks-nodes[not($b-number-exercise-distinct)]"/>
|
|
4244
4352
|
</xsl:apply-templates>
|
|
@@ -4265,7 +4373,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4265
4373
|
<xsl:param name="exercise-nodes"/>
|
|
4266
4374
|
<xsl:param name="openproblem-nodes"/>
|
|
4267
4375
|
<xsl:copy>
|
|
4268
|
-
<xsl:attribute name="serial">
|
|
4376
|
+
<xsl:attribute name="pi:serial">
|
|
4269
4377
|
<xsl:apply-templates select="." mode="position-in-node-set">
|
|
4270
4378
|
<xsl:with-param name="nodes" select="$openproblem-nodes[$b-number-openproblem-distinct] | $blocks-nodes[not($b-number-openproblem-distinct)]"/>
|
|
4271
4379
|
</xsl:apply-templates>
|
|
@@ -4473,8 +4581,8 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4473
4581
|
<!-- ########### -->
|
|
4474
4582
|
|
|
4475
4583
|
<!-- Some maniulations of source require stable identification *before* -->
|
|
4476
|
-
<!-- we assign @unique-id values for general use in the very late
|
|
4477
|
-
<!-- "identification" phase. This is a role for the "@assembly-id" which
|
|
4584
|
+
<!-- we assign @pi:unique-id values for general use in the very late -->
|
|
4585
|
+
<!-- "identification" phase. This is a role for the "@pi:assembly-id" which-->
|
|
4478
4586
|
<!-- is formed after the author's source has been versioned, customized, -->
|
|
4479
4587
|
<!-- repaired, but before replacements. It should suffice for "big" objects -->
|
|
4480
4588
|
<!-- which are unlikely to change much (other than going away in a version) -->
|
|
@@ -4499,16 +4607,16 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4499
4607
|
<!-- order to make a sample of its content. This happens before we -->
|
|
4500
4608
|
<!-- construct unique-id. -->
|
|
4501
4609
|
|
|
4502
|
-
<!-- NB: we believe the @assembly-id will equal the @unique-id
|
|
4503
|
-
<!-- ("
|
|
4504
|
-
<!-- and certainly for any object replaced by a different static
|
|
4505
|
-
<!-- representation. But for generated objects, e.g. QR codes,
|
|
4506
|
-
<!-- it would be best if the generation process used the
|
|
4507
|
-
<!-- "assembly-id" template for guranteed consistency. This *is*
|
|
4508
|
-
<!-- being done for "datafile" but is technical debt otherwise.
|
|
4610
|
+
<!-- NB: we believe the @pi:assembly-id will equal the @pi:unique-id -->
|
|
4611
|
+
<!-- ("unique-id" template) for objects at the level of blocks, -->
|
|
4612
|
+
<!-- and certainly for any object replaced by a different static -->
|
|
4613
|
+
<!-- representation. But for generated objects, e.g. QR codes, -->
|
|
4614
|
+
<!-- it would be best if the generation process used the -->
|
|
4615
|
+
<!-- "assembly-id" template for guranteed consistency. This *is* -->
|
|
4616
|
+
<!-- being done for "datafile" but is technical debt otherwise. -->
|
|
4509
4617
|
|
|
4510
|
-
<!-- [Ed. this once prefaced
|
|
4511
|
-
<!--
|
|
4618
|
+
<!-- [Ed. this once prefaced an early, weak forerunner of the -->
|
|
4619
|
+
<!-- "assembly-id" template. But the commentary -->
|
|
4512
4620
|
<!-- is still good, so we have preserved it here.] -->
|
|
4513
4621
|
<!-- This template produces identification that happens early in the -->
|
|
4514
4622
|
<!-- passes this stylesheet executes. The idea is that some elements -->
|
|
@@ -4521,44 +4629,32 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4521
4629
|
<!-- we want the stylesheet to be independent, and the template is -->
|
|
4522
4630
|
<!-- also applied here. -->
|
|
4523
4631
|
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
|
4538
|
-
|
|
|
4539
|
-
|
|
|
4540
|
-
|
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
|
4549
|
-
|
|
4550
|
-
| exploration//task[@exercise-interactive='fillin' and setup]
|
|
4551
|
-
| investigation//task[@exercise-interactive='fillin' and setup]"
|
|
4552
|
-
mode="assembly-id">
|
|
4553
|
-
<xsl:value-of select="@assembly-id"/>
|
|
4554
|
-
</xsl:template>
|
|
4555
|
-
|
|
4556
|
-
<xsl:template match="datafile" mode="assembly-id">
|
|
4557
|
-
<xsl:value-of select="@assembly-id"/>
|
|
4558
|
-
</xsl:template>
|
|
4559
|
-
|
|
4560
|
-
<xsl:template match="exercise/stack" mode="assembly-id">
|
|
4561
|
-
<xsl:value-of select="@assembly-id"/>
|
|
4632
|
+
<!-- Every element carrying an "@pi:assembly-id" stamp reports it -->
|
|
4633
|
+
<!-- through this single template. The match list is deliberately -->
|
|
4634
|
+
<!-- explicit — media and images, data files, STACK problems, and -->
|
|
4635
|
+
<!-- the fill-in dynamic-substitution owners (the exercise-like -->
|
|
4636
|
+
<!-- elements, or a "task" they contain, whichever holds "setup") -->
|
|
4637
|
+
<!-- — so the BUG fallback below can catch an unexpected -->
|
|
4638
|
+
<!-- application. -->
|
|
4639
|
+
<xsl:template match="audio|video|interactive|image
|
|
4640
|
+
| datafile
|
|
4641
|
+
| exercise/stack
|
|
4642
|
+
| exercise[@pi:exercise-interactive='fillin' and setup]
|
|
4643
|
+
| project[@pi:exercise-interactive='fillin' and setup]
|
|
4644
|
+
| activity[@pi:exercise-interactive='fillin' and setup]
|
|
4645
|
+
| exploration[@pi:exercise-interactive='fillin' and setup]
|
|
4646
|
+
| investigation[@pi:exercise-interactive='fillin' and setup]
|
|
4647
|
+
| exercise[.//task and .//task/@pi:exercise-interactive='fillin' and .//setup]
|
|
4648
|
+
| project[.//task and .//task/@pi:exercise-interactive='fillin' and .//setup]
|
|
4649
|
+
| activity[.//task and .//task/@pi:exercise-interactive='fillin' and .//setup]
|
|
4650
|
+
| exploration[.//task and .//task/@pi:exercise-interactive='fillin' and .//setup]
|
|
4651
|
+
| investigation[.//task and .//task/@pi:exercise-interactive='fillin' and .//setup]
|
|
4652
|
+
| exercise//task[@pi:exercise-interactive='fillin' and setup]
|
|
4653
|
+
| project//task[@pi:exercise-interactive='fillin' and setup]
|
|
4654
|
+
| activity//task[@pi:exercise-interactive='fillin' and setup]
|
|
4655
|
+
| exploration//task[@pi:exercise-interactive='fillin' and setup]
|
|
4656
|
+
| investigation//task[@pi:exercise-interactive='fillin' and setup]" mode="assembly-id">
|
|
4657
|
+
<xsl:value-of select="@pi:assembly-id"/>
|
|
4562
4658
|
</xsl:template>
|
|
4563
4659
|
|
|
4564
4660
|
<xsl:template match="*" mode="assembly-id">
|
|
@@ -4566,9 +4662,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4566
4662
|
<xsl:text>PTX:BUG: the "assembly-id" template was applied to an element it did not expect--</xsl:text>
|
|
4567
4663
|
<xsl:value-of select="name()"/>
|
|
4568
4664
|
<xsl:text>.</xsl:text>
|
|
4569
|
-
<xsl:value-of select="@exercise-interactive"/>
|
|
4665
|
+
<xsl:value-of select="@pi:exercise-interactive"/>
|
|
4570
4666
|
<xsl:text>.</xsl:text>
|
|
4571
|
-
<xsl:value-of select="@assembly-id"/>
|
|
4667
|
+
<xsl:value-of select="@pi:assembly-id"/>
|
|
4572
4668
|
</xsl:message>
|
|
4573
4669
|
<xsl:text>unexpected-assembly-id-template-use-here</xsl:text>
|
|
4574
4670
|
</xsl:template>
|
|
@@ -4612,28 +4708,28 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4612
4708
|
<xsl:text>.html</xsl:text>
|
|
4613
4709
|
</xsl:template>
|
|
4614
4710
|
|
|
4615
|
-
<xsl:template match="exercise[@exercise-interactive='fillin' and setup]
|
|
4616
|
-
| project[@exercise-interactive='fillin' and setup]
|
|
4617
|
-
| activity[@exercise-interactive='fillin' and setup]
|
|
4618
|
-
| exploration[@exercise-interactive='fillin' and setup]
|
|
4619
|
-
| investigation[@exercise-interactive='fillin' and setup]"
|
|
4711
|
+
<xsl:template match="exercise[@pi:exercise-interactive='fillin' and setup]
|
|
4712
|
+
| project[@pi:exercise-interactive='fillin' and setup]
|
|
4713
|
+
| activity[@pi:exercise-interactive='fillin' and setup]
|
|
4714
|
+
| exploration[@pi:exercise-interactive='fillin' and setup]
|
|
4715
|
+
| investigation[@pi:exercise-interactive='fillin' and setup]"
|
|
4620
4716
|
mode="standalone-filename">
|
|
4621
4717
|
<xsl:apply-templates select="." mode="assembly-id" />
|
|
4622
4718
|
<xsl:text>.html</xsl:text>
|
|
4623
4719
|
</xsl:template>
|
|
4624
4720
|
|
|
4625
|
-
<xsl:template match="exercise[.//task/@exercise-interactive='fillin' and .//task/setup]
|
|
4626
|
-
| project[.//task/@exercise-interactive='fillin' and .//task/setup]
|
|
4627
|
-
| activity[.//task/@exercise-interactive='fillin' and .//task/setup]
|
|
4628
|
-
| exploration[.//task/@exercise-interactive='fillin' and .//task/setup]
|
|
4629
|
-
| investigation[.//task/@exercise-interactive='fillin' and .//task/setup]"
|
|
4721
|
+
<xsl:template match="exercise[.//task/@pi:exercise-interactive='fillin' and .//task/setup]
|
|
4722
|
+
| project[.//task/@pi:exercise-interactive='fillin' and .//task/setup]
|
|
4723
|
+
| activity[.//task/@pi:exercise-interactive='fillin' and .//task/setup]
|
|
4724
|
+
| exploration[.//task/@pi:exercise-interactive='fillin' and .//task/setup]
|
|
4725
|
+
| investigation[.//task/@pi:exercise-interactive='fillin' and .//task/setup]"
|
|
4630
4726
|
mode="standalone-filename">
|
|
4631
4727
|
<xsl:apply-templates select="." mode="assembly-id" />
|
|
4632
4728
|
<xsl:text>.html</xsl:text>
|
|
4633
4729
|
</xsl:template>
|
|
4634
4730
|
|
|
4635
4731
|
<xsl:template match="*" mode="standalone-filename">
|
|
4636
|
-
<xsl:apply-templates select="." mode="
|
|
4732
|
+
<xsl:apply-templates select="." mode="unique-id" />
|
|
4637
4733
|
<xsl:text>-ERROR-no-standalone-filename.html</xsl:text>
|
|
4638
4734
|
</xsl:template>
|
|
4639
4735
|
|
|
@@ -4683,20 +4779,19 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4683
4779
|
<!-- Natural override for YouTube videos -->
|
|
4684
4780
|
<!-- Better - standalone page, with "View on You Tube" -->
|
|
4685
4781
|
|
|
4686
|
-
<!-- NB:
|
|
4687
|
-
<!--
|
|
4688
|
-
<!--
|
|
4689
|
-
<!--
|
|
4690
|
-
<!-- used and the ampersand is handled correctly? -->
|
|
4782
|
+
<!-- NB: this is a genuine URL, with no escaping: consumers apply -->
|
|
4783
|
+
<!-- their own (the LaTeX conversion escapes the ampersand for its -->
|
|
4784
|
+
<!-- "\href", HTML-derived conversions use it as-is, and the QR code -->
|
|
4785
|
+
<!-- generator must encode exactly what a phone's camera should see). -->
|
|
4691
4786
|
|
|
4692
4787
|
<xsl:template match="video[@youtube|@youtubeplaylist]" mode="static-url">
|
|
4693
4788
|
<xsl:apply-templates select="." mode="youtube-view-url" />
|
|
4694
4789
|
<xsl:if test="@start">
|
|
4695
|
-
<xsl:text
|
|
4790
|
+
<xsl:text>&start=</xsl:text>
|
|
4696
4791
|
<xsl:value-of select="@start" />
|
|
4697
4792
|
</xsl:if>
|
|
4698
4793
|
<xsl:if test="@end">
|
|
4699
|
-
<xsl:text
|
|
4794
|
+
<xsl:text>&end=</xsl:text>
|
|
4700
4795
|
<xsl:value-of select="@end" />
|
|
4701
4796
|
</xsl:if>
|
|
4702
4797
|
</xsl:template>
|