diff --git a/lib/earmark_parser/block.ex b/lib/earmark_parser/block.ex new file mode 100644 index 0000000..adec157 --- /dev/null +++ b/lib/earmark_parser/block.ex @@ -0,0 +1,126 @@ +defmodule EarmarkParser.Block do + @moduledoc false + + @type t :: + %__MODULE__.BlockQuote{} + | %__MODULE__.Code{} + | %__MODULE__.FnDef{} + | %__MODULE__.FnList{} + | %__MODULE__.Heading{} + | %__MODULE__.Html{} + | %__MODULE__.HtmlComment{} + | %__MODULE__.HtmlOneline{} + | %__MODULE__.Ial{} + | %__MODULE__.IdDef{} + | %__MODULE__.ListItem{} + | %__MODULE__.List{} + | %__MODULE__.Para{} + | %__MODULE__.Ruler{} + | %__MODULE__.Table{} + | %__MODULE__.Text{} + + defmodule BlockQuote do + @moduledoc false + defstruct lnb: 0, annotation: nil, attrs: nil, blocks: [] + end + + defmodule Code do + @moduledoc false + defstruct lnb: 0, annotation: nil, attrs: nil, lines: [], language: nil + end + + defmodule FnDef do + @moduledoc false + defstruct lnb: 0, annotation: nil, attrs: nil, id: nil, number: nil, blocks: [] + end + + defmodule FnList do + @moduledoc false + defstruct lnb: 0, annotation: nil, attrs: ".footnotes", blocks: [] + end + + defmodule Heading do + @moduledoc false + defstruct lnb: 0, annotation: nil, attrs: nil, content: nil, level: nil + end + + defmodule HtmlComment do + @moduledoc false + defstruct lnb: 0, annotation: nil, attrs: nil, lines: [] + end + + defmodule HtmlOneline do + @moduledoc false + defstruct lnb: 0, annotation: nil, attrs: nil, html: "" + end + + defmodule Html do + @moduledoc false + defstruct lnb: 0, annotation: nil, attrs: nil, html: [], tag: nil + end + + defmodule Ial do + @moduledoc false + defstruct lnb: 0, annotation: nil, attrs: nil, content: nil, verbatim: "" + end + + defmodule IdDef do + @moduledoc false + defstruct lnb: 0, annotation: nil, attrs: nil, id: nil, url: nil, title: nil + end + + defmodule ListItem do + @moduledoc false + defstruct attrs: nil, + blocks: [], + bullet: "", + lnb: 0, + annotation: nil, + loose?: false, + spaced?: true, + type: :ul + end + + defmodule List do + @moduledoc false + + defstruct annotation: nil, + attrs: nil, + blocks: [], + lines: [], + bullet: "-", + indent: 0, + lnb: 0, + loose?: false, + pending: {nil, 0}, + spaced?: false, + start: "", + type: :ul + end + + defmodule Para do + @moduledoc false + defstruct lnb: 0, annotation: nil, attrs: nil, lines: [] + end + + defmodule Ruler do + @moduledoc false + defstruct lnb: 0, annotation: nil, attrs: nil, type: nil + end + + defmodule Table do + @moduledoc false + defstruct lnb: 0, annotation: nil, attrs: nil, rows: [], header: nil, alignments: [] + + def new_for_columns(n) do + %__MODULE__{alignments: Elixir.List.duplicate(:left, n)} + end + end + + defmodule Text do + @moduledoc false + defstruct attrs: nil, lnb: 0, annotation: nil, line: "" + end +end + +# SPDX-License-Identifier: Apache-2.0 diff --git a/lib/earmark_parser/block/block_quote.ex b/lib/earmark_parser/block/block_quote.ex deleted file mode 100644 index 6cb001e..0000000 --- a/lib/earmark_parser/block/block_quote.ex +++ /dev/null @@ -1,6 +0,0 @@ -defmodule EarmarkParser.Block.BlockQuote do - @moduledoc false - defstruct lnb: 0, annotation: nil, attrs: nil, blocks: [] -end - -# SPDX-License-Identifier: Apache-2.0 diff --git a/lib/earmark_parser/block/code.ex b/lib/earmark_parser/block/code.ex deleted file mode 100644 index 820dc36..0000000 --- a/lib/earmark_parser/block/code.ex +++ /dev/null @@ -1,6 +0,0 @@ -defmodule EarmarkParser.Block.Code do - @moduledoc false - defstruct lnb: 0, annotation: nil, attrs: nil, lines: [], language: nil -end - -# SPDX-License-Identifier: Apache-2.0 diff --git a/lib/earmark_parser/block/fn_def.ex b/lib/earmark_parser/block/fn_def.ex deleted file mode 100644 index 5d26767..0000000 --- a/lib/earmark_parser/block/fn_def.ex +++ /dev/null @@ -1,6 +0,0 @@ -defmodule EarmarkParser.Block.FnDef do - @moduledoc false - defstruct lnb: 0, annotation: nil, attrs: nil, id: nil, number: nil, blocks: [] -end - -# SPDX-License-Identifier: Apache-2.0 diff --git a/lib/earmark_parser/block/fn_list.ex b/lib/earmark_parser/block/fn_list.ex deleted file mode 100644 index 173a0d2..0000000 --- a/lib/earmark_parser/block/fn_list.ex +++ /dev/null @@ -1,6 +0,0 @@ -defmodule EarmarkParser.Block.FnList do - @moduledoc false - defstruct lnb: 0, annotation: nil, attrs: ".footnotes", blocks: [] -end - -# SPDX-License-Identifier: Apache-2.0 diff --git a/lib/earmark_parser/block/heading.ex b/lib/earmark_parser/block/heading.ex deleted file mode 100644 index 2ef0405..0000000 --- a/lib/earmark_parser/block/heading.ex +++ /dev/null @@ -1,6 +0,0 @@ -defmodule EarmarkParser.Block.Heading do - @moduledoc false - defstruct lnb: 0, annotation: nil, attrs: nil, content: nil, level: nil -end - -# SPDX-License-Identifier: Apache-2.0 diff --git a/lib/earmark_parser/block/html.ex b/lib/earmark_parser/block/html.ex deleted file mode 100644 index ba01b0d..0000000 --- a/lib/earmark_parser/block/html.ex +++ /dev/null @@ -1,6 +0,0 @@ -defmodule EarmarkParser.Block.Html do - @moduledoc false - defstruct lnb: 0, annotation: nil, attrs: nil, html: [], tag: nil -end - -# SPDX-License-Identifier: Apache-2.0 diff --git a/lib/earmark_parser/block/html_comment.ex b/lib/earmark_parser/block/html_comment.ex deleted file mode 100644 index 63dfd90..0000000 --- a/lib/earmark_parser/block/html_comment.ex +++ /dev/null @@ -1,6 +0,0 @@ -defmodule EarmarkParser.Block.HtmlComment do - @moduledoc false - defstruct lnb: 0, annotation: nil, attrs: nil, lines: [] -end - -# SPDX-License-Identifier: Apache-2.0 diff --git a/lib/earmark_parser/block/html_oneline.ex b/lib/earmark_parser/block/html_oneline.ex deleted file mode 100644 index ef6a429..0000000 --- a/lib/earmark_parser/block/html_oneline.ex +++ /dev/null @@ -1,6 +0,0 @@ -defmodule EarmarkParser.Block.HtmlOneline do - @moduledoc false - defstruct lnb: 0, annotation: nil, attrs: nil, html: "" -end - -# SPDX-License-Identifier: Apache-2.0 diff --git a/lib/earmark_parser/block/ial.ex b/lib/earmark_parser/block/ial.ex deleted file mode 100644 index 5a397b0..0000000 --- a/lib/earmark_parser/block/ial.ex +++ /dev/null @@ -1,6 +0,0 @@ -defmodule EarmarkParser.Block.Ial do - @moduledoc false - defstruct lnb: 0, annotation: nil, attrs: nil, content: nil, verbatim: "" -end - -# SPDX-License-Identifier: Apache-2.0 diff --git a/lib/earmark_parser/block/id_def.ex b/lib/earmark_parser/block/id_def.ex deleted file mode 100644 index 9e860cb..0000000 --- a/lib/earmark_parser/block/id_def.ex +++ /dev/null @@ -1,6 +0,0 @@ -defmodule EarmarkParser.Block.IdDef do - @moduledoc false - defstruct lnb: 0, annotation: nil, attrs: nil, id: nil, url: nil, title: nil -end - -# SPDX-License-Identifier: Apache-2.0 diff --git a/lib/earmark_parser/block/list.ex b/lib/earmark_parser/block/list.ex deleted file mode 100644 index e7e4f9a..0000000 --- a/lib/earmark_parser/block/list.ex +++ /dev/null @@ -1,18 +0,0 @@ -defmodule EarmarkParser.Block.List do - @moduledoc false - - defstruct annotation: nil, - attrs: nil, - blocks: [], - lines: [], - bullet: "-", - indent: 0, - lnb: 0, - loose?: false, - pending: {nil, 0}, - spaced?: false, - start: "", - type: :ul -end - -# SPDX-License-Identifier: Apache-2.0 diff --git a/lib/earmark_parser/block/list_item.ex b/lib/earmark_parser/block/list_item.ex deleted file mode 100644 index de9d682..0000000 --- a/lib/earmark_parser/block/list_item.ex +++ /dev/null @@ -1,13 +0,0 @@ -defmodule EarmarkParser.Block.ListItem do - @moduledoc false - defstruct attrs: nil, - blocks: [], - bullet: "", - lnb: 0, - annotation: nil, - loose?: false, - spaced?: true, - type: :ul -end - -# SPDX-License-Identifier: Apache-2.0 diff --git a/lib/earmark_parser/block/para.ex b/lib/earmark_parser/block/para.ex deleted file mode 100644 index 4e35d7d..0000000 --- a/lib/earmark_parser/block/para.ex +++ /dev/null @@ -1,6 +0,0 @@ -defmodule EarmarkParser.Block.Para do - @moduledoc false - defstruct lnb: 0, annotation: nil, attrs: nil, lines: [] -end - -# SPDX-License-Identifier: Apache-2.0 diff --git a/lib/earmark_parser/block/ruler.ex b/lib/earmark_parser/block/ruler.ex deleted file mode 100644 index 17c8a30..0000000 --- a/lib/earmark_parser/block/ruler.ex +++ /dev/null @@ -1,6 +0,0 @@ -defmodule EarmarkParser.Block.Ruler do - @moduledoc false - defstruct lnb: 0, annotation: nil, attrs: nil, type: nil -end - -# SPDX-License-Identifier: Apache-2.0 diff --git a/lib/earmark_parser/block/table.ex b/lib/earmark_parser/block/table.ex deleted file mode 100644 index fb9b90b..0000000 --- a/lib/earmark_parser/block/table.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule EarmarkParser.Block.Table do - @moduledoc false - defstruct lnb: 0, annotation: nil, attrs: nil, rows: [], header: nil, alignments: [] - - def new_for_columns(n) do - %__MODULE__{alignments: Elixir.List.duplicate(:left, n)} - end -end - -# SPDX-License-Identifier: Apache-2.0 diff --git a/lib/earmark_parser/block/text.ex b/lib/earmark_parser/block/text.ex deleted file mode 100644 index a0a2d8d..0000000 --- a/lib/earmark_parser/block/text.ex +++ /dev/null @@ -1,6 +0,0 @@ -defmodule EarmarkParser.Block.Text do - @moduledoc false - defstruct attrs: nil, lnb: 0, annotation: nil, line: "" -end - -# SPDX-License-Identifier: Apache-2.0 diff --git a/lib/earmark_parser/line.ex b/lib/earmark_parser/line.ex index df4d142..cecc888 100644 --- a/lib/earmark_parser/line.ex +++ b/lib/earmark_parser/line.ex @@ -1,6 +1,25 @@ defmodule EarmarkParser.Line do @moduledoc false + @type t :: + %__MODULE__.Blank{} + | %__MODULE__.Ruler{} + | %__MODULE__.Heading{} + | %__MODULE__.BlockQuote{} + | %__MODULE__.Indent{} + | %__MODULE__.Fence{} + | %__MODULE__.HtmlOpenTag{} + | %__MODULE__.HtmlCloseTag{} + | %__MODULE__.HtmlComment{} + | %__MODULE__.HtmlOneLine{} + | %__MODULE__.IdDef{} + | %__MODULE__.FnDef{} + | %__MODULE__.ListItem{} + | %__MODULE__.SetextUnderlineHeading{} + | %__MODULE__.TableLine{} + | %__MODULE__.Ial{} + | %__MODULE__.Text{} + defmodule Blank do @moduledoc false defstruct(annotation: nil, lnb: 0, line: "", indent: -1, content: "")