@eliceio/cdk-cli 1.3.0-contenttypes.1 → 1.3.0-contenttypes.2

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 CHANGED
@@ -507,18 +507,18 @@ LXP 자료 편집의 **AI헬피 설정 → 학습 참고 내용**에 들어가
507
507
  퀴즈 템플릿의 답(문자열 하나)과 정답(정규식 하나, 편집 화면이 만듦):
508
508
 
509
509
  ```text
510
- q1=b;q2=a,d;q3=c,a,b;q4=%EA%B0%80%EC%A4%91%EC%B9%98;q5=g1:a|g2:b,c
510
+ q1=b;q2=a,d;q3=c,a,b;q4=가중치;q5=g1:a|g2:b,c
511
511
  ```
512
512
 
513
513
  ```jsonc
514
514
  // settings.grading (편집 화면이 저장. pattern: 답 문자열 전체를 정규식 하나로 비교, 모두 맞아야 100점)
515
515
  {
516
516
  "type": "pattern",
517
- "answer_key": "^q1=b;q2=a,d;q3=c,a,b;q4=(?:%EA%B0%80%EC%A4%91%EC%B9%98|weight);q5=g1:a\\|g2:b,c$",
517
+ "answer_key": "^q1=b;q2=a,d;q3=c,a,b;q4=(?:가중치|weight);q5=g1:a\\|g2:b,c$",
518
518
  }
519
519
  ```
520
520
 
521
- 문항 순서대로 `문항id=답`을 `;`로 잇습니다. 복수 선택은 보기 id를 정렬해 `,`로, 순서 맞추기는 칸 순서대로, 그룹 분류는 그룹 순서대로 `그룹:보기들(정렬)`을 `|`로, 주관식은 앞뒤 공백을 자른 뒤 `encodeURIComponent`. 정답 정규식은 같은 방식으로 인코딩한 뒤 이스케이프하고, 주관식은 허용 답을 `(?:…|…)`로 묶습니다. 문항 · 보기 · 그룹 id는 한 번 정하면 바꾸지 않습니다.
521
+ 문항 순서대로 `문항id=답`을 `;`로 잇습니다. 복수 선택은 보기 id를 정렬해 `,`로, 순서 맞추기는 칸 순서대로, 그룹 분류는 그룹 순서대로 `그룹:보기들(정렬)`을 `|`로, 주관식은 앞뒤 공백을 자른 뒤 원문(`%` → `%25`, `;` → `%3B`만, settings `"answerFormat": 2`, 퀴즈 1.10.0부터) 또는 `encodeURIComponent`(꼬리표가 없는 옛 자료). 정답 정규식은 같은 방식으로 바꾼 뒤 이스케이프하고, 주관식은 허용 답을 `(?:…|…)`로 묶거나 작성자 정규식을 `(?:…)`로 감쌉니다 (ADR 0013). 문항 · 보기 · 그룹 id는 한 번 정하면 바꾸지 않습니다.
522
522
 
523
523
  ---
524
524
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eliceio/cdk-cli",
3
- "version": "1.3.0-contenttypes.1",
3
+ "version": "1.3.0-contenttypes.2",
4
4
  "description": "교육자용 Custom HTML 콘텐츠 CLI",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -46,7 +46,7 @@
46
46
  "rollup": "^4.0.0",
47
47
  "tslib": "^2.6.1",
48
48
  "typescript": "~5.9.3",
49
- "@eliceio/cdk": "^1.3.0-contenttypes.1"
49
+ "@eliceio/cdk": "^1.3.0-contenttypes.2"
50
50
  },
51
51
  "scripts": {
52
52
  "prebuild": "del-cli \"buildcache/*\" \"es/*\"",
@@ -3,17 +3,19 @@
3
3
  - The quiz has **no instructor screen** (`metadata.json` `screens.instructor.enabled: false`): an instructor who opens it in LXP gets the student screen and can solve and submit it (graded, not recorded). Add `instructor.html` and turn it on only when the person asks for one.
4
4
  - The template starts with **no questions**: the student screen shows "학습 자료를 준비하고 있어요" until the edit screen saves. The questions and answers are added on the edit screen ("+ 문제 추가", any of the five types picked from the type button's list, the answer in the same card; up to 20 questions): in `ecdk dev`, so the upload can carry them (`.ecdk/settings.json`, sent after the person agrees), or on the LXP edit screen after upload. There is no quiz title or description field (the student screen starts with the questions); a `title` · `description` saved earlier is kept as is.
5
5
  - Question types: `select_one` · `select_multiple` · `order` · `text` · `group`. For `order` the student taps the choices in the right order and each gets a number 1 · 2 · 3 (tap again to remove, "답안 초기화" to clear); the answer string is the same as before. Question, choice and group ids (`q1`, `a`, `g1`) are lower-case letters and digits; once set, do not change them.
6
- - Student answer (`pattern`, the default): **one string**, `id=answer` per question joined by `;` in question order: `q1=b;q2=a,d;q3=c,a,b;q4=weight;q5=g1:a|g2:b,c`. Multiple choice lists choice ids **sorted**, order lists them in slot order, group lists `group:choices(sorted)` in group order joined by `|`, and a text answer is trimmed and `encodeURIComponent`-encoded.
7
- - Answers: the instructor picks the answer in each question card of the edit screen. Single and multiple choice mark it in the option rows (a "정답" radio or checkbox per option), group sorting picks each option's group in its row, order uses a separate "정답" section, and text questions take one allowed answer per line. Saving builds one regex and checks it, and blocks the save with the question number when an answer is missing, points at a deleted choice, or the regex does not match the answers back or still matches a changed answer. The quiz grades with `pattern` or `partial_pattern` (no hand-written regex; the author picks the type on the edit screen with the "부분 채점 허용" switch shown from two questions, a new quiz is `pattern`); its completion policy is `on_graded` (set by the publish skill with the answers, or picked in the '설정' panel at the top of the LXP edit page); with `on_submit` the server does not grade (`is_correct: null`, the kit shows "제출했어요."). `pattern` compares the whole answer at once, so **everything must match for 100**.
6
+ - Student answer (`pattern`, the default): **one string**, `id=answer` per question joined by `;` in question order: `q1=b;q2=a,d;q3=c,a,b;q4=weight;q5=g1:a|g2:b,c`. Multiple choice lists choice ids **sorted**, order lists them in slot order, group lists `group:choices(sorted)` in group order joined by `|`, and a text answer is trimmed and sent **as typed with only `%` → `%25` and `;` → `%3B`** when the settings carry `"answerFormat": 2` (template 1.10.0 and later saves it), or `encodeURIComponent`-encoded when the tag is missing (quizzes saved by 1.9.x or earlier). Both decode with one `decodeURIComponent`.
7
+ - Answers: the instructor picks the answer in each question card of the edit screen. Single and multiple choice mark it in the option rows (a "정답" radio or checkbox per option), group sorting picks each option's group in its row, order uses a separate "정답" section, and text questions pick an answer mode ("정답 입력 방식"): "직접 입력" (one allowed answer per line, any one is correct) or "정규 표현식" (a regex such as `[Aa]pples?|사과`, with a "채점 테스트" box that grades a sample answer the way the server does). A leading `^` · trailing `$` are dropped and a leading `(?i)` becomes `(?i:…)`; syntax the server (Python `regex`) and the browser read differently is blocked on save (`;`, flags in the middle, back-references, named groups, `[^]`, `\p{…}`, `\b`, `\Z` and similar; the list is in ADR 0013). Saving builds one regex and checks it, and blocks the save with the question number when an answer is missing, points at a deleted choice, or the regex does not match the answers back or still matches a changed answer. The quiz grades with `pattern` or `partial_pattern` (no hand-written regex for the whole quiz, only per text question; the author picks the type on the edit screen with the "부분 채점 허용" switch shown from two questions, a new quiz is `pattern`); its completion policy is `on_graded` (set by the publish skill with the answers, or picked in the '설정' panel at the top of the LXP edit page); with `on_submit` the server does not grade (`is_correct: null`, the kit shows "제출했어요."). `pattern` compares the whole answer at once, so **everything must match for 100**.
8
8
  - **Partial score per question (`partial_pattern`, 2 ②)**: ask the person which one they want ("모두 맞혀야 100점" or "문항별 부분 점수"). For partial scores, write into `.ecdk/settings.json` both the public `"gradingType": "partial_pattern"` (the student screen cannot see `grading`, so this tells it to submit an array) and `grading` `{ "type": "partial_pattern", "answer_key": ["^q1=b$", "^q2=a,d$", …], "scores": [60, 40, …] }`, one regex per question in question order, each the same as one `id=answer` piece of the `pattern` regex wrapped in `^…$`. Scores come from the person or the planning material, otherwise the automatic score: every question gets `ceil(100 / questions)` (3 questions → 34 · 34 · 34, the server caps the student's score at 100). Also write `"pointsMode": "custom"` with each question's `"points"` (same values as `scores`), or `"pointsMode": "equal"` for the automatic score. Then have the person open the edit view and save once ("초안으로 저장") so the edit screen checks every answer. The author can change both on the edit screen: the "부분 채점 허용" switch picks `pattern` or `partial_pattern`, the row under it shows "자동 배점" or "직접 배점" with the total, and each question card has a score field (custom scores must be integers 0–100 summing to at least 100; "동일 점수로 적용하기" goes back to automatic). A quiz saved before keeps its type and scores unless the author changes them. The student answer is then an array `["q1=b", "q2=a,d", …]`, and the student screen marks each question ✓ · ✕ from `answer_correctness` (right after submitting and when reopened); below 100 it shows a box with the score, "아쉬워요!" and a mascot above the submit bar, and with custom scores each question title shows "N점". With `pattern` the score line is hidden: one question shows "오답입니다." in its card, and several questions with any wrong show "틀린 문제가 있습니다. 다시 한번 풀어보세요." above the submit bar. Every question must still be answered before submitting.
9
9
 
10
10
  ```json
11
11
  {
12
12
  "type": "pattern",
13
- "answer_key": "^q1=b;q2=a,d;q3=c,a,b;q4=(?:weight|%EA%B0%80%EC%A4%91%EC%B9%98);q5=g1:a\\|g2:b,c$"
13
+ "answer_key": "^q1=b;q2=a,d;q3=c,a,b;q4=(?:weight|가중치);q5=g1:a\\|g2:b,c$"
14
14
  }
15
15
  ```
16
16
 
17
+ - **Writing `.ecdk/settings.json` by hand (answer format tags, ADR 0013)**: put `"answerFormat": 2` and `"requires": { "quiz": "1.10.0" }` at the top level and `"answerMode": "list"` (or `"regex"`) on every text question, and write text answers in the regex **as typed** (escape regex characters, `%` → `%25`, `;` → `%3B`), e.g. `q4=(?:weight|가중치|50%25)`. A regex-mode question stores the author's regex wrapped in `(?:…)`, e.g. `q4=(?:[Aa]pples?|사과)`. Without `answerFormat` the student screen sends `encodeURIComponent` answers, so the regex must use that form instead (`q4=(?:%EA%B0%80%EC%A4%91%EC%B9%98)`); never mix the two. Then save once in the edit view so the edit screen checks and rewrites everything. If a material goes back to a 1.9.x zip, the answers must be saved again on that edit screen (the old screen ignores the tag).
18
+
17
19
  - File split: **`ui/` is the look** (edit freely), **`screens/` is the layout** (which blocks in which order), **`core/` is behavior and the grading contract** (do not edit).
18
20
  - Colors, spacing, corners, choice cards: the `--qz-*` variables in `ui/theme.css` (they point at EDS tokens, so `--theme dark` also fits)
19
21
  - Text: `ui/texts.js` (tab title, loading, student, edit, and validation messages)
@@ -2,5 +2,12 @@
2
2
  "name": "document",
3
3
  "version": "1.2.3",
4
4
  "title": "문서 (PDF · PPT)",
5
- "description": "문서 한 편 보기 (PDF · PPTX). 편집 화면에서 문서 파일을 올리고, PPTX는 슬라이드의 글자를 눌러 바로 고침(고친 파일을 새로 올려 바꿈). 학생 화면은 어두운 바탕에 화면에 맞춘 쪽 · 슬라이드를 아래 < [n] / N쪽 >로 넘김(쪽 번호 입력 가능). 옛 .ppt · .pps · .ppsx는 .pptx · .pdf로 바꿔 올림 (완료 정책은 LXP 자료 편집 화면의 '설정'에서 '열람 시 학습 완료'로 고름)"
5
+ "description": "PDF, PPT 문서를 올립니다",
6
+ "catalog": {
7
+ "category": "theory",
8
+ "icon": "pdf",
9
+ "sortOrder": 10,
10
+ "thumbnailUrl": "https://static.elice.io/elice-material/custom/templates/document/thumbnail.png",
11
+ "previewUrl": "https://static.elice.io/elice-material/custom/templates/document/preview.png"
12
+ }
6
13
  }
@@ -95,7 +95,7 @@ app.useSave({ getContent, validate });
95
95
  ## 퀴즈 데이터와 정답
96
96
 
97
97
  - 문항은 편집 화면에서 만들어 저장한 내용(`settings`)뿐입니다. 처음에는 문항이 없어 편집 화면은 **문항 추가**로 시작하고, 저장하기 전 학생 화면은 키트 빈 안내("학습 자료를 준비하고 있어요")를 보입니다. 형식은 ecdk 문서 ADR 0006.
98
- - 퀴즈 하나에 문항은 **20개까지** 넣습니다. 20개가 차면 "문항 추가" 대신 안내가 보입니다. 정답 정규식은 퀴즈 전체가 500자(서버 한도)까지라, 한글 주관식은 한 글자가 9자로 늘어 정답 · 유사 정답이 많으면 4~5문항에서 한도에 닿습니다. 넘으면 저장할 때 가장 긴 문항에 "정답이 너무 깁니다"가 보입니다 (문항별 부분 점수는 한도가 문항마다 500자).
98
+ - 퀴즈 하나에 문항은 **20개까지** 넣습니다. 20개가 차면 "문항 추가" 대신 안내가 보입니다. 정답 정규식은 퀴즈 전체가 500자(서버 한도)까지입니다 (1.10.0부터 한글 주관식도 한 글자 = 1자, 그 전에는 9자로 늘었음). 넘으면 저장할 때 가장 긴 문항에 "정답이 너무 깁니다"가 보입니다 (문항별 부분 점수는 한도가 문항마다 500자).
99
99
  - 문항 유형: 단일 선택 · 복수 선택 · 순서 맞추기 · 주관식 · 그룹 분류. 순서 맞추기는 학생이 보기를 정답 순서대로 누르면 1 · 2 · 3 번호가 붙습니다 (다시 누르면 빠짐, "답안 초기화").
100
100
  - 퀴즈 제목 · 안내 칸은 없습니다 (학생 화면은 문제부터). 예전에 저장한 `title` · `description`은 지우지 않고 그대로 저장합니다.
101
101
  - 편집 화면: 유형은 카드 머리의 유형 버튼 → 목록(↑ · ↓ · Enter · Esc)에서 고르고, 글이 있던 보기 · 주관식 정답 · 설명 · 힌트 · 해설을 지우면 "되돌리기" 알림이 6초 보입니다.
@@ -107,18 +107,20 @@ app.useSave({ getContent, validate });
107
107
 
108
108
  | 채점 방식 | `settings.grading` | 학생 답 |
109
109
  | ---------------------------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
110
- | `pattern` (모두 맞혀야 100점) | `{ "type": "pattern", "answer_key": "^q1=b;q2=a,d$" }` (정규식 하나) | 문자열 하나: 문항 순서대로 `문항id=답`을 `;`로 잇고 주관식은 URL 인코딩 (`q1=b;q2=a,d;q4=%EA…`) |
110
+ | `pattern` (모두 맞혀야 100점) | `{ "type": "pattern", "answer_key": "^q1=b;q2=a,d$" }` (정규식 하나) | 문자열 하나: 문항 순서대로 `문항id=답`을 `;`로 잇고 주관식은 원문(`%` → `%25`, `;` → `%3B`) (`q1=b;q2=a,d;q4=가중치`) |
111
111
  | `partial_pattern` (문항별 부분 점수) | `{ "type": "partial_pattern", "answer_key": ["^q1=b$", "^q2=a,d$"], "scores": [60, 40] }` | 문항별 배열 `["q1=b", "q2=a,d"]` (한 항목은 위 문자열의 한 조각과 같음) |
112
112
 
113
113
  - `partial_pattern`은 맞은 문항 점수의 합이 점수이고(최대 100), 100점만 정답 · 완료입니다. 학생 화면은 `settings.grading`을 받지 못하므로 편집 화면이 공개 값 `"gradingType": "partial_pattern"`을 같이 저장하고, 학생 화면은 이것을 보고 답을 배열로 냅니다. settings를 직접 쓸 때도 둘을 같이 적습니다. 배점 표시용으로 `"pointsMode": "equal" | "custom"`과 문제마다 `points`도 저장합니다 (배점은 정답이 아니라 학생에게 보여도 됨, 채점은 `grading.scores`).
114
114
  - 배점(`scores`)은 스위치 아래 줄과 문제 카드 머리에서 정합니다. **자동 배점**은 문제마다 같은 점수 `ceil(100 / 문제 수)`입니다 (`core/model.js` `equalPoints`, 3문제면 34 · 34 · 34로 합 102, 4문제면 25씩 합 100. 합이 100을 넘어도 서버가 학생 점수를 100에서 자르므로 다 맞히면 100점. 문제를 더하거나 지우면 다시 계산), 카드 머리의 배점 칸을 고치면 **직접 배점**이 되어 "합계 N / 100점"이 보입니다 (100점보다 모자라면 빨간 안내 · 저장 안 됨, 넘치면 "학생은 최대 100점까지 받을 수 있습니다."). "동일 점수로 적용하기"는 자동 배점으로 되돌립니다. 직접 배점에서 문제를 더하면 새 문제는 100점까지 남은 배점입니다. 저장된 배점은 정규식의 문제 id를 따라가 문제 순서를 바꿔도 제 문제에 붙고, 저장된 문제와 지금 문제가 다르면(settings를 직접 고침) 자동 배점으로 엽니다. `pointsMode`가 없는 퀴즈(1.7.x에 저장했거나 settings를 직접 씀)는 저장된 배점이 자동 배점 값과 같을 때만 자동, 아니면 직접 배점으로 열어 (1.7.x가 나눠 둔 33 · 33 · 34도) 작성자가 고치지 않으면 채점 방식 · 배점이 그대로 저장됩니다.
115
115
  - `partial_pattern`이면 서버가 문항별 맞음(`answer_correctness`)을 주고, 학생 화면은 제출 직후와 다시 열 때(마지막 제출 기록) 문항마다 정답 · 오답을 표시합니다. 100점보다 낮으면 제출 바 위에 점수 · "아쉬워요!" · "틀린 문제를 다시 풀어 보세요." · 마스코트 상자를 보이고(100점이면 없음), 직접 배점이면 문제 머리에 "N점" 회색 알약을 보입니다 (600px 이상은 제목 오른쪽 끝, 좁은 화면은 제목 위 한 줄). 키트 점수 줄의 정답 · 오답 문장은 두 방식 모두 감춥니다. `pattern`은 문항이 하나면 그 카드에 정답 · 오답, 여러 문항이면 모두 맞았을 때만 정답을 표시하고 틀린 것이 있으면 제출 바 위에 "틀린 문제가 있습니다. 다시 한번 풀어보세요."를 보입니다.
116
116
  - 학생은 모든 문항에 답해야 제출할 수 있습니다 (두 방식 모두).
117
+ - **주관식 정답 입력 방식** (1.10.0, 연주님 2026-11-19, ADR 0013): 주관식 카드의 "정답 입력 방식" 세그먼트에서 **직접 입력**(허용 답을 줄마다, 그중 하나만 맞아도 정답) 또는 **정규 표현식**(예: `[Aa]pples?|사과`)을 고릅니다. 정규식 칸 아래 **채점 테스트**에 답을 적으면 "일치합니다. 정답으로 채점됩니다." / "일치하지 않습니다. 오답으로 채점됩니다."가 보입니다. 채점 테스트는 서버(Python `regex`)와 같게 맞춰 봅니다 (`\w` · `\d`는 유니코드, `.`은 줄바꿈만 뺌, 앞뒤 공백은 자름). 맨 앞 `^` · 맨 끝 `$`는 떼고, 맨 앞 `(?i)`는 `(?i:…)`로 바꿔 저장합니다. 서버와 브라우저가 다르게 읽는 문법(`;` · 가운데 플래그 · 역참조 · 이름 그룹 · `[^]` · `\p{…}` · `\b` · `\Z` 등, 목록은 ADR 0013)은 저장을 막습니다. 정규식 방식은 왕복 · 오답 검사를 하지 않고(작성자가 일부러 넓게 쓸 수 있음) 빈 답도 맞는 식이면 안내만 합니다. 정규식 → 직접 입력으로 바꿀 때 글자만으로 된 `a|b`가 아니면 정규식을 지우고 "정규식을 지웠습니다."(되돌리기)를 보입니다.
118
+ - **답 형식 꼬리표** (1.10.0, ADR 0013): 편집 화면은 저장할 때 공개 settings에 `"answerFormat": 2` · `"requires": { "quiz": "1.10.0" }`와 주관식 문항마다 `"answerMode": "list" | "regex"`를 둡니다. 학생 화면은 `answerFormat`이 2면 주관식 답을 원문으로, 없으면(1.9.x 이하가 저장한 자료) 예전처럼 `encodeURIComponent`로 보냅니다. 그래서 옛 자료는 다시 저장하지 않아도 그대로 맞게 채점되고, 편집 화면에서 저장하면 정답이 새 형식으로 다시 쓰입니다. 더 새 템플릿이 저장한 퀴즈(`answerFormat` 3 이상)는 편집 화면 맨 위에 알리고 정답을 저장하지 않습니다. **zip을 1.9.x 이하로 되돌릴 때는 편집 화면에서 다시 저장해야 합니다** (옛 화면은 꼬리표를 읽지 못해 한글 · 공백 · `%` · `;` 답이 오답, 정규식 문항은 글자 답으로 읽힘). 되돌렸다가 다시 1.10으로 올릴 때도 1.10 편집 화면에서 다시 저장합니다. settings를 직접 쓸 때는 꼬리표와 정답 형식을 같이 맞춥니다.
117
119
  - 편집 화면은 답(`settings.grading`)만 저장합니다. 완료 정책은 LXP 페이지 설정입니다 (ADR 0012): publish 스킬이 동의를 받아 업로드 때 정하거나 교육자가 LXP 편집 페이지 위쪽 '설정' 패널에서 고릅니다. 퀴즈는 **채점해 통과하면 완료(on_graded)**여야 채점합니다. 제출하면 완료(on_submit)면 서버가 채점하지 않고 제출만으로 완료되어 점수 없이 "제출했어요."가 보입니다.
118
120
 
119
121
  ## 정답
120
122
 
121
- 정답은 zip에 넣지 않습니다. **내용 편집 화면**(`edit.html`)에서 문항을 만들면서 같은 카드에서 답을 고릅니다. 단일 · 복수 선택은 보기 줄의 **정답**(radio · checkbox), 그룹 분류는 보기 줄의 그룹 고르기, 순서 맞추기 · 주관식은 아래 **정답** 칸에서 고릅니다 (주관식은 허용 답을 줄마다 하나). 정답은 보기 id로 저장해 보기 순서를 바꿔도 그대로이고, 보기를 지우면 정답에서 빠집니다. 저장할 때 고른 답으로 정답 정규식(`partial_pattern`은 문항마다 하나)을 만들어 `settings.grading`에 넣고 (학생에게는 내려가지 않음), 저장 전에 검증합니다 (ADR 0009):
123
+ 정답은 zip에 넣지 않습니다. **내용 편집 화면**(`edit.html`)에서 문항을 만들면서 같은 카드에서 답을 고릅니다. 단일 · 복수 선택은 보기 줄의 **정답**(radio · checkbox), 그룹 분류는 보기 줄의 그룹 고르기, 순서 맞추기 · 주관식은 아래 **정답** 칸에서 고릅니다 (주관식은 허용 답을 줄마다 하나 또는 정규식). 정답은 보기 id로 저장해 보기 순서를 바꿔도 그대로이고, 보기를 지우면 정답에서 빠집니다. 저장할 때 고른 답으로 정답 정규식(`partial_pattern`은 문항마다 하나)을 만들어 `settings.grading`에 넣고 (학생에게는 내려가지 않음), 저장 전에 검증합니다 (ADR 0009):
122
124
 
123
125
  1. 모든 문항에 정답이 있고, 지운 보기를 가리키지 않는다
124
126
  2. 정규식이 컴파일되고 `^…$`로 감싸져 있으며 너무 길거나 느리지 않다
@@ -22,12 +22,42 @@ export declare function totalPoints(questions: { points?: unknown }[]): number;
22
22
  export declare function encodeAnswer(q: any, value: any): string;
23
23
  export declare function decodeAnswer(q: any, text: string | undefined): any;
24
24
  export declare function isAnswered(q: any, value: any): boolean;
25
- /** 문항별 화면 값 → 제출할 답 문자열 하나 ("q1=b;q2=a,d;…", 주관식은 encodeURIComponent) */
26
- export declare function joinAnswers(questions: any[], values: any[]): string;
25
+ /** 답 형식 (ADR 0013): 1.10.0 편집 화면이 저장하는 값 (settings answerFormat) */
26
+ export declare const ANSWER_FORMAT: 2;
27
+ /** 이 settings를 읽는 데 필요한 템플릿 버전 (settings requires) */
28
+ export declare const REQUIRES: { quiz: string };
29
+ /** settings → 학생 화면 답 형식 (1 = encodeURIComponent, 2 = 원문) */
30
+ export declare function answerFormatOf(content: unknown): 1 | 2;
31
+ /** 원문 형식 주관식 답: % → %25, ; → %3B */
32
+ export declare function encodeRaw(text: string): string;
33
+ /** 주관식 답 → 제출 문자열 조각 (format 1 · 2) */
34
+ export declare function encodeText(text: string, format?: number): string;
35
+ /** 문항별 화면 값 → 제출할 답 문자열 하나 ("q1=b;q2=a,d;…", 주관식은 format대로) */
36
+ export declare function joinAnswers(questions: any[], values: any[], format?: number): string;
27
37
  /** 제출한 답(문자열 또는 옛 { answers }) → 문항 id별 답 문자열 */
28
38
  export declare function splitAnswers(questions: any[], answer: unknown): Record<string, string>;
29
39
  /** 문항별 정답(화면 값, 주관식은 허용 답 배열) → pattern 정답 정규식 하나 */
30
- export declare function buildAnswerKey(questions: any[], key: Record<string, any>): string;
40
+ export declare function buildAnswerKey(
41
+ questions: any[],
42
+ key: Record<string, any>,
43
+ format?: number
44
+ ): string;
45
+ /** 주관식 정답 입력 방식이 정규식인지 (answerMode 'regex') */
46
+ export declare function isRegexMode(q: any): boolean;
47
+ /** 작성자 정규식 → 서버 정답 조각(body) · 채점 테스트용 식(test, u 플래그) · 바꾼 것(notes) 또는 막는 문법(error) */
48
+ export declare function compileTextRegex(source: string): {
49
+ body?: string;
50
+ test?: string;
51
+ notes: string[];
52
+ error?: string;
53
+ detail?: string;
54
+ };
55
+ /** 채점 테스트: 이 답이 서버에서 정답인지 (정규식이 틀리면 null) */
56
+ export declare function testTextRegex(source: string, answer: string): boolean | null;
57
+ /** 글자만으로 된 a|b 정규식 → 허용 답 목록, 아니면 null */
58
+ export declare function regexToList(source: string): string[] | null;
59
+ /** 허용 답 목록 → 같은 뜻의 정규식 */
60
+ export declare function listToRegex(list: string[]): string;
31
61
  /** buildAnswerKey가 만든 정규식 → 문항별 정답. 다른 모양이면 null */
32
62
  export declare function parseAnswerKey(
33
63
  questions: any[],
@@ -63,7 +93,8 @@ export declare function checkAnswerKey(
63
93
  questions: any[],
64
94
  key: Record<string, any>,
65
95
  regex: string,
66
- messages: Record<string, any>
96
+ messages: Record<string, any>,
97
+ format?: number
67
98
  ): { questionIndex: number; message: string } | null;
68
99
  export declare function shuffled<T>(items: T[], seed: string): T[];
69
100
  /** 문항별 부분 점수 채점 방식 이름 */
@@ -74,9 +105,17 @@ export declare function gradingTypeOf(
74
105
  grading: unknown
75
106
  ): 'pattern' | 'partial_pattern';
76
107
  /** 문항별 답 → 제출할 문자열 배열 (partial_pattern) */
77
- export declare function joinAnswerList(questions: any[], values: unknown[]): string[];
108
+ export declare function joinAnswerList(
109
+ questions: any[],
110
+ values: unknown[],
111
+ format?: number
112
+ ): string[];
78
113
  /** 문항별 정답 → 문항마다 정답 정규식 (partial_pattern) */
79
- export declare function buildAnswerKeys(questions: any[], key: Record<string, any>): string[];
114
+ export declare function buildAnswerKeys(
115
+ questions: any[],
116
+ key: Record<string, any>,
117
+ format?: number
118
+ ): string[];
80
119
  /** buildAnswerKeys가 만든 정규식 배열 → 문항별 정답. 다른 모양이면 null */
81
120
  export declare function parseAnswerKeys(
82
121
  questions: any[],
@@ -87,7 +126,8 @@ export declare function checkAnswerKeys(
87
126
  questions: any[],
88
127
  key: Record<string, any>,
89
128
  keys: string[],
90
- messages: Record<string, any>
129
+ messages: Record<string, any>,
130
+ format?: number
91
131
  ): { questionIndex: number; message: string } | null;
92
132
  /** 저장할 문항별 점수: 저장된 정규식의 문제 id로 맞춰 지금 순서로, 문제 id가 다르면 split으로 다시 나눔 */
93
133
  export declare function scoresFor(