line_helpers.ex (968B)
1 defmodule EarmarkParser.Helpers.LineHelpers do 2 3 @moduledoc false 4 5 alias EarmarkParser.Line 6 7 def blank?(%Line.Blank{}), do: true 8 def blank?(_), do: false 9 10 def blockquote_or_text?(%Line.BlockQuote{}), do: true 11 def blockquote_or_text?(struct), do: text?(struct) 12 13 def indent_or_blank?(%Line.Indent{}), do: true 14 def indent_or_blank?(line), do: blank?(line) 15 16 # Gruber's tests have 17 # 18 # para text... 19 # * and more para text 20 # 21 # So list markers inside paragraphs are ignored. But he also has 22 # 23 # * line 24 # * line 25 # 26 # And expects it to be a nested list. These seem to be in conflict 27 # 28 # I think the second is a better interpretation, so I commented 29 # out the 2nd match below. 30 def text?(%Line.Text{}), do: true 31 def text?(%Line.TableLine{}), do: true 32 # def text?(%Line.ListItem{}), do: true 33 def text?(_), do: false 34 35 end 36 # SPDX-License-Identifier: Apache-2.0