phalanx icon indicating copy to clipboard operation
phalanx copied to clipboard

Consider Handlebars as templating/output formatting engine

Open amis92 opened this issue 4 years ago • 7 comments

amis92 avatar Mar 11 '22 23:03 amis92

Format should define also output type, it might be a MIME type for example, or sth else. Default being plain text. Markdown and HTML as options?

amis92 avatar Mar 12 '22 00:03 amis92

Extract FormatEditor component that can edit a RosterFormat object.

amis92 avatar Mar 12 '22 00:03 amis92

Use PRE for output display.

Allow direct HTML (unescaped) output. IFRAME?

amis92 avatar Mar 12 '22 00:03 amis92

Sample HTML format: https://gist.github.com/amis92/f516c3db6bae1ec7bc79400e40de5e27

amis92 avatar Mar 15 '22 20:03 amis92

So to clarify, the goal is to come up with some ideas on how to present the formatted output of a roster right? :)

Gerry546 avatar Mar 17 '22 21:03 Gerry546

Well, we need both ideas, and actual templates to be written, so yes, but also templates. :D

amis92 avatar Mar 17 '22 22:03 amis92

Markdown template prototype:

{{roster.name}} ({{roster.gameSystemName}}) {{> costs roster}}

{{#each roster.forces}}
- {{> force}}
{{/each}}

{{#*inline "costs" ~}}
{{#if costs ~}}
[
{{~#each costs as |cost| ~}}
    {{#if cost.value ~}}
    {{cost.value}} {{cost.name ~}}{{#unless @last}}, {{/unless}}
    {{~/if ~}}
{{/each ~}}
]
{{~/if}}
{{~/inline}}

{{#*inline "force"}}
**{{name}} ({{catalogueName}})** {{> costs}}
{{#each selections}}
- {{> selection ~}}
{{/each ~}}
{{/inline}}

{{#*inline "selection"}}
**{{name}}** {{> costs }}
{{#each selections}}
  - {{> selection ~}}
{{/each ~}}
{{/inline}}

amis92 avatar Mar 29 '22 20:03 amis92