imp: journal: python directive also consumes empty lines (ledger compat)

This commit is contained in:
Simon Michael 2022-12-22 02:30:29 -10:00
parent 23d25c8403
commit b1e08ffe46
2 changed files with 12 additions and 4 deletions

View File

@ -549,10 +549,14 @@ definedirectivep = do string "define" >> lift restofline >> return ()
exprdirectivep = do string "expr" >> lift restofline >> return ()
valuedirectivep = do string "value" >> lift restofline >> return ()
evaldirectivep = do string "eval" >> lift restofline >> return ()
pythondirectivep = do string "python" >> lift restofline >> many (indented $ lift restofline) >> return ()
where
indented = (lift skipNonNewlineSpaces1 >>)
commandlineflagdirectivep = do string "--" >> lift restofline >> return ()
pythondirectivep = do
string "python" >> lift restofline
many $ indentedline <|> blankline
return ()
where
indentedline = lift skipNonNewlineSpaces1 >> lift restofline
blankline = lift skipNonNewlineSpaces >> newline >> return "" <?> "blank line"
keywordp :: String -> JournalParser m ()
keywordp = void . string . fromString

View File

@ -69,7 +69,11 @@ tag Receipt
assert value != "foobar"
value some_func
python
import os
def option_pyfirst(context):
print("In --pyfirst (from %s)" % context)
def option_pysecond(context, val):
print("In --pysecond=%s (from %s)" % (val, context))
eval foo
--command-line-flag