eklavya 1.9.3 → 1.10.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/dist/ask.js CHANGED
@@ -22,22 +22,24 @@ const TIER_LABEL = {
22
22
  export function askHeader({ config, level, pinned, tier, position }) {
23
23
  if (config.quiet)
24
24
  return null;
25
+ // `learn (topic)` rather than `learn: topic`: the value now sits behind its own
26
+ // `focus:` label, and two colons in one field read as a nested key.
25
27
  const focus = config.focus === 'learn' && config.focus_topic
26
- ? `learn: ${config.focus_topic}`
28
+ ? `learn (${config.focus_topic})`
27
29
  : config.focus;
28
30
  const label = TIER_LABEL[tier];
29
31
  const parts = [
30
32
  // `enforced` is the one value with a consequence attached, so it says so.
31
- config.mode === 'enforced' ? 'enforced (gated)' : config.mode,
32
- focus,
33
+ ['mode', config.mode === 'enforced' ? 'enforced (gated)' : config.mode],
34
+ ['focus', focus],
33
35
  // A pinned level explains itself here or nowhere: without it, questions
34
36
  // simply stop getting harder one day and nothing on screen says why.
35
- pinned ? `${level} (pinned)` : level,
36
- label ? `tier ${tier} ${label}` : `tier ${tier}`,
37
+ ['level', pinned ? `${level} (pinned)` : level],
38
+ ['tier', label ? `${tier} ${label}` : String(tier)],
37
39
  ];
38
40
  if (position && position.total > 1)
39
- parts.push(`q ${position.index}/${position.total}`);
40
- return `[${parts.join(' · ')}]`;
41
+ parts.push(['question', `${position.index} of ${position.total}`]);
42
+ return `[${parts.map(([key, value]) => `${key}: ${value}`).join(' · ')}]`;
41
43
  }
42
44
  /**
43
45
  * The settings line, matched exactly as `askHeader` composes it.
@@ -47,7 +49,10 @@ export function askHeader({ config, level, pinned, tier, position }) {
47
49
  * eat a real question. Both positions are matched because the line moved from the
48
50
  * bottom to the top in 1.9, and stems recorded before that are still in the
49
51
  * database; a strip that only knew the new position would let every old row's
50
- * fingerprint drift.
52
+ * fingerprint drift. The `key:` labels are optional in the pattern for the same
53
+ * reason: rows recorded before the line was labelled are still the same
54
+ * questions, and a strip that only knew the labelled shape would leave the old
55
+ * line baked into every one of their fingerprints.
51
56
  *
52
57
  * It exists because the tutor will eventually record the whole block it
53
58
  * displayed, and `question` is what `questionFingerprint` hashes -- a settings
@@ -56,7 +61,7 @@ export function askHeader({ config, level, pinned, tier, position }) {
56
61
  * the options out of the stem to avoid. The brackets are optional in the pattern
57
62
  * for the same reason the leading dials group is: older rows do not have them.
58
63
  */
59
- const SETTINGS_LINE_BODY = String.raw `\[?[ \t]*(?:(?:off|ambient|enforced(?:[ \t]*\(gated\))?)[ \t]*·[ \t]*)?(?:project|concept|learn(?::[^\n·\]]*)?)[ \t]*·[ \t]*(?:easy|medium|hard)(?:[ \t]*\(pinned\))?[ \t]*·[ \t]*tier[ \t]*[1-5][^\n]*`;
64
+ const SETTINGS_LINE_BODY = String.raw `\[?[ \t]*(?:(?:mode:[ \t]*)?(?:off|ambient|enforced(?:[ \t]*\(gated\))?)[ \t]*·[ \t]*)?(?:focus:[ \t]*)?(?:project|concept|learn(?:[ \t]*[:(][^\n·\]]*)?)[ \t]*·[ \t]*(?:level:[ \t]*)?(?:easy|medium|hard)(?:[ \t]*\(pinned\))?[ \t]*·[ \t]*tier:?[ \t]*[1-5][^\n]*`;
60
65
  const LEADING_LINE = new RegExp(String.raw `^[ \t]*${SETTINGS_LINE_BODY}\n+`, 'i');
61
66
  const TRAILING_LINE = new RegExp(String.raw `\n[ \t]*${SETTINGS_LINE_BODY}$`, 'i');
62
67
  export function stripAskHeader(question) {
package/dist/ask.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ask.js","sourceRoot":"","sources":["../src/ask.ts"],"names":[],"mappings":"AA+CA,+EAA+E;AAC/E,MAAM,UAAU,GAA2B;IACzC,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,WAAW;IACd,CAAC,EAAE,WAAW;IACd,CAAC,EAAE,eAAe;IAClB,CAAC,EAAE,QAAQ;CACZ,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM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