Skip to content

Commit

Permalink
v0.24.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian committed Jan 20, 2020
1 parent 6860ca7 commit e1ddc26
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/guides/Working_With_Genie_Apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ We create the `views/` folder in `app/resources/books/`. We provide the full pat
Usually each controller method will have its own rendering logic – hence, its own view file. Thus, it's a good practice to name the view files just like the methods, so that we can keep track of where they're used.

At the moment, Genie supports HTML and Markdown view files, as well as plain Julia. Their type is identified by file extension so that's an important part.
The HTML views use a `.jl.html` extension while the Markdown files go with `.jl.md` and the Julia ones by `flax.jl`.
The HTML views use a `.jl.html` extension while the Markdown files go with `.jl.md` and the Julia ones by `.jl`.

### HTML views

Expand Down
Empty file removed files/new_app/build/.gitkeep
Empty file.
Empty file removed files/new_app/cache/.gitkeep
Empty file.
Empty file removed files/new_app/sessions/.gitkeep
Empty file.
Empty file removed files/new_app/tasks/.gitkeep
Empty file.
1 change: 0 additions & 1 deletion src/Renderer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const DEFAULT_CONTENT_TYPE = :html
const DEFAULT_LAYOUT_FILE = "app"

const VIEWS_FOLDER = "views"
const LAYOUTS_FOLDER = "layouts"

const BUILD_NAME = "GenieViews"

Expand Down
9 changes: 6 additions & 3 deletions src/renderers/Html.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import Genie.Renderer: @vars
Reexport.@reexport using HttpCommon


const DEFAULT_LAYOUT_FILE = :app
const LAYOUTS_FOLDER = "layouts"

const HTML_FILE_EXT = [".flax.jl", "html.jl"]
const TEMPLATE_EXT = [".flax.html", ".jl.html"]
const MARKDOWN_FILE_EXT = [".md", ".jl.md"]
Expand Down Expand Up @@ -319,8 +322,8 @@ end
"""
function html(resource::Genie.Renderer.ResourcePath, action::Genie.Renderer.ResourcePath; layout::Genie.Renderer.ResourcePath = DEFAULT_LAYOUT_FILE,
context::Module = @__MODULE__, status::Int = 200, headers::Genie.Renderer.HTTPHeaders = Genie.Renderer.HTTPHeaders(), vars...) :: Genie.Renderer.HTTP.Response
html(Path(joinpath(Genie.config.path_resources, string(resource), VIEWS_FOLDER, string(action)));
layout = Path(joinpath(Genie.config.path_app, LAYOUTS_FOLDER, string(layout))),
html(Genie.Renderer.Path(joinpath(Genie.config.path_resources, string(resource), Renderer.VIEWS_FOLDER, string(action)));
layout = Genie.Renderer.Path(joinpath(Genie.config.path_app, LAYOUTS_FOLDER, string(layout))),
context = context, status = status, headers = headers, vars...)
end

Expand Down Expand Up @@ -362,7 +365,7 @@ end
html(viewfile::FilePath; layout::Union{Nothing,FilePath} = nothing,
context::Module = @__MODULE__, status::Int = 200, headers::HTTPHeaders = HTTPHeaders(), vars...) :: HTTP.Response
Parses and renders the HTML `viewfile`, optionally rendering it within the `layout` file. Valid file formats are `.html.jl` and `.flax.jl`.
Parses and renders the HTML `viewfile`, optionally rendering it within the `layout` file. Valid file format is `.html.jl`.
# Arguments
- `viewfile::FilePath`: filesystem path to the view file as a `Renderer.FilePath`, ie `Renderer.FilePath("/path/to/file.html.jl")`
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/Js.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const JSString = String

const NBSP_REPLACEMENT = (" "=>"!!nbsp;;")

export JSString, js
export js


"""
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/Json.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ end
"""
function json(resource::Genie.Renderer.ResourcePath, action::Genie.Renderer.ResourcePath; context::Module = @__MODULE__,
status::Int = 200, headers::Genie.Renderer.HTTPHeaders = Genie.Renderer.HTTPHeaders(), vars...) :: Genie.Renderer.HTTP.Response
json(Path(joinpath(Genie.config.path_resources, string(resource), VIEWS_FOLDER, string(action) * JSON_FILE_EXT));
json(Genie.Renderer.Path(joinpath(Genie.config.path_resources, string(resource), VIEWS_FOLDER, string(action) * JSON_FILE_EXT));
context = context, status = status, headers = headers, vars...)
end

Expand Down

2 comments on commit e1ddc26

@essenciary
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/8215

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.24.1 -m "<description of version>" e1ddc260b9d3af2c13a745438647629684a0847c
git push origin v0.24.1

Please sign in to comment.