fix: separate steps with blank lines in Cooklang renderer
Build and Deploy / build-and-deploy (push) Successful in 1m17s
Build and Deploy / build-and-deploy (push) Successful in 1m17s
The Cooklang parser (splitByBlankLines) identifies step boundaries by blank lines (\n\n). renderSection was joining body items with a single newline (\n), causing multiple steps to be parsed as one. Fixed by using \n\n as the separator between body items, matching the spec.
This commit is contained in:
@@ -85,7 +85,10 @@ renderBody recipe =
|
||||
body = T.intercalate "\n" rendered
|
||||
in if T.null body then Nothing else Just body
|
||||
|
||||
-- | Render a single section.
|
||||
{- | Render a single section.
|
||||
Steps within a section are separated by blank lines, which is how
|
||||
the Cooklang parser identifies step boundaries.
|
||||
-}
|
||||
renderSection :: Section -> Text
|
||||
renderSection section =
|
||||
let header = case sectionName section of
|
||||
@@ -93,7 +96,7 @@ renderSection section =
|
||||
Nothing -> T.empty
|
||||
items = toList (sectionBody section)
|
||||
steps = map renderBodyItem items
|
||||
in header <> T.intercalate "\n" steps
|
||||
in header <> T.intercalate "\n\n" steps
|
||||
|
||||
-- | Render a single section body item (step, comment, or note).
|
||||
renderBodyItem :: SectionBodyItem -> Text
|
||||
|
||||
Reference in New Issue
Block a user