Spaces:
Sleeping
Cleaner study-guide output: drop redundant per-section key-term list
Browse filesUser feedback: with inline term highlighting AND a bottom glossary,
showing the same vocabulary again as a per-section <dl class="key-term">
was triple-redundant and visually noisy.
- Drop the per-section <dl class="key-term"> from guide.html.
Definitions remain accessible two ways:
- inline via the .kt highlighter (hover tooltip on the first
occurrence in each paragraph)
- at the end of the document via the auto-built glossary
(alphabetised, back-anchored to source section).
- Mirror in buildFinalHTML so downloaded HTML matches.
- Update test_render_guide_renders_key_terms_and_equations to
expect the glossary instead of the per-section list.
Also cleaned up two other visually-noisy bits while in the same file:
- Figure's "Lecture slide." caption: redundant with the section
heading + meta-time line and the figure-internal timestamp
badge. Now we only emit a figcaption when there's something
real to say ("Alt-text needs author review" while a draft).
- "Narration" label heading: obvious from layout. Replaced with
a visually-hidden <h3 class="sr-only"> so the section landmark
still exists for assistive tech.
- Self-check hint paragraph: trimmed from two sentences to one.
"Answer each in your own words before checking back β
retrieval practice beats re-reading."
- Footer: collapsed two paragraphs into one.
"Generated by VideoGuideMaker. Targets WCAG 2.2 Level AA."
Mirror edits in the review (editor) template so the editor view
stays WYSIWYG with the rendered output.
- app/templates/guide.html +22 -15
- app/templates/review.html +13 -17
- tests/test_html_gen.py +10 -2
|
@@ -78,10 +78,16 @@
|
|
| 78 |
{% else %}
|
| 79 |
<img src="{{ image_dir }}/{{ seg.image_filename }}" alt="{{ seg.alt_draft }}"{{ draft_attr|safe }} loading="lazy">
|
| 80 |
{% endif %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
<figcaption>
|
| 82 |
<span class="figure__timestamp" aria-hidden="true">{{ seg.start_seconds | timestamp }}</span>
|
| 83 |
-
|
| 84 |
</figcaption>
|
|
|
|
| 85 |
</figure>
|
| 86 |
|
| 87 |
{% if seg.ocr_text %}
|
|
@@ -104,23 +110,25 @@
|
|
| 104 |
aria-describedby="narration-{{ seg.index }}"></audio>
|
| 105 |
{% endif %}
|
| 106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
{% if seg.narration %}
|
| 108 |
-
<div class="narration"
|
| 109 |
-
<
|
| 110 |
-
<div class="narration__body" id="narration-{{ seg.index }}"
|
|
|
|
| 111 |
{% for para in seg.narration %}<p>{{ para|highlight_terms(seg.key_terms)|safe }}</p>{% endfor %}
|
| 112 |
</div>
|
| 113 |
</div>
|
| 114 |
{% endif %}
|
| 115 |
|
| 116 |
-
{
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
{% endfor %}
|
| 122 |
-
</dl>
|
| 123 |
-
{% endif %}
|
| 124 |
|
| 125 |
{% for eq in seg.math_equations %}
|
| 126 |
{# MathJax (assistiveMml: true) injects accessible MathML inside the
|
|
@@ -144,7 +152,7 @@
|
|
| 144 |
<li>{{ question }}</li>
|
| 145 |
{% endfor %}
|
| 146 |
</ol>
|
| 147 |
-
<p class="self-check__hint">
|
| 148 |
</details>
|
| 149 |
{% endif %}
|
| 150 |
</section>
|
|
@@ -173,8 +181,7 @@
|
|
| 173 |
</main>
|
| 174 |
|
| 175 |
<footer class="doc-footer" role="contentinfo">
|
| 176 |
-
<p>Generated by VideoGuideMaker.
|
| 177 |
-
<p><strong>Accessibility:</strong> This document targets WCAG 2.2 Level AA. Review draft alt-text before publishing.</p>
|
| 178 |
</footer>
|
| 179 |
</body>
|
| 180 |
</html>
|
|
|
|
| 78 |
{% else %}
|
| 79 |
<img src="{{ image_dir }}/{{ seg.image_filename }}" alt="{{ seg.alt_draft }}"{{ draft_attr|safe }} loading="lazy">
|
| 80 |
{% endif %}
|
| 81 |
+
{# Only emit a figcaption when there's something meaningful to say
|
| 82 |
+
β currently just the alt-text-needs-review note. The slide's
|
| 83 |
+
timestamp is already in the section's meta-time line above, so
|
| 84 |
+
a generic "Lecture slide" caption is just visual noise. #}
|
| 85 |
+
{% if not seg.alt_text_reviewed %}
|
| 86 |
<figcaption>
|
| 87 |
<span class="figure__timestamp" aria-hidden="true">{{ seg.start_seconds | timestamp }}</span>
|
| 88 |
+
Alt-text needs author review.
|
| 89 |
</figcaption>
|
| 90 |
+
{% endif %}
|
| 91 |
</figure>
|
| 92 |
|
| 93 |
{% if seg.ocr_text %}
|
|
|
|
| 110 |
aria-describedby="narration-{{ seg.index }}"></audio>
|
| 111 |
{% endif %}
|
| 112 |
|
| 113 |
+
{# Narration paragraph(s). The visual "Narration" label is dropped;
|
| 114 |
+
the block is obviously the narration from its position +
|
| 115 |
+
typography. A visually-hidden header preserves the section
|
| 116 |
+
landmark for assistive tech. #}
|
| 117 |
{% if seg.narration %}
|
| 118 |
+
<div class="narration">
|
| 119 |
+
<h3 class="sr-only" id="narration-label-{{ seg.index }}">Narration</h3>
|
| 120 |
+
<div class="narration__body" id="narration-{{ seg.index }}"
|
| 121 |
+
aria-labelledby="narration-label-{{ seg.index }}">
|
| 122 |
{% for para in seg.narration %}<p>{{ para|highlight_terms(seg.key_terms)|safe }}</p>{% endfor %}
|
| 123 |
</div>
|
| 124 |
</div>
|
| 125 |
{% endif %}
|
| 126 |
|
| 127 |
+
{# Per-section key-term list intentionally omitted from the final
|
| 128 |
+
guide β definitions are surfaced inline via the highlighter
|
| 129 |
+
(hover tooltips on each first occurrence) and collected at the
|
| 130 |
+
end of the document in the auto-built glossary. Showing the same
|
| 131 |
+
data three times was noisy without adding utility. #}
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
{% for eq in seg.math_equations %}
|
| 134 |
{# MathJax (assistiveMml: true) injects accessible MathML inside the
|
|
|
|
| 152 |
<li>{{ question }}</li>
|
| 153 |
{% endfor %}
|
| 154 |
</ol>
|
| 155 |
+
<p class="self-check__hint">Answer each in your own words before checking back β retrieval practice beats re-reading.</p>
|
| 156 |
</details>
|
| 157 |
{% endif %}
|
| 158 |
</section>
|
|
|
|
| 181 |
</main>
|
| 182 |
|
| 183 |
<footer class="doc-footer" role="contentinfo">
|
| 184 |
+
<p>Generated by VideoGuideMaker. Targets WCAG 2.2 Level AA.</p>
|
|
|
|
| 185 |
</footer>
|
| 186 |
</body>
|
| 187 |
</html>
|
|
@@ -310,10 +310,12 @@
|
|
| 310 |
data-bind="image"
|
| 311 |
data-image-filename="{{ seg.image_filename }}"
|
| 312 |
loading="lazy">
|
|
|
|
| 313 |
<figcaption>
|
| 314 |
<span class="figure__timestamp" aria-hidden="true">{{ seg.start_seconds | timestamp }}</span>
|
| 315 |
-
|
| 316 |
</figcaption>
|
|
|
|
| 317 |
</figure>
|
| 318 |
<details class="onscreen-text">
|
| 319 |
<summary>On-screen text from video</summary>
|
|
@@ -335,9 +337,10 @@
|
|
| 335 |
aria-label="{{ audio_label }}"></audio>
|
| 336 |
{% endif %}
|
| 337 |
|
| 338 |
-
<div class="narration"
|
| 339 |
-
<
|
| 340 |
-
<div class="narration__body" contenteditable="true" data-bind="narration" spellcheck="true"
|
|
|
|
| 341 |
{% for para in seg.narration %}<p>{{ para }}</p>{% endfor %}
|
| 342 |
</div>
|
| 343 |
</div>
|
|
@@ -910,19 +913,12 @@
|
|
| 910 |
});
|
| 911 |
}
|
| 912 |
|
| 913 |
-
|
| 914 |
-
|
| 915 |
-
|
| 916 |
-
|
| 917 |
-
|
| 918 |
-
|
| 919 |
-
const dd = doc.createElement('dd');
|
| 920 |
-
dd.textContent = kt.definition;
|
| 921 |
-
dl.appendChild(dt);
|
| 922 |
-
dl.appendChild(dd);
|
| 923 |
-
});
|
| 924 |
-
section.appendChild(dl);
|
| 925 |
-
}
|
| 926 |
if (segState.math_equations && segState.math_equations.length) {
|
| 927 |
needsMathJax = true;
|
| 928 |
segState.math_equations.forEach(eq => {
|
|
|
|
| 310 |
data-bind="image"
|
| 311 |
data-image-filename="{{ seg.image_filename }}"
|
| 312 |
loading="lazy">
|
| 313 |
+
{% if not seg.alt_text_reviewed %}
|
| 314 |
<figcaption>
|
| 315 |
<span class="figure__timestamp" aria-hidden="true">{{ seg.start_seconds | timestamp }}</span>
|
| 316 |
+
Alt-text needs author review.
|
| 317 |
</figcaption>
|
| 318 |
+
{% endif %}
|
| 319 |
</figure>
|
| 320 |
<details class="onscreen-text">
|
| 321 |
<summary>On-screen text from video</summary>
|
|
|
|
| 337 |
aria-label="{{ audio_label }}"></audio>
|
| 338 |
{% endif %}
|
| 339 |
|
| 340 |
+
<div class="narration">
|
| 341 |
+
<h3 class="sr-only" id="narration-label-{{ seg.index }}">Narration</h3>
|
| 342 |
+
<div class="narration__body" contenteditable="true" data-bind="narration" spellcheck="true"
|
| 343 |
+
aria-labelledby="narration-label-{{ seg.index }}">
|
| 344 |
{% for para in seg.narration %}<p>{{ para }}</p>{% endfor %}
|
| 345 |
</div>
|
| 346 |
</div>
|
|
|
|
| 913 |
});
|
| 914 |
}
|
| 915 |
|
| 916 |
+
// Per-section key-term <dl> intentionally omitted from the
|
| 917 |
+
// final guide β definitions are surfaced inline via the
|
| 918 |
+
// narration highlighter (hover tooltips) and collected in the
|
| 919 |
+
// glossary at the end of the document. Showing the same data
|
| 920 |
+
// three times was noisy without adding utility.
|
| 921 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 922 |
if (segState.math_equations && segState.math_equations.length) {
|
| 923 |
needsMathJax = true;
|
| 924 |
segState.math_equations.forEach(eq => {
|
|
@@ -293,9 +293,17 @@ def test_render_guide_renders_key_terms_and_equations(tmp_path):
|
|
| 293 |
include=True,
|
| 294 |
)
|
| 295 |
html = render_guide("Phys", [seg])
|
| 296 |
-
|
| 297 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
assert "A particle of light." in html
|
|
|
|
| 299 |
# The wrapper <figure> is structural only; MathJax's assistiveMml output
|
| 300 |
# is the proper accessible name. Wrapper aria-label / role="math" used
|
| 301 |
# to override that β we deliberately drop them.
|
|
|
|
| 293 |
include=True,
|
| 294 |
)
|
| 295 |
html = render_guide("Phys", [seg])
|
| 296 |
+
# Per-section <dl class="key-term"> was removed β definitions are
|
| 297 |
+
# now surfaced inline via the highlighter and collected in the
|
| 298 |
+
# bottom glossary. So this paragraph has no per-section dl, but
|
| 299 |
+
# the glossary at the end carries the term + definition.
|
| 300 |
+
assert '<dl class="key-term">' not in html
|
| 301 |
+
# The term lives in the bottom glossary now, with a stable id for
|
| 302 |
+
# back-anchoring from the section where it first appeared.
|
| 303 |
+
assert 'id="glossary' in html
|
| 304 |
+
assert ">Photon</dt>" in html
|
| 305 |
assert "A particle of light." in html
|
| 306 |
+
assert 'class="narration__body"' in html
|
| 307 |
# The wrapper <figure> is structural only; MathJax's assistiveMml output
|
| 308 |
# is the proper accessible name. Wrapper aria-label / role="math" used
|
| 309 |
# to override that β we deliberately drop them.
|