Finishing touches

This commit is contained in:
Mitchell Hanberg 2019-07-03 20:36:04 -04:00
parent 6dece3165f
commit 03e35f858c
7 changed files with 67 additions and 19 deletions

View file

@ -1,4 +1,4 @@
elements = ~w[
temple_funcs = ~w[
html htm
head title style script
noscript template
@ -16,10 +16,16 @@ elements = ~w[
details summary menuitem menu
meta link base
area br col embed hr img input keygen param source track wbr
text partial javascript
]a
text partial
form_for inputs_for
checkbox color_input checkbox color_input date_input date_select datetime_local_input
datetime_select email_input file_input hidden_input number_input password_input range_input
search_input telephone_input textarea text_input time_input time_select url_input
reset submit phx_label multiple_select select phx_link phx_button
]a |> Enum.map(fn e -> {e, :*} end)
[
inputs: ["*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"],
locals_without_parens: Enum.map(elements, fn e -> {e, :*} end)
locals_without_parens: temple_funcs
]

View file

@ -5,7 +5,7 @@ elixir:
- 1.9.0
otp_release:
- 20.3
- 20.3
- 21.3
- 22.0
sudo: false
cache:

5
CHANGELOG.md Normal file
View file

@ -0,0 +1,5 @@
# Changelog
## 0.1.0
- Initial Release

View file

@ -143,3 +143,42 @@ html lang: "en" do
end
end
```
### Formatter
Add the following to your `.formatter.exs` to unsure that the Temple DSL functions are formatted without parens.
```elixir
temple_funcs = ~w[
html htm
head title style script
noscript template
body section nav article aside h1 h2 h3 h4 h5 h6
header footer address main
p pre blockquote ol ul li dl dt dd figure figcaption div
a em strong small s cite q dfn abbr data time code var samp kbd
sub sup i b u mark ruby rt rp bdi bdo span
ins del
iframe object video audio canvas
map svg math
table caption colgroup tbody thead tfoot tr td th
form fieldset legend label button select datalist optgroup
option textarea output progress meter
details summary menuitem menu
meta link base
area br col embed hr img input keygen param source track wbr
text partial
form_for inputs_for
checkbox color_input checkbox color_input date_input date_select datetime_local_input
datetime_select email_input file_input hidden_input number_input password_input range_input
search_input telephone_input textarea text_input time_input time_select url_input
reset submit phx_label multiple_select select phx_link phx_button
]a |> Enum.map(fn e -> {e, :*} end)
[
inputs: ["*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"],
locals_without_parens: temple_funcs
]
```

10
mix.exs
View file

@ -7,6 +7,7 @@ defmodule Temple.MixProject do
name: "Temple",
description: "An HTML DSL for Elixir and Phoenix",
version: "0.1.0",
package: package(),
elixirc_paths: elixirc_paths(Mix.env()),
elixir: "~> 1.7",
start_permanent: Mix.env() == :prod,
@ -35,6 +36,15 @@ defmodule Temple.MixProject do
]
end
defp package do
[
maintainers: ["Mitchell Hanberg"],
licenses: ["MIT"],
links: %{github: "https://github.com/mhanberg/temple"},
files: ~w(lib priv CHANGELOG.md LICENSE mix.exs README.md .formatter.exs)
]
end
defp aliases do
[
docs: ["update_mdn_docs", "docs"]

View file

@ -1,12 +1,6 @@
h1 "Edit <%= schema.human_singular %>"
partial render("form.html",
Map.put(
assigns,
:action,
Routes.<%= schema.route_helper %>_path(@conn, :update, @<%= schema.singular %>)
)
)
partial render("form.html", Map.put(assigns, :action, Routes.<%= schema.route_helper %>_path(@conn, :update, @<%= schema.singular %>)))
span do
phx_link "Back", to: Routes.<%= schema.route_helper %>_path(@conn, :index)

View file

@ -1,12 +1,6 @@
h1 "New <%= schema.human_singular %>"
partial render("form.html",
Map.put(
assigns,
:action,
Routes.<%= schema.route_helper %>_path(@conn, :create)
)
)
partial render("form.html", Map.put(assigns, :action, Routes.<%= schema.route_helper %>_path(@conn, :create)))
span do
phx_link "Back", to: Routes.<%= schema.route_helper %>_path(@conn, :index)