defmodule Phoenix.Template.EExEngine do
  @moduledoc """
  The Phoenix engine that handles the `.eex` extension.
  """

  @behaviour Phoenix.Template.Engine

  def compile(path, name) do
    EEx.compile_file(path, engine: engine_for(name), line: 1, trim: true)
  end

  defp engine_for(name) do
    case Phoenix.Template.format_encoder(name) do
      Phoenix.Template.HTML ->
        unless Code.ensure_loaded?(Phoenix.HTML.Engine) do
          raise "could not load Phoenix.HTML.Engine to use with .html.eex templates. " <>
                "You can configure your own format encoder for HTML but we recommend " <>
                "adding phoenix_html as a dependency as it provides XSS protection"
        end
        Phoenix.HTML.Engine
      _ ->
        EEx.SmartEngine
    end
  end
end

defmodule Phoenix.Template.EExEngine do
  @moduledoc """
  The Phoenix engine that handles the `.eex` extension.
  """

  @behaviour Phoenix.Template.Engine

  def compile(path, name) do
    EEx.compile_file(path, engine: engine_for(name), line: 1)
  end

  defp engine_for(name) do
    case Phoenix.Template.format_encoder(name) do
      Phoenix.Template.HTML ->
        unless Code.ensure_loaded?(Phoenix.HTML.Engine) do
          raise "Could not load Phoenix.HTML.Engine to use with .html.eex templates. " <>
                "You can configure your own format encoder for HTML but we recommend " <>
                "adding phoenix_html as a dependency as it provides XSS protection."
        end
        Phoenix.HTML.Engine
      _ ->
        EEx.SmartEngine
    end
  end
end

Revert "Trim whitespace on EEx engines when Elixir >= 1.1"
Revert "Trim whitespace on EEx engines when Elixir >= 1.1"

Let's save this for Phoenix v1.1 as it may break test suites

This reverts commit b820aa122c50358e707738b2d6900fda83593247.

ephe-meral/phoenix,michalmuskala/phoenix,y-yagi/phoenix,manukall/phoenix,evax/phoenix,pap/phoenix,DavidAlphaFox/phoenix,foxnewsnetwork/phoenix,mitchellhenke/phoenix,korobkov/phoenix,eksperimental/phoenix,Gazler/phoenix,keathley/phoenix,andrewvy/phoenix,lono-devices/phoenix,vic/phoenix,Rumel/phoenix,Smulligan85/phoenix,michalmuskala/phoenix,Gazler/phoenix,jamilabreu/phoenix,jwarwick/phoenix,pap/phoenix,cas27/phoenix,optikfluffel/phoenix,jwarwick/phoenix,ericmj/phoenix,gjaldon/phoenix,bsmr-erlang/phoenix,bsmr-erlang/phoenix,ephe-meral/phoenix,rafbgarcia/phoenix,rodrigues/phoenix,0x00evil/phoenix,omotenko/phoenix_auth,mschae/phoenix,trarbr/phoenix,seejee/phoenix,Smulligan85/phoenix,lancehalvorsen/phoenix,CultivateHQ/phoenix,manukall/phoenix,phoenixframework/phoenix,iStefo/phoenix,vic/phoenix,ybur-yug/phoenix,Rumel/phoenix,nshafer/phoenix,ericmj/phoenix,gjaldon/phoenix,rodrigues/phoenix,stevedomin/phoenix,Ben-Evolently/phoenix,eksperimental/phoenix,phoenixframework/phoenix,nshafer/phoenix,nshafer/phoenix,Kosmas/phoenix,ybur-yug/phoenix,phoenixframework/phoenix,lono-devices/phoenix,cas27/phoenix,mobileoverlord/phoenix,mobileoverlord/phoenix,iStefo/phoenix,lancehalvorsen/phoenix,dmarkow/phoenix,keathley/phoenix,jamilabreu/phoenix,stevedomin/phoenix,Joe-noh/phoenix,dmarkow/phoenix,0x00evil/phoenix,0x00evil/phoenix,wsmoak/phoenix,optikfluffel/phoenix,CultivateHQ/phoenix,rafbgarcia/phoenix,mvidaurre/phoenix,tony612/phoenix,optikfluffel/phoenix,wsmoak/phoenix,korobkov/phoenix,omotenko/phoenix_auth,DavidAlphaFox/phoenix,evax/phoenix,andrewvy/phoenix,rafbgarcia/phoenix,mvidaurre/phoenix,mitchellhenke/phoenix,Kosmas/phoenix,mschae/phoenix,brucify/phoenix,trarbr/phoenix,Joe-noh/phoenix,seejee/phoenix