Skip to content

Commit

Permalink
fix: correctly create page modules
Browse files Browse the repository at this point in the history
  • Loading branch information
mhanberg committed Nov 8, 2023
1 parent 67c5052 commit 8ea0936
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions lib/tableau/extensions/page_extension.ex
Expand Up @@ -75,7 +75,7 @@ defmodule Tableau.PageExtension do

for {mod, _, _} <- :code.all_available(),
mod = Module.concat([to_string(mod)]),
Tableau.Graph.Node.type(mod) == :page,
{:ok, :page} == Tableau.Graph.Node.type(mod),
mod.__tableau_opts__()[:__tableau_page_extension__] do
:code.purge(mod)
:code.delete(mod)
Expand All @@ -84,8 +84,9 @@ defmodule Tableau.PageExtension do
pages =
for page <- apply(Tableau.PageExtension.Pages, :pages, []) do
{:module, _module, _binary, _term} =
Module.create(
:"#{System.unique_integer()}",
[:"#{System.unique_integer()}"]
|> Module.concat()
|> Module.create(
quote do
use Tableau.Page, unquote(Macro.escape(Keyword.new(page)))

Expand Down
7 changes: 4 additions & 3 deletions lib/tableau/extensions/post_extension.ex
Expand Up @@ -89,7 +89,7 @@ defmodule Tableau.PostExtension do

for {mod, _, _} <- :code.all_available(),
mod = Module.concat([to_string(mod)]),
Tableau.Graph.Node.type(mod) == :page,
{:ok, :page} == Tableau.Graph.Node.type(mod),
mod.__tableau_opts__()[:__tableau_post_extension__] do
:code.purge(mod)
:code.delete(mod)
Expand All @@ -98,8 +98,9 @@ defmodule Tableau.PostExtension do
posts =
for post <- apply(Tableau.PostExtension.Posts, :posts, []) do
{:module, _module, _binary, _term} =
Module.create(
:"#{System.unique_integer()}",
[:"#{System.unique_integer()}"]
|> Module.concat()
|> Module.create(
quote do
use Tableau.Page, unquote(Macro.escape(Keyword.new(post)))

Expand Down

0 comments on commit 8ea0936

Please sign in to comment.