bitmark-standard / bitmark-grammar

7 stars 0 forks source link

[.multiple-choice] @example in incorrect position in the JSON #10

Open six5536 opened 1 year ago

six5536 commented 1 year ago

Describe the bug The @example on [-green] is not correct in the JSON

To Reproduce Parse the following bitmark to produce JSON output:

[.multiple-choice]
[@id:285675]
[%5][%multiple-choice]
[!What color do the following beverages have?]
Be careful and think twice.
===
[!Milk]
[+white]
[-red]
[-blue]
===
[!Red Wine]
[+red]
[-white][%12]
[-green][@example]
===

The following JSON is produced:

{
   "bitmark": "[.multiple-choice]\n[@id:285675]\n[%5][%multiple-choice]\n[!What color do the following beverages have?]\nBe careful and think twice.\n===\n[!Milk]\n[+white]\n[-red]\n[-blue]\n===\n[!Red Wine]\n[+red]\n[-white][%12]\n[-green][@example]\n===",
   "bit": {
     "type": "multiple-choice",
     "format": "bitmark--",
     "item": "5",
     "instruction": "What color do the following beverages have?",
     "body": "Be careful and think twice.",
     "footer": "",
     "hint": "",
     "quizzes": [
       {
         "item": "",
         "instruction": "Milk",
         "choices": [
           {
             "choice": "white",
             "item": "",
             "isCorrect": true,
             "instruction": "",
             "hint": ""
           },
           {
             "choice": "red",
             "item": "",
             "isCorrect": false,
             "instruction": "",
             "hint": ""
           },
           {
             "choice": "blue",
             "item": "",
             "isCorrect": false,
             "instruction": "",
             "hint": ""
           }
         ],
         "hint": "",
         "isExample": false,
         "example": ""
       },
       {
         "item": "",
         "instruction": "Red Wine",
         "choices": [
           {
             "choice": "red",
             "item": "",
             "isCorrect": true,
             "instruction": "",
             "hint": ""
           },
           {
             "choice": "white",
             "item": "12",
             "isCorrect": false,
             "instruction": "",
             "hint": ""
           },
           {
             "choice": "green",
             "item": "",
             "isCorrect": false,
             "instruction": "",
             "hint": ""
           }
         ],
         "hint": "",
         "isExample": false,
         "example": ""
       }
     ],
     "id": ["285675"],
     "lead": "multiple-choice"
   },
   "example": ""
 },

Expected behavior isExample = true

versions 1.0.38