fix: skip empty/whitespace-only steps so step numbering starts at 1
Build and Deploy / build-and-deploy (push) Failing after 8s

This commit is contained in:
2026-05-26 06:59:07 -04:00
parent 0be6e299d5
commit edb682c8bc
+14 -1
View File
@@ -1136,7 +1136,20 @@ dedupFirst (i : rest) acc =
renderMethodSections :: [Section] -> Html renderMethodSections :: [Section] -> Html
renderMethodSections sections = do renderMethodSections sections = do
let allSteps = concatMap sectionMethodSteps (filter isMethodSection sections) let allSteps = concatMap sectionMethodSteps (filter isMethodSection sections)
mapM_ (uncurry renderMethodStep) (zip [1 ..] allSteps) -- Exclude empty/whitespace-only steps (from leading newlines in
-- Cooklang files) so step numbering always starts at 1.
meaningful = filter (not . isEmptyStep) allSteps
mapM_ (uncurry renderMethodStep) (zip [1 ..] meaningful)
-- | Is this a SectionBodyItem that contains no meaningful step content?
isEmptyStep :: (Maybe Text, SectionBodyItem) -> Bool
isEmptyStep (_, SecStep step) = null (unStep step) || all isBlankText (unStep step)
isEmptyStep _ = False
-- | Is a StepItem just whitespace?
isBlankText :: StepItem -> Bool
isBlankText (StepText t) = T.all (== ' ') t
isBlankText _ = False
-- | Is this section a method section (not an ingredient listing)? -- | Is this section a method section (not an ingredient listing)?
isMethodSection :: Section -> Bool isMethodSection :: Section -> Bool