c965048f40
* Fine tune whitespace The EEx outut now emits more human-readable and predictable formatting. This includes proper indenting, at least for each "root" template. * Internal whitespace control You can now use a bang version of any nonvoid tag to emit the markup witout the internal whitespace. This means that there will not be a newline emitted after the opening tag and before the closing tag.
24 lines
448 B
Elixir
24 lines
448 B
Elixir
defmodule Temple.Parser.Text do
|
|
@moduledoc false
|
|
@behaviour Temple.Parser
|
|
|
|
defstruct text: nil
|
|
|
|
alias Temple.Parser
|
|
|
|
@impl Parser
|
|
def applicable?(text) when is_binary(text), do: true
|
|
def applicable?(_), do: false
|
|
|
|
@impl Parser
|
|
def run(text) do
|
|
Temple.Ast.new(__MODULE__, text: text)
|
|
end
|
|
|
|
defimpl Temple.Generator do
|
|
def to_eex(%{text: text}, indent \\ 0) do
|
|
[Parser.Utils.indent(indent), text]
|
|
end
|
|
end
|
|
end
|