Exclude already wrapped paragraphs from <p> wrapping

- Allows `paragraph \n header \n paragraph`
- Allows `paragraph \n  list  \n paragraph`
master
Raymon Zutekouw 3 years ago
parent b3fe972d0e
commit 61b3cb1500
No known key found for this signature in database
GPG Key ID: 1E9BCC39EDD1DD53
  1. 2
      client/gen.exs

@ -16,7 +16,7 @@ fill_template_pretemplated = fn template -> &fill_template.(template, &1) end
wrapInParagraphs = fn content -> content wrapInParagraphs = fn content -> content
|> String.split("\\n") |> String.split("\\n")
|> Enum.reject(fn(x) -> x == "" end) |> Enum.reject(fn(x) -> x == "" end)
|> Enum.map(fn paragraph -> "<p>" <> paragraph <> "</p>" end) |> Enum.map(fn paragraph -> if String.starts_with?(paragraph, "<") do paragraph else "<p>" <> paragraph <> "</p>" end end)
|> Enum.join("") |> Enum.join("")
end end
post_contents_custom = File.ls!("./posts_custom") post_contents_custom = File.ls!("./posts_custom")

Loading…
Cancel
Save