diff --git a/README.md b/README.md index c29f49d..8dda531 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Simply run `hascard` to open the main application. Menu navigation can be done w The CLI provides some options for running hascard; to see them all run `hascard -h`. As an example, say you have a file `deck.txt` with lots of cards in it and you want to review 5 random ones, you can use `hascard deck -s -a 5`. Here `-s` shuffles the deck and `-a 5` specifies we only want to look at 5 of them. ## Cards -Decks of cards are written in `.txt` files. Cards are seperated with a line containing three dashes `---`. For examples, see the [`/cards`](https://github.com/Yvee1/hascard/tree/master/cards) directory. In this section the 4 different cards are listed, with the syntax and how it is represented in the application. +Decks of cards are written in `.txt` files. Cards are seperated with a line containing three dashes `---`. For examples, see the [`/cards`](https://github.com/Yvee1/hascard/tree/master/cards) directory. In this section the 5 different types of cards are listed, with the syntax and how it is represented in the application. ### Definition This is the simplest card, it simply has a title and can be flipped to show the contents. For example the following card @@ -94,5 +94,18 @@ The symbol € is for the currency named _Euro_, and is used in the _EU|European behaves like this ![](./recordings/gapped-question.gif) +### Reorder question +This is a question where you have to put the elements in the correct order. Each element is preceded by a number indicating their correct place. The elements are rendered in the same order as they are written. For example the card + +``` +# Order the letters in alphabetical order +4. u +1. l +2. p +3. s +``` +will look like +![](./recordings/reordering.gif) + ## Miscellaneous info Written in Haskell, UI built with [brick](https://github.com/jtdaugherty/brick) and parsing of cards done with [parsec](https://github.com/haskell/parsec). Recordings of the terminal were made using [terminalizer](https://github.com/faressoft/terminalizer). The filebrowser widget was mostly copied from the brick [filebrowser demo program](https://github.com/jtdaugherty/brick/blob/master/programs/FileBrowserDemo.hs). Homebrew and Travis configurations were made much easier by [the tutorial from Chris Penner](https://chrispenner.ca/posts/homebrew-haskell). diff --git a/recordings/gapped-question.yml b/recordings/gapped-question.yml index 29afb39..952f0b7 100644 --- a/recordings/gapped-question.yml +++ b/recordings/gapped-question.yml @@ -111,62 +111,6 @@ config: # Records, feel free to edit them records: - # - delay: 870 - # content: "\e[1m\e[7m%\e[27m\e[1m\e[0m \r \r\e]2;..skell/hascard\a" - # - delay: 36 - # content: "\r\e[0m\e[27m\e[24m\e[J\e[01;32m➜ \e[36mhascard\e[00m \e[01;34mgit:(\e[31mmaster\e[34m) \e[33m✗\e[00m \e[K\e[?1h\e=\e[?2004h" - # - delay: 401 - # content: "h\e[90mascard\e[39m\b\b\b\b\b\b" - # - delay: 106 - # content: "\bh\e[39ma" - # - delay: 54 - # content: "\e[39ms" - # - delay: 71 - # content: "\e[39mk\e[39m \e[39m \e[39m \b\b\b" - # - delay: 86 - # content: e - # - delay: 78 - # content: l - # - delay: 326 - # content: "\b \b" - # - delay: 122 - # content: "\b \b" - # - delay: 126 - # content: "\b\e[90mc\e[90mard\e[39m\b\b\b\b" - # - delay: 148 - # content: "\e[39mc" - # - delay: 195 - # content: "\e[39ma" - # - delay: 40 - # content: "\e[39mr" - # - delay: 78 - # content: "\e[39md" - # - delay: 106 - # content: "\e[?1l\e>\e[?2004l\r\r\n\e]2;hascard\a" - # - delay: 15 - # content: "\e[5 q\e[?1049h\e[22;0;0t\e[H\e[2J" - # - delay: 13 - # content: "\e[?25l\e[1;1H\e(B\e[m \e[2;1H\e(B\e[m \e[3;1H\e(B\e[m \e[4;1H\e(B\e[m \e[5;1H\e(B\e[m \e[6;1H\e(B\e[m \e[7;1H\e(B\e[m ╭────────────────────────────────────────╮ \e[8;1H\e(B\e[m │ \e[33m┬ ┬┌─┐┌─┐┌─┐┌─┐┬─┐┌┬┐\e(B\e[m │ \e[9;1H\e(B\e[m │ \e[33m├─┤├─┤└─┐│ ├─┤├┬┘ ││\e(B\e[m │ \e[10;1H\e(B\e[m │ \e[33m┴ ┴┴ ┴└─┘└─┘┴ ┴┴└──┴┘\e(B\e[m │ \e[11;1H\e(B\e[m ├────────────────────────────────────────┤ \e[12;1H\e(B\e[m │ \e[4m\e[37mSelect\e(B\e[m │ \e[13;1H\e(B\e[m │ Info │ \e[14;1H\e(B\e[m │ Settings │ \e[15;1H\e(B\e[m │ Quit │ \e[16;1H\e(B\e[m ╰────────────────────────────────────────╯ \e[17;1H\e(B\e[m \e[18;1H\e(B\e[m \e[19;1H\e(B\e[m \e[20;1H\e(B\e[m \e[21;1H\e(B\e[m \e[22;1H\e(B\e[m " - # - delay: 565 - # content: "\e[?1049l\e[23;0;0t\e[?12l\e[?25h\e(B\e[m\e[?12l\e[?25h\e[?1049h\e[22;0;0t\e[H\e[2J" - # - delay: 19 - # content: "\e[?25l\e[1;1H\e(B\e[m \e[2;1H\e(B\e[m \e[3;1H\e(B\e[m \e[4;1H\e(B\e[m \e[5;1H\e(B\e[m \e[6;1H\e(B\e[m \e[7;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[8;1H\e(B\e[m │\e[33m Select a deck of flashcards \e(B\e[m│ \e[9;1H\e(B\e[m ├───────────────────────────────────────────────┤ \e[10;1H\e(B\e[m │ \e[4m\e[37mexample\e(B\e[m │ \e[11;1H\e(B\e[m │ test │ \e[12;1H\e(B\e[m │ analysis3 │ \e[13;1H\e(B\e[m │ syntax │ \e[14;1H\e(B\e[m │ \e[34mSelect file from system\e(B\e[m │ \e[15;1H\e(B\e[m │ │ \e[16;1H\e(B\e[m ╰───────────────────────────────────────────────╯ \e[17;1H\e(B\e[m \e[18;1H\e(B\e[m \e[19;1H\e(B\e[m \e[20;1H\e(B\e[m \e[21;1H\e(B\e[m \e[22;1H\e(B\e[m " - # - delay: 302 - # content: "\e[?25l\e[10;1H\e(B\e[m │ example │ \e[11;1H\e(B\e[m │ \e[4m\e[37mtest\e(B\e[m │ " - # - delay: 163 - # content: "\e[?25l\e[11;1H\e(B\e[m │ test │ \e[12;1H\e(B\e[m │ \e[4m\e[37manalysis3\e(B\e[m │ " - # - delay: 158 - # content: "\e[?25l\e[12;1H\e(B\e[m │ analysis3 │ \e[13;1H\e(B\e[m │ \e[4m\e[37msyntax\e(B\e[m │ " - # - delay: 1584 - # content: "\e[?1049l\e[23;0;0t\e[?12l\e[?25h\e(B\e[m\e[?12l\e[?25h" - # - delay: 8 - # content: "\e[?1049h\e[22;0;0t\e[H\e[2J" - # - delay: 5 - # content: "\e[?25l\e[1;1H\e(B\e[m \e[2;1H\e(B\e[m \e[3;1H\e(B\e[m \e[4;1H\e(B\e[m \e[5;1H\e(B\e[m \e[6;1H\e(B\e[m \e[7;1H\e(B\e[m \e[8;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[9;1H\e(B\e[m │\e[33m Word or question \e(B\e[m│ \e[10;1H\e(B\e[m ├───────────────────────────────────────────────┤ \e[11;1H\e(B\e[m │ │ \e[12;1H\e(B\e[m │ │ \e[13;1H\e(B\e[m │ │ \e[14;1H\e(B\e[m │ 1/4 │ \e[15;1H\e(B\e[m ╰───────────────────────────────────────────────╯ \e[16;1H\e(B\e[m \e[17;1H\e(B\e[m \e[18;1H\e(B\e[m \e[19;1H\e(B\e[m \e[20;1H\e(B\e[m \e[21;1H\e(B\e[m \e[22;1H\e(B\e[m " - # - delay: 1181 - # content: "\e[?25l\e[6;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[7;1H\e(B\e[m │\e[33m Multiple choice question, (only one answer is \e(B\e[m│ \e[8;1H\e(B\e[m │\e[33m right) \e(B\e[m│ \e[9;1H\e(B\e[m ├───────────────────────────────────────────────┤ \e[10;1H\e(B\e[m │ \e[33m* \e(B\e[mChoice 1 │ \e[11;1H\e(B\e[m │ Choice 2 (this is the correct answer) │ \e[12;1H\e(B\e[m │ Choice 3 │ \e[13;1H\e(B\e[m │ Choice 4 │ \e[14;1H\e(B\e[m │ │ \e[15;1H\e(B\e[m │ 2/4 │ \e[16;1H\e(B\e[m ╰───────────────────────────────────────────────╯ " - # - delay: 547 - # content: "\e[?25l\e[6;1H\e(B\e[m \e[7;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[8;1H\e(B\e[m │\e[33m Multiple answer question \e(B\e[m│ \e[10;1H\e(B\e[m │[\e[33m*\e(B\e[m] Option 1 (this is a correct answer) │ \e[11;1H\e(B\e[m │[ ] Option 2 │ \e[12;1H\e(B\e[m │[ ] Option 3 (this is a correct answer) │ \e[13;1H\e(B\e[m │[ ] Option 4 │ \e[14;1H\e(B\e[m │ │ \e[15;1H\e(B\e[m │ 3/4 │ " - delay: 1250 content: "\e[?25l\e[7;1H\e(B\e[m \e[8;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[9;1H\e(B\e[m │\e[33m Fill in the gaps \e(B\e[m│ \e[10;1H\e(B\e[m ├───────────────────────────────────────────────┤ \e[11;1H\e(B\e[m │ The symbol € is for the currency named , and │ \e[12;1H\e(B\e[m │ is used in the . │ \e[13;1H\e(B\e[m │ │ \e[14;1H\e(B\e[m │ 4/4 │ \e[15;1H\e(B\e[m ╰───────────────────────────────────────────────╯ \e[16;1H\e(B\e[m \e[?12l\e[?25h\e[11;57H" - delay: 7312 @@ -194,16 +138,4 @@ records: - delay: 278 content: "\e[?25l\e[12;1H\e(B\e[m │ and is used in the \e[4m\e[31mEU\e(B\e[m. │ \e[?12l\e[?25h\e[12;39H" - delay: 575 - content: "\e[?25l\e[12;1H\e(B\e[m │ and is used in the \e[4m\e[32mEU\e(B\e[m. │ \e[?12l\e[?25h\e[12;39H" - # - delay: 1217 - # content: "\e[?1049l\e[23;0;0t\e[?12l\e[?25h\e(B\e[m\e[?12l\e[?25h\e[?1049h\e[22;0;0t\e[H\e[2J" - # - delay: 16 - # content: "\e[?25l\e[1;1H\e(B\e[m \e[2;1H\e(B\e[m \e[3;1H\e(B\e[m \e[4;1H\e(B\e[m \e[5;1H\e(B\e[m \e[6;1H\e(B\e[m \e[7;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[8;1H\e(B\e[m │\e[33m Select a deck of flashcards \e(B\e[m│ \e[9;1H\e(B\e[m ├───────────────────────────────────────────────┤ \e[10;1H\e(B\e[m │ example │ \e[11;1H\e(B\e[m │ test │ \e[12;1H\e(B\e[m │ analysis3 │ \e[13;1H\e(B\e[m │ \e[4m\e[37msyntax\e(B\e[m │ \e[14;1H\e(B\e[m │ \e[34mSelect file from system\e(B\e[m │ \e[15;1H\e(B\e[m │ │ \e[16;1H\e(B\e[m ╰───────────────────────────────────────────────╯ \e[17;1H\e(B\e[m \e[18;1H\e(B\e[m \e[19;1H\e(B\e[m \e[20;1H\e(B\e[m \e[21;1H\e(B\e[m \e[22;1H\e(B\e[m " - # - delay: 811 - # content: "\e[?1049l\e[23;0;0t\e[?12l\e[?25h\e(B\e[m\e[?12l\e[?25h\e[?1049h\e[22;0;0t\e[H\e[2J" - # - delay: 178 - # content: "[1] 42421 segmentation fault (core dumped) hascard\r\n\e[1m\e[7m%\e[27m\e[1m\e[0m \r \r\e]2;..skell/hascard\a" - # - delay: 31 - # content: "\r\e[0m\e[27m\e[24m\e[J\e[01;31m➜ \e[36mhascard\e[00m \e[01;34mgit:(\e[31mmaster\e[34m) \e[33m✗\e[00m \e[K\e[?1h\e=\e[?2004h" - # - delay: 2216 - # content: "\e[?2004l\r\r\n" + content: "\e[?25l\e[12;1H\e(B\e[m │ and is used in the \e[4m\e[32mEU\e(B\e[m. │ \e[?12l\e[?25h\e[12;39H" \ No newline at end of file diff --git a/recordings/multiple-answer.yml b/recordings/multiple-answer.yml index 70d6f43..ef8ce41 100644 --- a/recordings/multiple-answer.yml +++ b/recordings/multiple-answer.yml @@ -111,80 +111,6 @@ config: # Records, feel free to edit them records: - # - delay: 891 - # content: "\e[1m\e[7m%\e[27m\e[1m\e[0m \r \r\e]2;..skell/hascard\a" - # - delay: 35 - # content: "\r\e[0m\e[27m\e[24m\e[J\e[01;32m➜ \e[36mhascard\e[00m \e[01;34mgit:(\e[31mmaster\e[34m) \e[33m✗\e[00m \e[K\e[?1h\e=\e[?2004h" - # - delay: 311 - # content: "h\e[90mascard\e[39m\b\b\b\b\b\b" - # - delay: 84 - # content: "\bh\e[39ma" - # - delay: 46 - # content: "\e[39ms" - # - delay: 189 - # content: "\e[39mc" - # - delay: 122 - # content: "\e[39ma" - # - delay: 103 - # content: "\e[39mr" - # - delay: 73 - # content: "\e[39md" - # - delay: 147 - # content: "\e[?1l\e>\e[?2004l\r\r\n\e]2;hascard\a" - # - delay: 9 - # content: "\e[5 q\e[?1049h\e[22;0;0t\e[H\e[2J" - # - delay: 16 - # content: "\e[?25l\e[1;1H\e(B\e[m \e[2;1H\e(B\e[m \e[3;1H\e(B\e[m \e[4;1H\e(B\e[m \e[5;1H\e(B\e[m \e[6;1H\e(B\e[m \e[7;1H\e(B\e[m ╭────────────────────────────────────────╮ \e[8;1H\e(B\e[m │ \e[33m┬ ┬┌─┐┌─┐┌─┐┌─┐┬─┐┌┬┐\e(B\e[m │ \e[9;1H\e(B\e[m │ \e[33m├─┤├─┤└─┐│ ├─┤├┬┘ ││\e(B\e[m │ \e[10;1H\e(B\e[m │ \e[33m┴ ┴┴ ┴└─┘└─┘┴ ┴┴└──┴┘\e(B\e[m │ \e[11;1H\e(B\e[m ├────────────────────────────────────────┤ \e[12;1H\e(B\e[m │ \e[4m\e[37mSelect\e(B\e[m │ \e[13;1H\e(B\e[m │ Info │ \e[14;1H\e(B\e[m │ Settings │ \e[15;1H\e(B\e[m │ Quit │ \e[16;1H\e(B\e[m ╰────────────────────────────────────────╯ \e[17;1H\e(B\e[m \e[18;1H\e(B\e[m \e[19;1H\e(B\e[m \e[20;1H\e(B\e[m \e[21;1H\e(B\e[m \e[22;1H\e(B\e[m " - # - delay: 397 - # content: "\e[?1049l\e[23;0;0t\e[?12l\e[?25h\e(B\e[m\e[?12l\e[?25h\e[?1049h\e[22;0;0t\e[H\e[2J" - # - delay: 12 - # content: "\e[?25l\e[1;1H\e(B\e[m \e[2;1H\e(B\e[m \e[3;1H\e(B\e[m \e[4;1H\e(B\e[m \e[5;1H\e(B\e[m \e[6;1H\e(B\e[m \e[7;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[8;1H\e(B\e[m │\e[33m Select a deck of flashcards \e(B\e[m│ \e[9;1H\e(B\e[m ├───────────────────────────────────────────────┤ \e[10;1H\e(B\e[m │ \e[4m\e[37mexample\e(B\e[m │ \e[11;1H\e(B\e[m │ test │ \e[12;1H\e(B\e[m │ analysis3 │ \e[13;1H\e(B\e[m │ syntax │ \e[14;1H\e(B\e[m │ \e[34mSelect file from system\e(B\e[m │ \e[15;1H\e(B\e[m │ │ \e[16;1H\e(B\e[m ╰───────────────────────────────────────────────╯ \e[17;1H\e(B\e[m \e[18;1H\e(B\e[m \e[19;1H\e(B\e[m \e[20;1H\e(B\e[m \e[21;1H\e(B\e[m \e[22;1H\e(B\e[m " - # - delay: 319 - # content: "\e[?25l\e[10;1H\e(B\e[m │ example │ \e[11;1H\e(B\e[m │ \e[4m\e[37mtest\e(B\e[m │ " - # - delay: 155 - # content: "\e[?25l\e[11;1H\e(B\e[m │ test │ \e[12;1H\e(B\e[m │ \e[4m\e[37manalysis3\e(B\e[m │ " - # - delay: 167 - # content: "\e[?25l\e[12;1H\e(B\e[m │ analysis3 │ \e[13;1H\e(B\e[m │ \e[4m\e[37msyntax\e(B\e[m │ " - # - delay: 159 - # content: "\e[?1049l\e[23;0;0t\e[?12l\e[?25h\e(B\e[m\e[?12l\e[?25h\e[?1049h\e[22;0;0t\e[H\e[2J" - # - delay: 14 - # content: "\e[?25l\e[1;1H\e(B\e[m \e[2;1H\e(B\e[m \e[3;1H\e(B\e[m \e[4;1H\e(B\e[m \e[5;1H\e(B\e[m \e[6;1H\e(B\e[m \e[7;1H\e(B\e[m \e[8;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[9;1H\e(B\e[m │\e[33m Word or question \e(B\e[m│ \e[10;1H\e(B\e[m ├───────────────────────────────────────────────┤ \e[11;1H\e(B\e[m │ │ \e[12;1H\e(B\e[m │ │ \e[13;1H\e(B\e[m │ │ \e[14;1H\e(B\e[m │ 1/4 │ \e[15;1H\e(B\e[m ╰───────────────────────────────────────────────╯ \e[16;1H\e(B\e[m \e[17;1H\e(B\e[m \e[18;1H\e(B\e[m \e[19;1H\e(B\e[m \e[20;1H\e(B\e[m \e[21;1H\e(B\e[m \e[22;1H\e(B\e[m " - # - delay: 355 - # content: "\e[?25l\e[11;1H\e(B\e[m │ Explanation or definition of this word, or │ \e[12;1H\e(B\e[m │ the answer to the question. │ \e[13;1H\e(B\e[m │ │ " - # - delay: 226 - # content: "\e[?25l\e[6;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[7;1H\e(B\e[m │\e[33m Multiple choice question, (only one answer is \e(B\e[m│ \e[8;1H\e(B\e[m │\e[33m right) \e(B\e[m│ \e[9;1H\e(B\e[m ├───────────────────────────────────────────────┤ \e[10;1H\e(B\e[m │ \e[33m* \e(B\e[mChoice 1 │ \e[11;1H\e(B\e[m │ Choice 2 (this is the correct answer) │ \e[12;1H\e(B\e[m │ Choice 3 │ \e[13;1H\e(B\e[m │ Choice 4 │ \e[14;1H\e(B\e[m │ │ \e[15;1H\e(B\e[m │ 2/4 │ \e[16;1H\e(B\e[m ╰───────────────────────────────────────────────╯ " - # - delay: 647 - # content: "\e[?25l\e[10;1H\e(B\e[m │ Choice 1 │ \e[11;1H\e(B\e[m │ \e[33m* \e(B\e[mChoice 2 (this is the correct answer) │ " - # - delay: 158 - # content: "\e[?25l\e[11;1H\e(B\e[m │ \e[33m* \e[32mChoice 2 (this is the correct answer) \e(B\e[m │ " - # - delay: 364 - # content: "\e[?25l\e[6;1H\e(B\e[m \e[7;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[8;1H\e(B\e[m │\e[33m Multiple answer question \e(B\e[m│ \e[10;1H\e(B\e[m │[\e[33m*\e(B\e[m] Option 1 (this is a correct answer) │ \e[11;1H\e(B\e[m │[ ] Option 2 │ \e[12;1H\e(B\e[m │[ ] Option 3 (this is a correct answer) │ \e[13;1H\e(B\e[m │[ ] Option 4 │ \e[14;1H\e(B\e[m │ │ \e[15;1H\e(B\e[m │ 3/4 │ " - # - delay: 4723 - # content: "\e[?25l\e[10;1H\e(B\e[m │\e[34m[\e[33m*\e[34m] \e(B\e[mOption 1 (this is a correct answer) │ " - # - delay: 256 - # content: "\e[?25l\e[10;1H\e(B\e[m │\e[34m[*] \e(B\e[mOption 1 (this is a correct answer) │ \e[11;1H\e(B\e[m │[\e[33m*\e(B\e[m] Option 2 │ " - # - delay: 267 - # content: "\e[?25l\e[11;1H\e(B\e[m │[ ] Option 2 │ \e[12;1H\e(B\e[m │[\e[33m*\e(B\e[m] Option 3 (this is a correct answer) │ " - # - delay: 678 - # content: "\e[?25l\e[12;1H\e(B\e[m │\e[34m[\e[33m*\e[34m] \e(B\e[mOption 3 (this is a correct answer) │ " - # - delay: 1223 - # content: "\e[?25l\e[12;1H\e(B\e[m │[\e[33m*\e(B\e[m] Option 3 (this is a correct answer) │ " - # - delay: 3776 - # content: "\e[?25l\e[6;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[7;1H\e(B\e[m │\e[33m Multiple choice question, (only one answer is \e(B\e[m│ \e[8;1H\e(B\e[m │\e[33m right) \e(B\e[m│ \e[10;1H\e(B\e[m │ \e[33m* \e(B\e[mChoice 1 │ \e[11;1H\e(B\e[m │ Choice 2 (this is the correct answer) │ \e[12;1H\e(B\e[m │ Choice 3 │ \e[13;1H\e(B\e[m │ Choice 4 │ \e[14;1H\e(B\e[m │ │ \e[15;1H\e(B\e[m │ 2/4 │ " - # - delay: 1604 - # content: "\e[?25l" - # - delay: 242 - # content: "\e[?25l\e[10;1H\e(B\e[m │ Choice 1 │ \e[11;1H\e(B\e[m │ \e[33m* \e(B\e[mChoice 2 (this is the correct answer) │ " - # - delay: 190 - # content: "\e[?25l\e[11;1H\e(B\e[m │ Choice 2 (this is the correct answer) │ \e[12;1H\e(B\e[m │ \e[33m* \e(B\e[mChoice 3 │ " - # - delay: 191 - # content: "\e[?25l\e[12;1H\e(B\e[m │ \e[33m* \e[31mChoice 3 \e(B\e[m │ " - # - delay: 209 - # content: "\e[?25l" - # - delay: 535 - # content: "\e[?25l\e[11;1H\e(B\e[m │ \e[33m* \e(B\e[mChoice 2 (this is the correct answer) │ \e[12;1H\e(B\e[m │ \e[31mChoice 3 \e(B\e[m │ " - # - delay: 136 - # content: "\e[?25l\e[11;1H\e(B\e[m │ \e[33m* \e[32mChoice 2 (this is the correct answer) \e(B\e[m │ " - delay: 2000 content: "\e[?25l\e[6;1H\e(B\e[m \e[7;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[8;1H\e(B\e[m │\e[33m Multiple answer question \e(B\e[m│ \e[9;1H\e(B\e[m ├───────────────────────────────────────────────┤ \e[10;1H\e(B\e[m │[\e[33m*\e(B\e[m] Option 1 (this is a correct answer) │ \e[11;1H\e(B\e[m │[ ] Option 2 │ \e[12;1H\e(B\e[m │[ ] Option 3 (this is a correct answer) │ \e[13;1H\e(B\e[m │[ ] Option 4 │ \e[14;1H\e(B\e[m │ │ \e[15;1H\e(B\e[m │ 3/4 │ \e[16;1H\e(B\e[m ╰───────────────────────────────────────────────╯ " - delay: 1500 @@ -196,22 +122,4 @@ records: - delay: 559 content: "\e[?25l\e[12;1H\e(B\e[m │\e[34m[\e[33m*\e[34m] \e(B\e[mOption 3 (this is a correct answer) │ " - delay: 725 - content: "\e[?25l\e[10;1H\e(B\e[m │\e[32m[*] \e(B\e[mOption 1 (this is a correct answer) │ \e[11;1H\e(B\e[m │\e[32m[ ] \e(B\e[mOption 2 │ \e[12;1H\e(B\e[m │\e[32m[*] \e(B\e[mOption 3 (this is a correct answer) │ \e[13;1H\e(B\e[m │\e[32m[ ] \e(B\e[mOption 4 │ " - # - delay: 2843 - # content: "\e[?25l\e[7;1H\e(B\e[m \e[8;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[9;1H\e(B\e[m │\e[33m Fill in the gaps \e(B\e[m│ \e[10;1H\e(B\e[m ├───────────────────────────────────────────────┤ \e[11;1H\e(B\e[m │ The symbol € is for the currency named , and │ \e[12;1H\e(B\e[m │ is used in the . │ \e[13;1H\e(B\e[m │ │ \e[14;1H\e(B\e[m │ 4/4 │ \e[15;1H\e(B\e[m ╰───────────────────────────────────────────────╯ \e[16;1H\e(B\e[m \e[?12l\e[?25h\e[11;57H" - # - delay: 2806 - # content: "\e[?1049l\e[23;0;0t\e[?12l\e[?25h\e(B\e[m\e[?12l\e[?25h\e[?1049h\e[22;0;0t\e[H\e[2J" - # - delay: 14 - # content: "\e[?25l\e[1;1H\e(B\e[m \e[2;1H\e(B\e[m \e[3;1H\e(B\e[m \e[4;1H\e(B\e[m \e[5;1H\e(B\e[m \e[6;1H\e(B\e[m \e[7;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[8;1H\e(B\e[m │\e[33m Select a deck of flashcards \e(B\e[m│ \e[9;1H\e(B\e[m ├───────────────────────────────────────────────┤ \e[10;1H\e(B\e[m │ example │ \e[11;1H\e(B\e[m │ test │ \e[12;1H\e(B\e[m │ analysis3 │ \e[13;1H\e(B\e[m │ \e[4m\e[37msyntax\e(B\e[m │ \e[14;1H\e(B\e[m │ \e[34mSelect file from system\e(B\e[m │ \e[15;1H\e(B\e[m │ │ \e[16;1H\e(B\e[m ╰───────────────────────────────────────────────╯ \e[17;1H\e(B\e[m \e[18;1H\e(B\e[m \e[19;1H\e(B\e[m \e[20;1H\e(B\e[m \e[21;1H\e(B\e[m \e[22;1H\e(B\e[m " - # - delay: 190 - # content: "\e[?1049l\e[23;0;0t\e[?12l\e[?25h\e(B\e[m\e[?12l\e[?25h\e[?1049h\e[22;0;0t\e[H\e[2J" - # - delay: 5 - # content: "\e[?25l\e[1;1H\e(B\e[m \e[2;1H\e(B\e[m \e[3;1H\e(B\e[m \e[4;1H\e(B\e[m \e[5;1H\e(B\e[m \e[6;1H\e(B\e[m \e[7;1H\e(B\e[m ╭────────────────────────────────────────╮ \e[8;1H\e(B\e[m │ \e[33m┬ ┬┌─┐┌─┐┌─┐┌─┐┬─┐┌┬┐\e(B\e[m │ \e[9;1H\e(B\e[m │ \e[33m├─┤├─┤└─┐│ ├─┤├┬┘ ││\e(B\e[m │ \e[10;1H\e(B\e[m │ \e[33m┴ ┴┴ ┴└─┘└─┘┴ ┴┴└──┴┘\e(B\e[m │ \e[11;1H\e(B\e[m ├────────────────────────────────────────┤ \e[12;1H\e(B\e[m │ \e[4m\e[37mSelect\e(B\e[m │ \e[13;1H\e(B\e[m │ Info │ \e[14;1H\e(B\e[m │ Settings │ \e[15;1H\e(B\e[m │ Quit │ \e[16;1H\e(B\e[m ╰────────────────────────────────────────╯ \e[17;1H\e(B\e[m \e[18;1H\e(B\e[m \e[19;1H\e(B\e[m \e[20;1H\e(B\e[m \e[21;1H\e(B\e[m \e[22;1H\e(B\e[m " - # - delay: 337 - # content: "\e[?1049l\e[23;0;0t\e[?12l\e[?25h\e(B\e[m\e[?12l\e[?25h" - # - delay: 6 - # content: "\e[1m\e[7m%\e[27m\e[1m\e[0m \r \r\e]2;..skell/hascard\a" - # - delay: 58 - # content: "\r\e[0m\e[27m\e[24m\e[J\e[01;32m➜ \e[36mhascard\e[00m \e[01;34mgit:(\e[31mmaster\e[34m) \e[33m✗\e[00m \e[K\e[?1h\e=\e[?2004h" - # - delay: 677 - # content: "\e[?2004l\r\r\n" + content: "\e[?25l\e[10;1H\e(B\e[m │\e[32m[*] \e(B\e[mOption 1 (this is a correct answer) │ \e[11;1H\e(B\e[m │\e[32m[ ] \e(B\e[mOption 2 │ \e[12;1H\e(B\e[m │\e[32m[*] \e(B\e[mOption 3 (this is a correct answer) │ \e[13;1H\e(B\e[m │\e[32m[ ] \e(B\e[mOption 4 │ " \ No newline at end of file diff --git a/recordings/multiple-choice.yml b/recordings/multiple-choice.yml index 8ba9943..2a8e29f 100644 --- a/recordings/multiple-choice.yml +++ b/recordings/multiple-choice.yml @@ -111,44 +111,6 @@ config: # Records, feel free to edit them records: - # - delay: 828 - # content: "\e[1m\e[7m%\e[27m\e[1m\e[0m \r \r\e]2;..skell/hascard\a" - # - delay: 35 - # content: "\r\e[0m\e[27m\e[24m\e[J\e[01;32m➜ \e[36mhascard\e[00m \e[01;34mgit:(\e[31mmaster\e[34m) \e[33m✗\e[00m \e[K\e[?1h\e=\e[?2004h" - # - delay: 581 - # content: "h\e[90mascard\e[39m\b\b\b\b\b\b" - # - delay: 107 - # content: "\bh\e[39ma" - # - delay: 64 - # content: "\e[39ms" - # - delay: 187 - # content: "\e[39mc" - # - delay: 110 - # content: "\e[39ma" - # - delay: 109 - # content: "\e[39mr" - # - delay: 82 - # content: "\e[39md" - # - delay: 141 - # content: "\e[?1l\e>\e[?2004l\r\r\n\e]2;hascard\a" - # - delay: 12 - # content: "\e[5 q\e[?1049h\e[22;0;0t\e[H\e[2J" - # - delay: 13 - # content: "\e[?25l\e[1;1H\e(B\e[m \e[2;1H\e(B\e[m \e[3;1H\e(B\e[m \e[4;1H\e(B\e[m \e[5;1H\e(B\e[m \e[6;1H\e(B\e[m \e[7;1H\e(B\e[m ╭────────────────────────────────────────╮ \e[8;1H\e(B\e[m │ \e[33m┬ ┬┌─┐┌─┐┌─┐┌─┐┬─┐┌┬┐\e(B\e[m │ \e[9;1H\e(B\e[m │ \e[33m├─┤├─┤└─┐│ ├─┤├┬┘ ││\e(B\e[m │ \e[10;1H\e(B\e[m │ \e[33m┴ ┴┴ ┴└─┘└─┘┴ ┴┴└──┴┘\e(B\e[m │ \e[11;1H\e(B\e[m ├────────────────────────────────────────┤ \e[12;1H\e(B\e[m │ \e[4m\e[37mSelect\e(B\e[m │ \e[13;1H\e(B\e[m │ Info │ \e[14;1H\e(B\e[m │ Settings │ \e[15;1H\e(B\e[m │ Quit │ \e[16;1H\e(B\e[m ╰────────────────────────────────────────╯ \e[17;1H\e(B\e[m \e[18;1H\e(B\e[m \e[19;1H\e(B\e[m \e[20;1H\e(B\e[m \e[21;1H\e(B\e[m \e[22;1H\e(B\e[m " - # - delay: 797 - # content: "\e[?1049l\e[23;0;0t\e[?12l\e[?25h\e(B\e[m\e[?12l\e[?25h\e[?1049h\e[22;0;0t\e[H\e[2J" - # - delay: 14 - # content: "\e[?25l\e[1;1H\e(B\e[m \e[2;1H\e(B\e[m \e[3;1H\e(B\e[m \e[4;1H\e(B\e[m \e[5;1H\e(B\e[m \e[6;1H\e(B\e[m \e[7;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[8;1H\e(B\e[m │\e[33m Select a deck of flashcards \e(B\e[m│ \e[9;1H\e(B\e[m ├───────────────────────────────────────────────┤ \e[10;1H\e(B\e[m │ \e[4m\e[37mexample\e(B\e[m │ \e[11;1H\e(B\e[m │ test │ \e[12;1H\e(B\e[m │ analysis3 │ \e[13;1H\e(B\e[m │ syntax │ \e[14;1H\e(B\e[m │ \e[34mSelect file from system\e(B\e[m │ \e[15;1H\e(B\e[m │ │ \e[16;1H\e(B\e[m ╰───────────────────────────────────────────────╯ \e[17;1H\e(B\e[m \e[18;1H\e(B\e[m \e[19;1H\e(B\e[m \e[20;1H\e(B\e[m \e[21;1H\e(B\e[m \e[22;1H\e(B\e[m " - # - delay: 1242 - # content: "\e[?25l\e[10;1H\e(B\e[m │ example │ \e[11;1H\e(B\e[m │ \e[4m\e[37mtest\e(B\e[m │ " - # - delay: 162 - # content: "\e[?25l\e[11;1H\e(B\e[m │ test │ \e[12;1H\e(B\e[m │ \e[4m\e[37manalysis3\e(B\e[m │ " - # - delay: 157 - # content: "\e[?25l\e[12;1H\e(B\e[m │ analysis3 │ \e[13;1H\e(B\e[m │ \e[4m\e[37msyntax\e(B\e[m │ " - # - delay: 200 - # content: "\e[?1049l\e[23;0;0t\e[?12l\e[?25h\e(B\e[m\e[?12l\e[?25h\e[?1049h\e[22;0;0t\e[H\e[2J\e[?25l\e[1;1H\e(B\e[m \e[2;1H\e(B\e[m \e[3;1H\e(B\e[m \e[4;1H\e(B\e[m \e[5;1H\e(B\e[m \e[6;1H\e(B\e[m \e[7;1H\e(B\e[m \e[8;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[9;1H\e(B\e[m │\e[33m Word or question \e(B\e[m│ \e[10;1H\e(B\e[m ├───────────────────────────────────────────────┤ \e[11;1H\e(B\e[m │ │ \e[12;1H\e(B\e[m │ │ \e[13;1H\e(B\e[m │ │ \e[14;1H\e(B\e[m │ 1/4 │ \e[15;1H\e(B\e[m ╰───────────────────────────────────────────────╯ \e[16;1H\e(B\e[m \e[17;1H\e(B\e[m \e[18;1H\e(B\e[m \e[19;1H\e(B\e[m \e[20;1H\e(B\e[m \e[21;1H\e(B\e[m \e[22;1H\e(B\e[m " - # - delay: 1706 - # content: "\e[?25l\e[11;1H\e(B\e[m │ Explanation or definition of this word, or │ \e[12;1H\e(B\e[m │ the answer to the question. │ \e[13;1H\e(B\e[m │ │ " - delay: 606 content: "\e[?25l\e[6;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[7;1H\e(B\e[m │\e[33m Multiple choice question, (only one answer is \e(B\e[m│ \e[8;1H\e(B\e[m │\e[33m right) \e(B\e[m│ \e[9;1H\e(B\e[m ├───────────────────────────────────────────────┤ \e[10;1H\e(B\e[m │ \e[33m* \e(B\e[mChoice 1 │ \e[11;1H\e(B\e[m │ Choice 2 (this is the correct answer) │ \e[12;1H\e(B\e[m │ Choice 3 │ \e[13;1H\e(B\e[m │ Choice 4 │ \e[14;1H\e(B\e[m │ │ \e[15;1H\e(B\e[m │ 2/4 │ \e[16;1H\e(B\e[m ╰───────────────────────────────────────────────╯ " - delay: 996 @@ -160,22 +122,4 @@ records: - delay: 990 content: "\e[?25l\e[11;1H\e(B\e[m │ \e[33m* \e(B\e[mChoice 2 (this is the correct answer) │ \e[12;1H\e(B\e[m │ \e[31mChoice 3 \e(B\e[m │ " - delay: 944 - content: "\e[?25l\e[11;1H\e(B\e[m │ \e[33m* \e[32mChoice 2 (this is the correct answer) \e(B\e[m │ " - # - delay: 1308 - # content: "\e[?25l\e[6;1H\e(B\e[m \e[7;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[8;1H\e(B\e[m │\e[33m Multiple answer question \e(B\e[m│ \e[10;1H\e(B\e[m │[\e[33m*\e(B\e[m] Choice 1 (this is a correct answer) │ \e[11;1H\e(B\e[m │[ ] Choice 2 │ \e[12;1H\e(B\e[m │[ ] Choice 3 (this is a correct answer) │ \e[13;1H\e(B\e[m │[ ] Choice 4 │ \e[14;1H\e(B\e[m │ │ \e[15;1H\e(B\e[m │ 3/4 │ " - # - delay: 1942 - # content: "\e[?1049l\e[23;0;0t\e[?12l\e[?25h\e(B\e[m\e[?12l\e[?25h\e[?1049h\e[22;0;0t\e[H\e[2J" - # - delay: 5 - # content: "\e[?25l\e[1;1H\e(B\e[m \e[2;1H\e(B\e[m \e[3;1H\e(B\e[m \e[4;1H\e(B\e[m \e[5;1H\e(B\e[m \e[6;1H\e(B\e[m \e[7;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[8;1H\e(B\e[m │\e[33m Select a deck of flashcards \e(B\e[m│ \e[9;1H\e(B\e[m ├───────────────────────────────────────────────┤ \e[10;1H\e(B\e[m │ example │ \e[11;1H\e(B\e[m │ test │ \e[12;1H\e(B\e[m │ analysis3 │ \e[13;1H\e(B\e[m │ \e[4m\e[37msyntax\e(B\e[m │ \e[14;1H\e(B\e[m │ \e[34mSelect file from system\e(B\e[m │ \e[15;1H\e(B\e[m │ │ \e[16;1H\e(B\e[m ╰───────────────────────────────────────────────╯ \e[17;1H\e(B\e[m \e[18;1H\e(B\e[m \e[19;1H\e(B\e[m \e[20;1H\e(B\e[m \e[21;1H\e(B\e[m \e[22;1H\e(B\e[m " - # - delay: 320 - # content: "\e[?1049l\e[23;0;0t\e[?12l\e[?25h\e(B\e[m\e[?12l\e[?25h\e[?1049h\e[22;0;0t\e[H\e[2J" - # - delay: 11 - # content: "\e[?25l\e[1;1H\e(B\e[m \e[2;1H\e(B\e[m \e[3;1H\e(B\e[m \e[4;1H\e(B\e[m \e[5;1H\e(B\e[m \e[6;1H\e(B\e[m \e[7;1H\e(B\e[m ╭────────────────────────────────────────╮ \e[8;1H\e(B\e[m │ \e[33m┬ ┬┌─┐┌─┐┌─┐┌─┐┬─┐┌┬┐\e(B\e[m │ \e[9;1H\e(B\e[m │ \e[33m├─┤├─┤└─┐│ ├─┤├┬┘ ││\e(B\e[m │ \e[10;1H\e(B\e[m │ \e[33m┴ ┴┴ ┴└─┘└─┘┴ ┴┴└──┴┘\e(B\e[m │ \e[11;1H\e(B\e[m ├────────────────────────────────────────┤ \e[12;1H\e(B\e[m │ \e[4m\e[37mSelect\e(B\e[m │ \e[13;1H\e(B\e[m │ Info │ \e[14;1H\e(B\e[m │ Settings │ \e[15;1H\e(B\e[m │ Quit │ \e[16;1H\e(B\e[m ╰────────────────────────────────────────╯ \e[17;1H\e(B\e[m \e[18;1H\e(B\e[m \e[19;1H\e(B\e[m \e[20;1H\e(B\e[m \e[21;1H\e(B\e[m \e[22;1H\e(B\e[m " - # - delay: 512 - # content: "\e[?1049l\e[23;0;0t\e[?12l\e[?25h\e(B\e[m\e[?12l\e[?25h" - # - delay: 11 - # content: "\e[1m\e[7m%\e[27m\e[1m\e[0m \r \r\e]2;..skell/hascard\a" - # - delay: 59 - # content: "\r\e[0m\e[27m\e[24m\e[J\e[01;32m➜ \e[36mhascard\e[00m \e[01;34mgit:(\e[31mmaster\e[34m) \e[33m✗\e[00m \e[K\e[?1h\e=\e[?2004h" - # - delay: 317 - # content: "\e[?2004l\r\r\n" \ No newline at end of file + content: "\e[?25l\e[11;1H\e(B\e[m │ \e[33m* \e[32mChoice 2 (this is the correct answer) \e(B\e[m │ " \ No newline at end of file diff --git a/recordings/reordering.gif b/recordings/reordering.gif new file mode 100644 index 0000000..8aac7e5 Binary files /dev/null and b/recordings/reordering.gif differ diff --git a/recordings/reordering.yml b/recordings/reordering.yml new file mode 100644 index 0000000..381d972 --- /dev/null +++ b/recordings/reordering.yml @@ -0,0 +1,127 @@ +# The configurations that used for the recording, feel free to edit them +config: + + # Specify a command to be executed + # like `/bin/bash -l`, `ls`, or any other commands + # the default is bash for Linux + # or powershell.exe for Windows + command: zsh + + # Specify the current working directory path + # the default is the current working directory path + cwd: /media/steven/shared/Documents/Coding/Haskell/hascard + + # Export additional ENV variables + env: + recording: true + + # Explicitly set the number of columns + # or use `auto` to take the current + # number of columns of your shell + cols: 80 + + # Explicitly set the number of rows + # or use `auto` to take the current + # number of rows of your shell + rows: 22 + + # Amount of times to repeat GIF + # If value is -1, play once + # If value is 0, loop indefinitely + # If value is a positive number, loop n times + repeat: 0 + + # Quality + # 1 - 100 + quality: 100 + + # Delay between frames in ms + # If the value is `auto` use the actual recording delays + frameDelay: auto + + # Maximum delay between frames in ms + # Ignored if the `frameDelay` isn't set to `auto` + # Set to `auto` to prevent limiting the max idle time + maxIdleTime: 2000 + + # The surrounding frame box + # The `type` can be null, window, floating, or solid` + # To hide the title use the value null + # Don't forget to add a backgroundColor style with a null as type + frameBox: + type: solid + title: null + style: + border: 0px black solid + # boxShadow: none + # margin: 0px + + # Add a watermark image to the rendered gif + # You need to specify an absolute path for + # the image on your machine or a URL, and you can also + # add your own CSS styles + watermark: + imagePath: null + style: + position: absolute + right: 15px + bottom: 15px + width: 100px + opacity: 0.9 + + # Cursor style can be one of + # `block`, `underline`, or `bar` + cursorStyle: bar + + # Font family + # You can use any font that is installed on your machine + # in CSS-like syntax + fontFamily: "Iosevka" + + # The size of the font + fontSize: 24 + + # The height of lines + lineHeight: 0.92 + + # The spacing between letters + letterSpacing: 0 + + # Theme + theme: + background: "transparent" + foreground: "#afafaf" + cursor: "#c7c7c7" + black: "#232628" + red: "#fc4384" + green: "#b3e33b" + yellow: "#ffa727" + blue: "#75dff2" + magenta: "#ae89fe" + cyan: "#708387" + white: "#d5d5d0" + brightBlack: "#626566" + brightRed: "#ff7fac" + brightGreen: "#c8ed71" + brightYellow: "#ebdf86" + brightBlue: "#75dff2" + brightMagenta: "#ae89fe" + brightCyan: "#b1c6ca" + brightWhite: "#f9f9f4" + +# Records, feel free to edit them +records: + - delay: 1500 + content: "\e[?25l\e[7;1H\e(B\e[m ╭───────────────────────────────────────────────╮ \e[8;1H\e(B\e[m │\e[33m Order the letters in alphabetical order \e(B\e[m│ \e[9;1H\e(B\e[m ├───────────────────────────────────────────────┤ \e[10;1H\e(B\e[m │ 1. \e[33mu \e(B\e[m │ \e[11;1H\e(B\e[m │ 2. l │ \e[12;1H\e(B\e[m │ 3. p │ \e[13;1H\e(B\e[m │ 4. s │ \e[14;1H\e(B\e[m │ │ \e[15;1H\e(B\e[m │ 5/5 │ \e[16;1H\e(B\e[m ╰───────────────────────────────────────────────╯ " + - delay: 703 + content: "\e[?25l\e[10;1H\e(B\e[m │ 1. \e[34mu \e(B\e[m │ " + - delay: 352 + content: "\e[?25l\e[10;1H\e(B\e[m │ 1. l │ \e[11;1H\e(B\e[m │ 2. \e[34mu \e(B\e[m │ " + - delay: 231 + content: "\e[?25l\e[11;1H\e(B\e[m │ 2. p │ \e[12;1H\e(B\e[m │ 3. \e[34mu \e(B\e[m │ " + - delay: 244 + content: "\e[?25l\e[12;1H\e(B\e[m │ 3. s │ \e[13;1H\e(B\e[m │ 4. \e[34mu \e(B\e[m │ " + - delay: 289 + content: "\e[?25l\e[13;1H\e(B\e[m │ 4. \e[33mu \e(B\e[m │ " + - delay: 563 + content: "\e[?25l\e[10;1H\e(B\e[m │ \e[32m1. \e(B\e[ml │ \e[11;1H\e(B\e[m │ \e[32m2. \e(B\e[mp │ \e[12;1H\e(B\e[m │ \e[32m3. \e(B\e[ms │ \e[13;1H\e(B\e[m │ \e[32m4. \e[33mu \e(B\e[m │ " \ No newline at end of file diff --git a/src/Parser.hs b/src/Parser.hs index 478e660..fc05167 100644 --- a/src/Parser.hs +++ b/src/Parser.hs @@ -56,7 +56,11 @@ pReorder = do header <- pHeader many eol elements <- pReorderElement `sepBy1` lookAhead (try pReorderPrefix) - return (header, NE.fromList elements) + let numbers = map fst elements + if all (`elem` numbers) [1..length numbers] + then return (header, NE.fromList elements) + else error $ "A reordering question should have numbers starting from 1 and increase from there without skipping any numbers, but this is not the case:\n" + <> unlines (map show numbers) pReorderElement = do int <- pReorderPrefix