File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ defmodule Mix.Tasks.Tableau.Build do
6565
6666 token = mods |> extensions_for ( :pre_write ) |> run_extensions ( :pre_write , token )
6767
68- for % { body: body , permalink: permalink } <- pages do
68+ for % { body: body , permalink: permalink } <- token . site [ : pages] do
6969 file_path = build_file_path ( out , permalink )
7070 dir = Path . dirname ( file_path )
7171
Original file line number Diff line number Diff line change @@ -25,7 +25,9 @@ defmodule Mix.Tasks.Tableau.FooExtension do
2525 def pre_write ( token ) do
2626 pages =
2727 for page <- token . site . pages do
28- Map . put ( page , :foo , "bar" )
28+ page
29+ |> Map . put ( :foo , "bar" )
30+ |> Map . put ( :body , page . body <> "<!-- foo: bar -->\n " )
2931 end
3032
3133 { :ok , put_in ( token . site . pages , pages ) }
@@ -189,10 +191,16 @@ defmodule Mix.Tasks.Tableau.BuildTest do
189191
190192 assert log =~ "FailExtension failed to run"
191193
192- assert File . exists? ( Path . join ( out , "/index.html" ) )
193- assert File . exists? ( Path . join ( out , "/about/index.html" ) )
194- assert File . exists? ( Path . join ( out , "/a-bing-bong-blog-post/index.html" ) )
195- assert File . exists? ( Path . join ( out , "/some/deeply/nested/page/my-page/index.html" ) )
194+ for file <- [
195+ "/index.html" ,
196+ "/about/index.html" ,
197+ "/a-bing-bong-blog-post/index.html" ,
198+ "/some/deeply/nested/page/my-page/index.html"
199+ ] do
200+ path = Path . join ( out , file )
201+ assert File . exists? ( path )
202+ assert path |> File . read! ( ) |> String . ends_with? ( "<!-- foo: bar -->\n " )
203+ end
196204 end
197205
198206 @ tag :tmp_dir
You can’t perform that action at this time.
0 commit comments