#quiz #testing #markdown #quizzes #answer #grade #arguments

bin+lib quixote

Markdown 中的测验和测试

12 个版本 (5 个破坏性更新)

0.6.0 2024 年 7 月 31 日
0.5.1 2024 年 4 月 22 日
0.4.0 2023 年 12 月 12 日
0.3.2 2023 年 12 月 11 日
0.1.3 2023 年 12 月 7 日

#133 in 文本处理

Download history 169/week @ 2024-04-19 37/week @ 2024-04-26 3/week @ 2024-05-03 4/week @ 2024-05-17 2/week @ 2024-05-24 16/week @ 2024-07-05 115/week @ 2024-07-26 21/week @ 2024-08-02

每月 136 次下载

MIT 许可证

46KB
787

使用方法

$ quixote -h
Quizzes and tests in Markdown

<https://crates.io/crates/quixote> / <https://github.com/qtfkwk/quixote>

---

Usage: quixote [OPTIONS] [PATH/GLOB]...

Arguments:
  [PATH/GLOB]...  

Options:
  -q <PATH>              Generate quiz(zes)
  -a <answers.json>      Grade quiz(zes)
  -r                     Print readme
  -h, --help             Print help
  -V, --version          Print version
$ quixote -V
quixote 0.6.0

示例

创建包含问题和答案的 Markdown 文件

  • 使用多个文件组织问题,并允许从任何子集生成测验。
  • 在一个或多个段落中编写问题,可选地使用任何 Markdown span 语法和/或表格、图片、列表等。
  • 将答案放在所有问题内容之后,作为无序列表,正确答案加粗/加粗。
  • 在问题之间使用一条 规则 (---)。

生成测验

quixote example/src -q example/1
  • 测验包括所有问题和答案,顺序随机。

  • 要从源文件的子集中生成测验,请使用一个或多个路径或通配符指定它;例如,要只包括来自 addition.mdsubtraction.md 的问题,命令是

    quixote example/src/addition.md example/src/subtraction.md \
    -q example/addition-subtraction
    
  • 路径/通配符参数

    • 文件或目录的绝对或相对路径
    • 使用您的 shell 的通配符。
    • 如果使用 -q 选项并且参数是目录,则将其转换为 directory/**/*.md 以包括目录下的所有 *.md 文件。
    • 通过正确引用和/或转义参数,使用内置的通配符。有关更多详细信息,请参阅下面的通配符参考部分

评分测验

完成测验(period-1.json

{
  "description": "Quiz 1 - Period 1",
  "students": {
    "Alvin Anderson":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Beatrice Brown":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Chris Clark":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Denise Dixon":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Erik Edwards":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Francesca Franklin":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "George Green":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Harriet Halloway":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Isabelle Izzard":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "James Jones":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Kelly Kennedy":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Lawrence Lewis":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Michelle Miller":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Nikolai Nixon":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Olga Olson":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Patrick Poole":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Qira Quinn":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Ralph Rogers":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Sally Smith":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Thomas Taylor":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Ursula Upton":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Victor Vogel":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Winnie Walters":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Xavier Xerxes":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Yasmine York":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]},
    "Zander Zuckerman":{"1":["A"],"2":["A"],"3":["C"],"4":["A"],"5":["D","A","C","B"],"6":["D","A","C","B"],"7":["C"],"8":["D"],"9":["A","B","C","D","E","F"],"10":["B"],"11":["C","G"],"12":["D"]}
  }
}

答案键(answers.json

{"1":[["A"],false],"2":[["A"],false],"3":[["C"],false],"4":[["A"],false],"5":[["D","A","C","B"],true],"6":[["D","A","C","B"],true],"7":[["C"],false],"8":[["D"],false],"9":[["A","B","C","D","E","F"],false],"10":[["B"],false],"11":[["C","G"],false],"12":[["D"],false]}

运行

quixote -a example/1/answers.json example/1/period-1.json \
>example/1/period-1.md

输出(period-1.md

# Quiz 1 - Period 1

| Name               | Score | Percent | Grade | Questions |
|--------------------|------:|--------:|-------|-----------|
| Alvin Anderson     |    24 |  100.0% | A     |           |
| Beatrice Brown     |    24 |  100.0% | A     |           |
| Chris Clark        |    24 |  100.0% | A     |           |
| Denise Dixon       |    24 |  100.0% | A     |           |
| Erik Edwards       |    24 |  100.0% | A     |           |
| Francesca Franklin |    24 |  100.0% | A     |           |
| George Green       |    24 |  100.0% | A     |           |
| Harriet Halloway   |    24 |  100.0% | A     |           |
| Isabelle Izzard    |    24 |  100.0% | A     |           |
| James Jones        |    24 |  100.0% | A     |           |
| Kelly Kennedy      |    24 |  100.0% | A     |           |
| Lawrence Lewis     |    24 |  100.0% | A     |           |
| Michelle Miller    |    24 |  100.0% | A     |           |
| Nikolai Nixon      |    24 |  100.0% | A     |           |
| Olga Olson         |    24 |  100.0% | A     |           |
| Patrick Poole      |    24 |  100.0% | A     |           |
| Qira Quinn         |    24 |  100.0% | A     |           |
| Ralph Rogers       |    24 |  100.0% | A     |           |
| Sally Smith        |    24 |  100.0% | A     |           |
| Thomas Taylor      |    24 |  100.0% | A     |           |
| Ursula Upton       |    24 |  100.0% | A     |           |
| Victor Vogel       |    24 |  100.0% | A     |           |
| Winnie Walters     |    24 |  100.0% | A     |           |
| Xavier Xerxes      |    24 |  100.0% | A     |           |
| Yasmine York       |    24 |  100.0% | A     |           |
| Zander Zuckerman   |    24 |  100.0% | A     |           |

| Description         | Value | Percent | Grade |
|---------------------|------:|--------:|-------|
| Number of students  |    26 |         |       |
| Number of questions |    12 |         |       |
| Total points        |    24 |         |       |
| High score          |    24 |  100.0% | A     |
| Low score           |    24 |  100.0% | A     |
| Mean score          |    24 |  100.0% | A     |
| A                   |    26 |  100.0% |       |
| B                   |     0 |    0.0% |       |
| C                   |     0 |    0.0% |       |
| D                   |     0 |    0.0% |       |
| F                   |     0 |    0.0% |       |

变更日志

  • 0.1.0(2023-12-06):初始版本
    • 0.1.1(2023-12-06):将测验评分报告保存到文件
    • 0.1.2(2023-12-06):修复拼写错误
    • 0.1.3(2023-12-07):整理说明和代码
  • 0.2.0(2023-12-07):简化设计:现在 -g-q,改进表格;调试:bat分页器,不要创建测验目录;修复拼写错误
  • 0.3.0(2023-12-08):将答案列表改为任务列表;其他优化和代码整理;改进示例;更新依赖
    • 0.3.1(2023-12-08):在摘要表格中对值和百分比列进行右对齐
    • 0.3.2(2023-12-11):取消 Stat 属性的字符串化;修复Markdown表格函数;更新依赖
  • 0.4.0(2023-12-12):使用 veg 生成Markdown表格
  • 0.5.0(2024-04-22):添加匹配题;更新依赖
    • 0.5.1(2024-04-22):更新依赖
  • 0.6.0(2024-07-31):排序是非题答案;修复makefile;修复变更日志;更新依赖

参考

通配符

  • ? 匹配任意单个字符。
  • * 匹配任意(可能为空)的字符序列。
  • ** 匹配当前目录和任意子目录。此序列必须形成一个单独的路径组件,因此 **ab** 都是无效的,并将导致错误。超过两个连续的 * 字符序列也是无效的。
  • [...] 匹配方括号内的任意字符。字符序列也可以指定Unicode排序顺序中的字符范围,例如,[0-9] 指定0到9(包括)之间的任意字符。未关闭的方括号是无效的。
  • [!...][...] 的否定,即它匹配不在方括号内的字符。
  • 元字符 ?*[] 可以通过使用括号(例如 [?])进行匹配。当一个 ] 紧接着 [[! 出现时,它被解释为字符集的一部分,而不是结束,因此 []] 和 NOT [!]] 可以分别匹配。字符 - 可以通过将其放置在字符序列模式的开始或结束处来指定,例如 [abc-]

来源:[Pattern 结构体的文档]

另请参阅 [glob](https://crates.org.cn/crates/glob) 或 [docs.rs](https://docs.rs/glob)。

依赖项

~5–6.5MB
~116K SLoC