mirror of
https://github.com/Yvee1/hascard.git
synced 2024-11-22 04:33:06 +03:00
Fix import to definition card
This commit is contained in:
parent
3e34b42599
commit
9554a3d75b
@ -61,20 +61,28 @@ pRow opts =
|
||||
pTerm = manyTill anySingle . lookAhead . try $ pSpecial opts
|
||||
pDefs = maybe (fmap (:[]) (pDef opts)) (pDef opts `sepBy`) pDefDelimiter
|
||||
defBeforeTerm = opts ^. optImportReverse
|
||||
in do
|
||||
(term, defs) <- if defBeforeTerm
|
||||
then do
|
||||
defs' <- pDefs
|
||||
in
|
||||
case (defBeforeTerm, opts ^. optImportType) of
|
||||
(False, Open) -> do
|
||||
term <- pTerm
|
||||
pTermDefDelimiter
|
||||
term' <- pTerm
|
||||
return (term', defs')
|
||||
else do
|
||||
term' <- pTerm
|
||||
defs <- pDefs
|
||||
return $ OpenQuestion (filter (/= '\n') term) Nothing (P "" (NE.fromList (map (dropWhile isSpace) defs)) (Normal ""))
|
||||
(True, Open) -> do
|
||||
defs <- pDefs
|
||||
pTermDefDelimiter
|
||||
defs' <- pDefs
|
||||
return (term', defs')
|
||||
|
||||
return $ OpenQuestion (filter (/= '\n') term) Nothing (P "" (NE.fromList (map (dropWhile isSpace) defs)) (Normal ""))
|
||||
term <- pTerm
|
||||
return $ OpenQuestion (filter (/= '\n') term) Nothing (P "" (NE.fromList (map (dropWhile isSpace) defs)) (Normal ""))
|
||||
(False, Def) -> do
|
||||
term <- pTerm
|
||||
pTermDefDelimiter
|
||||
def <- pDef opts
|
||||
return $ Definition (filter (/= '\n') term) Nothing def
|
||||
(True, Def) -> do
|
||||
def <- pDef opts
|
||||
pTermDefDelimiter
|
||||
term <- pTerm
|
||||
return $ Definition (filter (/= '\n') term) Nothing def
|
||||
|
||||
pDef :: ImportOpts -> Parser String
|
||||
pDef opts = maybe
|
||||
|
Loading…
Reference in New Issue
Block a user