Skip to content

<astl-gap>

A gap in running text: the student types a word or a number.

Generated from packages/components/src/gap/: the manifest, the message catalogs, the editor descriptor and the fixtures.

Property Value
Tag <astl-gap>
Display inline: sits inside text
Graded yes
Slot kinds text, number (what they mean)
Element version (v) 1
Message namespace astl.gap
Editor label Gap

The fixture gap-basic, played with the English UI and graded in the browser. Try it, then press "Check".

Warm-up

The capital of France is .

A young cat is called a kitty.

Short for do not: .

Table salt, exactly as chemists write it: .

<astl-doc lang="en">
<h2>Warm-up</h2>
<p>The capital of France is <astl-gap id="capital" answer="Paris"></astl-gap>.</p>
<p>A young cat is called a <astl-gap id="young-cat" answer="kitten"><astl-alt>kitty</astl-alt></astl-gap>.</p>
<p>Short for <em>do not</em>: <astl-gap id="short" answer="don't"></astl-gap>.</p>
<p>Table salt, exactly as chemists write it: <astl-gap id="salt" answer="NaCl" case="sensitive"></astl-gap>.</p>
</astl-doc>

Visibility: public attributes stay in the view, private ones exist only in the answer key (students never get them), derived ones are written by the compiler.

Attribute Meaning
id
public, required
id
Source id, unique in the document. Views carry an opaque id instead. Common to all components.
v
public
integer: >= 1
Element format version. Optional in sources (absent = 1); the compiler always writes the current one. Common to all components.
style-template
public
string
A look by name, from the style templates the host registers (the component scope); it wins over the document's. More: Looks. Common to all components.
scoring
private
scoring mode: all
default all
One of the manifest's scoring modes; absent = the manifest's default mode. Common to graded components.
points
private
number: 0.01 to 1000
default 1
Points of the element's scoring group. Inspector: "Points". Common to graded components.
variant
public
enum: inline (Word-sized, grows up to 40 characters), resizable (Grows with the answer up to the whole line)
default inline
The presentation variant (see Variants below): it changes how the element looks and behaves for the student, never how it grades. More: Variants and versions.
answer
private, required
string
The expected answer, shown as the solution. Numbers use . or the content language's decimal comma. Inspector: "Answer".
type
public
enum: text (Text), number (Number)
default text
number: a number in the content language's notation, compared within tolerance. Inspector: "Answer type".
case
private
enum: insensitive (Do not matter), sensitive (Must match)
default insensitive
sensitive: capital letters must match. Inspector: "Capital letters".
marks
private
enum: strict (Must match), fold (Do not matter)
default strict
fold: diacritics do not matter (ą = a, ł = l). Inspector: "Accents and diacritics".
tolerance
private
number: >= 0
Number gaps: accepted distance from answer. Inspector: "Tolerance (±)".
width
private
integer: 1 to 40
Author override of the input width, in characters. Inspector: "Width in characters".
size
derived
integer: 1 to 40
Input width in characters: width, else the longest answer rounded up to 4, 8, 12, 20 or 40.
Child Meaning
<astl-alt>
private, text content
0 to 20 per element
More accepted answers.

inline: grows with the answer up to 40 characters. resizable: grows up to the whole line, for long answers. Pick one with the variant attribute; without it (or with a value an older player does not know) the default inline applies. Every variant of a source grades the same. More: Variants and versions.

Variant Inspector label
inline (default) English: Word-sized, grows up to 40 characters
Polish: Na słowo, rośnie do 40 znaków
resizable English: Grows with the answer up to the whole line
Polish: Rośnie z odpowiedzią do całej linii

Pick a mode with the scoring attribute. Default: all. Rules: see Scoring.

Mode Rule
all (default) all-correct: full points only when every slot is correct; feedback shows the group verdict only

Slot kinds it produces: text, number.

Reported in the namespace astl.gap, on top of the document issues. Errors block compiling; warnings do not.

Code Messages
GAP_ANSWER_MISSING
error
params id
English: Gap {id} has no answer.
Polish: Luka {id} nie ma odpowiedzi.
GAP_ANSWER_TOO_LONG
error
params id, max
English: Gap {id} accepts an answer longer than {max, plural, one {# character} other {# characters}}, which students cannot type. Shorten it.
Polish: Luka {id} akceptuje odpowiedź dłuższą niż {max, plural, one {# znak} few {# znaki} many {# znaków} other {# znaku}}, a uczeń nie wpisze tak długiej odpowiedzi. Skróć ją.
GAP_NUMBER_INVALID
error
params id, value
English: Gap {id}: “{value}” is not a number.
Polish: Luka {id}: „{value}” nie jest liczbą.
GAP_ALT_EMPTY
error
params id
English: Gap {id} has an empty alternative answer.
Polish: Luka {id} ma pustą odpowiedź alternatywną.
GAP_ALT_DUPLICATE
warning
params id, value
English: Gap {id} accepts “{value}” twice.
Polish: Luka {id} akceptuje „{value}” dwa razy.
GAP_TOLERANCE_TEXT
warning
params id
English: Gap {id}: tolerance only works for number gaps.
Polish: Luka {id}: tolerancja działa tylko w lukach liczbowych.

The insert menu lists <astl-gap> under "Components", where it inserts the default template, and its named starters under "Exercises": whole exercises with sample text in the author's language.

Entry English Polish
Components Gap
The student types a word or a number.
Luka
Uczeń wpisuje słowo lub liczbę.
Exercises: fill-the-gaps Fill the gaps
A sentence with two words to type in
Uzupełnij luki
Zdanie z dwoma słowami do wpisania
Templates of astl-gap

As the descriptor writes them: {{id}} becomes a fresh id, {{t:key}} a message in the author's locale.

Default template:

<astl-gap id="{{id}}" answer=""></astl-gap>

Named starter fill-the-gaps:

<h3>{{t:template.fill.heading}}</h3><p>{{t:template.fill.instruction}}</p><p>{{t:template.fill.start}} <astl-gap id="{{id}}" answer="{{t:template.fill.answer1}}"></astl-gap> {{t:template.fill.middle}} <astl-gap answer="{{t:template.fill.answer2}}"></astl-gap>{{t:template.fill.end}}</p>
  • Pattern: textbox.
  • Keys: Tab.

What every element must keep: Accessibility.

CSS parts: gap, input, verdict, solution. How to reach them: Looks.

Authors pick a look for one element with style-template; it wins over the document's. Built-in templates for <astl-gap>: playful, notebook.

Property Value
Label Gap (editor.label)
Description The student types a word or a number. (editor.description)
Icon text-t
Id prefix gap: new elements get gap-1, gap-2, ...

Inspector fields, in order:

Field Edits Label Help
attribute attribute answer Answer
text-list <astl-alt> children Also accept Other spellings or synonyms that count as correct.
attribute attribute type Answer type
attribute attribute case Capital letters
attribute attribute marks Accents and diacritics For example ą, é, ł, ü.
attribute attribute tolerance Tolerance (±)
attribute attribute width Width in characters
attribute attribute points Points

Every key of astl.gap: ui.* for students (messages/ui/<locale>.json, the only strings the element loads), issue codes, editor.* and template.* for authors (messages/<locale>.json).

39 keys in English and Polish
Key Messages
ui.label English: Gap {n}
Polish: Luka {n}
ui.labelPlain English: Gap
Polish: Luka
ui.solution English: Correct answer: {answer}
Polish: Poprawna odpowiedź: {answer}
GAP_ANSWER_MISSING English: Gap {id} has no answer.
Polish: Luka {id} nie ma odpowiedzi.
GAP_ANSWER_TOO_LONG English: Gap {id} accepts an answer longer than {max, plural, one {# character} other {# characters}}, which students cannot type. Shorten it.
Polish: Luka {id} akceptuje odpowiedź dłuższą niż {max, plural, one {# znak} few {# znaki} many {# znaków} other {# znaku}}, a uczeń nie wpisze tak długiej odpowiedzi. Skróć ją.
GAP_NUMBER_INVALID English: Gap {id}: “{value}” is not a number.
Polish: Luka {id}: „{value}” nie jest liczbą.
GAP_ALT_EMPTY English: Gap {id} has an empty alternative answer.
Polish: Luka {id} ma pustą odpowiedź alternatywną.
GAP_ALT_DUPLICATE English: Gap {id} accepts “{value}” twice.
Polish: Luka {id} akceptuje „{value}” dwa razy.
GAP_TOLERANCE_TEXT English: Gap {id}: tolerance only works for number gaps.
Polish: Luka {id}: tolerancja działa tylko w lukach liczbowych.
editor.label English: Gap
Polish: Luka
editor.description English: The student types a word or a number.
Polish: Uczeń wpisuje słowo lub liczbę.
editor.answer English: Answer
Polish: Odpowiedź
editor.alternatives English: Also accept
Polish: Akceptuj też
editor.alternativesHelp English: Other spellings or synonyms that count as correct.
Polish: Inne zapisy lub synonimy, które też są poprawne.
editor.type English: Answer type
Polish: Typ odpowiedzi
editor.value.type.text English: Text
Polish: Tekst
editor.value.type.number English: Number
Polish: Liczba
editor.case English: Capital letters
Polish: Wielkie litery
editor.value.case.insensitive English: Do not matter
Polish: Nie mają znaczenia
editor.value.case.sensitive English: Must match
Polish: Muszą się zgadzać
editor.marks English: Accents and diacritics
Polish: Znaki diakrytyczne
editor.marksHelp English: For example ą, é, ł, ü.
Polish: Na przykład ą, ę, ł, ż.
editor.value.marks.strict English: Must match
Polish: Muszą się zgadzać
editor.value.marks.fold English: Do not matter
Polish: Nie mają znaczenia
editor.tolerance English: Tolerance (±)
Polish: Tolerancja (±)
editor.width English: Width in characters
Polish: Szerokość w znakach
editor.variant English: Field
Polish: Pole
editor.value.variant.inline English: Word-sized, grows up to 40 characters
Polish: Na słowo, rośnie do 40 znaków
editor.value.variant.resizable English: Grows with the answer up to the whole line
Polish: Rośnie z odpowiedzią do całej linii
editor.points English: Points
Polish: Punkty
template.fill.label English: Fill the gaps
Polish: Uzupełnij luki
template.fill.description English: A sentence with two words to type in
Polish: Zdanie z dwoma słowami do wpisania
template.fill.heading English: Spiders and insects
Polish: Pająki i owady
template.fill.instruction English: Type the missing words.
Polish: Wpisz brakujące słowa.
template.fill.start English: A spider has
Polish: Pająk ma
template.fill.answer1 English: eight
Polish: osiem
template.fill.middle English: legs, and an insect has
Polish: nóg, a owad ma
template.fill.answer2 English: six
Polish: sześć
template.fill.end English: .
Polish: .