Skip to content

Have dancer2 CLI understand different templates #1112

Open
@xsawyerx

Description

@xsawyerx

From Warren Young:

Long ago, I proposed that dancer2 be expanded to understand all of the available
template engines. The current version is hard-coded for Template::Toolkit, which
means playing with a different one means you have to understand both it *and* the
template engine you actually want to use, so you can translate the generated code.

This is less trivial than it sounds.  For instance, from views/layouts/main.tt:

  <meta charset="<% settings.charset %>">

needs to be changed to this for Xslate:

  <meta charset="<: $settings.charset :>”>

The obvious change is the bracket style, but how much user brainpower is wasted
figuring out that you need $ in the second case?  It threw me for a while, at least!

The fix is fundamentally simple: add something like “-t xslate” which selects a
different set of skeleton files.  Then all that’s needed is for someone to manually
translate the standard version for each template engine.

Incidentally, I notice that the initially hidden box underneath “About your
application’s environment” in the app generated by dancer2 is missing two values.
It looks like perl_version and settings.apphandler were defined in D1 but aren’t in
D2, but someone translated the code without checking for this regression.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions