Skip to content

Commit

Permalink
Fixes #335
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertDober committed Jun 19, 2020
1 parent 72e086f commit 6e863e9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/earmark/ast/renderer/table_renderer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ defmodule Earmark.Ast.Renderer.TableRenderer do
end

defp _render_col({col, align}, context, lnb, coltype) do
context1 = Inline.convert(col, lnb, Context.clear_value(context))
{{"#{coltype}", _align_to_style(align), context1.value}, context1}
context1 = Inline.convert(col, lnb, Context.clear_value(context))
{{"#{coltype}", _align_to_style(align), context1.value |> Enum.reverse}, context1}
end

defp _render_row({row, lnb}, context, aligns) do
Expand Down
1 change: 1 addition & 0 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ defmodule Earmark.Mixfile do
# {:credo, "~> 0.10", only: [:dev, :test]},
{:dialyxir, "~> 1.0", only: [:dev, :test]},
{:benchfella, "~> 0.3.0", only: [:dev]},
{:earmark_ast_dsl, "~> 0.1.2", only: [:test]},
{:excoveralls, "~> 0.11.2", only: [:test]},
{:floki, "~> 0.21", only: [:dev, :test]},
{:traverse, "~> 1.0.0", only: [:dev, :test]}
Expand Down
1 change: 1 addition & 0 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "805abd97539caf89ec6d4732c91e62ba9da0cda51ac462380bbd28ee697a8c42"},
"credo": {:hex, :credo, "0.10.2", "03ad3a1eff79a16664ed42fc2975b5e5d0ce243d69318060c626c34720a49512", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, optional: false]}, {:jason, "~> 1.0", [hex: :jason, optional: false]}]},
"dialyxir": {:hex, :dialyxir, "1.0.0", "6a1fa629f7881a9f5aaf3a78f094b2a51a0357c843871b8bc98824e7342d00a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "aeb06588145fac14ca08d8061a142d52753dbc2cf7f0d00fc1013f53f8654654"},
"earmark_ast_dsl": {:hex, :earmark_ast_dsl, "0.1.2", "3e9aad961977a8bb2c3474bbc7e88c0e15648beb130c99c93a24b72a20dfe883", [:mix], [], "hexpm", "ed2d9324bbf932678115c355b999edbd44c667c2b5bb0c23e997e655becaeb24"},
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
"excoveralls": {:hex, :excoveralls, "0.11.2", "0c6f2c8db7683b0caa9d490fb8125709c54580b4255ffa7ad35f3264b075a643", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "e11a4490976aabeed3eb9dc70ec94a4f2d11fed5c9d4b5dc5d89bfa0a215abb5"},
"floki": {:hex, :floki, "0.21.0", "0c0191a6dbc559300bac232f716c55fb5738d45ae846b3141b19e5f5741c1907", [:mix], [{:html_entities, "~> 0.4.0", [hex: :html_entities, repo: "hexpm", optional: false]}, {:mochiweb, "~> 2.15", [hex: :mochiweb, repo: "hexpm", optional: false]}], "hexpm", "4558100b255f5143d42432e75ceb731d04dbe824d1cf57c38e7e0f3c644ca0cd"},
Expand Down
21 changes: 21 additions & 0 deletions test/acceptance/ast/table_test.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defmodule Acceptance.Ast.TableTest do
use ExUnit.Case, async: true
import Support.Helpers, only: [as_ast: 1, as_ast: 2, parse_html: 1]
import EarmarkAstDsl

describe "complex rendering inside tables:" do

Expand Down Expand Up @@ -90,6 +91,26 @@ defmodule Acceptance.Ast.TableTest do
assert as_ast(markdown, gfm_tables: true) == {:ok, [ast], messages}
end
end

describe "The order of things (Vorta and Jem'Hadar I guess)" do
test "table celles are in the correct order" do
markdown = """
| What |
| ----------------- |
| This part is fine |
| This is `broken` |
"""
ast = table(["This part is fine", { "This is ", tag(:code, "broken", class: :inline) }], head: ["What"])
assert as_ast(markdown) == {:ok, [ast], []}
end

test "minimized example" do
markdown = "|zero|\n|alpha *beta*|"
ast = table(["zero", { "alpha ", tag(:em, "beta") }])

assert as_ast(markdown) == {:ok, [ast], []}
end
end
end

# SPDX-License-Identifier: Apache-2.0

0 comments on commit 6e863e9

Please sign in to comment.