You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@freemarker.apache.org by Daniel Dekany <dd...@freemail.hu> on 2017/01/16 20:41:47 UTC

[FM3] Getting rid of syntax autodetection?

I propose that we remove square bracket VS angle bracket tag syntax
([#...] VS <#...>) *autodetection* in FM3. Instead, the file
extensions should determine which one is used (by default). See
explanation below.

While we have undertaken this tricky task inside FM2, with that we
have pushed this complexity on others. Text editor plugins and IDE
plugins have hard time implementing this (months ago I have tried to
patch the Eclipse plugin to do it correctly, but I couldn't fully
solve it, because the tag syntax can change as you type).

Also, usually, a project either uses one tag syntax or the other. Or
at least they can tell ahead which templates should use which, because
hopefully they have a policy for that (like e-mails use this, web
pages that). So I guess autodetection is very rarely needed (and
hopefully almost never truly necessary).

So, I believe it would be a better compromise if we drop
autodetection, and instead by default [1] the file extension indicates
which tag syntax is used. Let's say, *.f3s* files use square bracket
syntax, and the others (usually *.fm3*) use the angle bracket syntax.
(The concrete file extension patterns aren't the point now.) Editors
can also easily map different file extensions to different syntaxes.

[1] Regarding that it's only "by default". In FM2 you can already
    define quite intricate rules that map template paths to various
    configuration settings that will be applied on the matching
    template (including the tag syntax). (See
    http://freemarker.org/docs/pgui_config_templateconfigurations.html
    if you don't know this feature.) There's also the
    recognizeStandardFileExtensions configuration setting, with which
    you can disable the file extension magic.

-- 
Thanks,
 Daniel Dekany


Re: [FM3] Getting rid of syntax autodetection?

Posted by Jacques Le Roux <ja...@les7arts.com>.
I see no problems with that.

+1

Jacques


Le 16/01/2017 � 21:41, Daniel Dekany a �crit :
> I propose that we remove square bracket VS angle bracket tag syntax
> ([#...] VS <#...>) *autodetection* in FM3. Instead, the file
> extensions should determine which one is used (by default). See
> explanation below.
>
> While we have undertaken this tricky task inside FM2, with that we
> have pushed this complexity on others. Text editor plugins and IDE
> plugins have hard time implementing this (months ago I have tried to
> patch the Eclipse plugin to do it correctly, but I couldn't fully
> solve it, because the tag syntax can change as you type).
>
> Also, usually, a project either uses one tag syntax or the other. Or
> at least they can tell ahead which templates should use which, because
> hopefully they have a policy for that (like e-mails use this, web
> pages that). So I guess autodetection is very rarely needed (and
> hopefully almost never truly necessary).
>
> So, I believe it would be a better compromise if we drop
> autodetection, and instead by default [1] the file extension indicates
> which tag syntax is used. Let's say, *.f3s* files use square bracket
> syntax, and the others (usually *.fm3*) use the angle bracket syntax.
> (The concrete file extension patterns aren't the point now.) Editors
> can also easily map different file extensions to different syntaxes.
>
> [1] Regarding that it's only "by default". In FM2 you can already
>      define quite intricate rules that map template paths to various
>      configuration settings that will be applied on the matching
>      template (including the tag syntax). (See
>      http://freemarker.org/docs/pgui_config_templateconfigurations.html
>      if you don't know this feature.) There's also the
>      recognizeStandardFileExtensions configuration setting, with which
>      you can disable the file extension magic.
>


Re: [FM3] Getting rid of syntax autodetection?

Posted by Sergio Fernández <wi...@apache.org>.
+1
more convention, less autodetection


On Jan 16, 2017 9:41 PM, "Daniel Dekany" <dd...@freemail.hu> wrote:

I propose that we remove square bracket VS angle bracket tag syntax
([#...] VS <#...>) *autodetection* in FM3. Instead, the file
extensions should determine which one is used (by default). See
explanation below.

While we have undertaken this tricky task inside FM2, with that we
have pushed this complexity on others. Text editor plugins and IDE
plugins have hard time implementing this (months ago I have tried to
patch the Eclipse plugin to do it correctly, but I couldn't fully
solve it, because the tag syntax can change as you type).

Also, usually, a project either uses one tag syntax or the other. Or
at least they can tell ahead which templates should use which, because
hopefully they have a policy for that (like e-mails use this, web
pages that). So I guess autodetection is very rarely needed (and
hopefully almost never truly necessary).

So, I believe it would be a better compromise if we drop
autodetection, and instead by default [1] the file extension indicates
which tag syntax is used. Let's say, *.f3s* files use square bracket
syntax, and the others (usually *.fm3*) use the angle bracket syntax.
(The concrete file extension patterns aren't the point now.) Editors
can also easily map different file extensions to different syntaxes.

[1] Regarding that it's only "by default". In FM2 you can already
    define quite intricate rules that map template paths to various
    configuration settings that will be applied on the matching
    template (including the tag syntax). (See
    http://freemarker.org/docs/pgui_config_templateconfigurations.html
    if you don't know this feature.) There's also the
    recognizeStandardFileExtensions configuration setting, with which
    you can disable the file extension magic.

--
Thanks,
 Daniel Dekany