Ça recompile !!

pull/1/head
Jean-Christophe Jameux 3 years ago
parent 3a81f479c1
commit b728ecd5f7
  1. 63
      src/GenerateurH5P.elm

@ -1580,12 +1580,33 @@ branchingScenarioParser profondeur =
|. blankLines |. blankLines
{- Dans une configuration de la forme :
*BranchingScenario Titre du cours
** BranchingQuestion Cxu ?
...
** CoursePresentation
...
Récupère tout ce qui se trouve au niveau ** sous la forme d'une liste
-}
branchingScenarioParserHelp profondeur ( contentList, contentId ) = branchingScenarioParserHelp profondeur ( contentList, contentId ) =
oneOf oneOf
[ succeed Loop [ let
f ( contents, id ) =
Loop ( contentList ++ contents, id + 1 )
in
succeed f
|= contentParser profondeur contentId |= contentParser profondeur contentId
|. blankLines
-- Je me demande pourquoi on ne se contente pas d'écrire :
-- succeed (Done contentList)
, succeed () , succeed ()
|> P.map (\_ -> Done (List.concat contentList)) |> P.map (\_ -> Done contentList)
] ]
@ -1640,6 +1661,7 @@ branchingQuestionParser profondeur contentId =
|. espaces |. espaces
|= questionParser |= questionParser
|. blankLines |. blankLines
-- Je dirais qu'il faut un contentId + 1 ici
|= loop ( [], contentId ) (branchingQuestionAlternativeParser (profondeur + 1)) |= loop ( [], contentId ) (branchingQuestionAlternativeParser (profondeur + 1))
@ -1661,22 +1683,33 @@ branchingQuestionAlternativeParser profondeur ( branchList, contentId ) =
succeed f succeed f
|. stars profondeur |. stars profondeur
|= alternativeParser |= alternativeParser
|= lazy (loop ( [], contentId ) (branchingQuestionAlternativeParserHelp (profondeur + 1) (contentId + 1))) |= loop ( [], contentId ) (branchingQuestionAlternativeParserHelp (profondeur + 1))
, succeed () , (succeed ()
|> P.map (\_ -> Done (List.concat branchList)) |> P.map (\_ -> List.concat branchList)
)
|> andThen
(\xx ->
case xx of
[] ->
problem "Un embranchement doit avoir au moins deux branches !"
x :: [] ->
problem "Un embranchement doit avoir au moins deux branches !"
x :: y :: zz ->
succeed ()
|> P.map (\_ -> Done ( { first = x, second = y, others = zz }, contentId ))
)
] ]
branchingQuestionAlternativeParserHelp profondeur contentId = {-| Tout le travail reste à faire !
-- À réécrire -}
sequence branchingQuestionAlternativeParserHelp profondeur ( branchList, contentId ) =
{ start = "" oneOf
, separator = "" [ succeed ()
, end = "" |> P.map (\_ -> Done ( [], contentId ))
, spaces = blankLines ]
, item = h5pParser
, trailing = Optional
}

Loading…
Cancel
Save