BSData / phalanx

Project Phalanx is a roster editor handling BattleScribe datafiles
https://www.phalanx.tools/
MIT License
155 stars 25 forks source link

Consider Handlebars as templating/output formatting engine #34

Open amis92 opened 2 years ago

amis92 commented 2 years ago

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 commented 2 years ago

Extract FormatEditor component that can edit a RosterFormat object.

amis92 commented 2 years ago

Use PRE for output display.

Allow direct HTML (unescaped) output. IFRAME?

amis92 commented 2 years ago

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

Gerry546 commented 2 years ago

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

amis92 commented 2 years ago

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

amis92 commented 2 years ago

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}}