Added templates.yml for generic template support

master
Sarvesh D 2015-11-26 21:02:55 +05:30
parent 5a7352af6c
commit 08fde96f65
3 changed files with 58 additions and 2 deletions

View File

@ -1,5 +1,5 @@
{
"id": "<: $lia_id :>_cheat_sheet",
"id": "<: $ia_id :>_cheat_sheet",
"name": "<: $ia_name_separated :>",
"description": "displayed as subtitle of the AnswerBar; optional",

View File

@ -1,4 +1,4 @@
.zci--<: $lia_id :> {
.zci--<: $ia_id :> {
}

56
template/templates.yml Normal file
View File

@ -0,0 +1,56 @@
---
# Template definitions for goodies.
# Each template represents one input and one output file.
# Modification of files generated by certain templates will need to restart a
# running duckpan instance in order to be recognized:
# - Perl modules
# - Cheat Sheet JSON, since they are pre-loaded
# This is indicated by the 'needs_restart' field.
templates:
pm:
label: Perl Module
input: lib/DDG/Goodie/Example.pm
output: lib/DDG/Goodie/<:$ia_path:>.pm
needs_restart: true
test:
label: Perl Module Test
input: t/Example.t
output: t/<:$ia_path:>.t
js:
label: Javascript
input: share/goodie/example/example.js
output: share/goodie/<:$ia_path_lc:>/<:$ia_id:>.js
css:
label: CSS
input: share/goodie/example/example.css
output: share/goodie/<:$ia_path_lc:>/<:$ia_id:>.css
cheatsheet_json:
label: CheatSheet JSON
input: share/goodie/cheat_sheets/json/example.json
output: share/goodie/cheat_sheets/json/<:$ia_id:>.json
needs_restart: true
# A template set is a collection of templates used to generate all files of a
# sub-type of an Instant Answer type. Each set can have some 'required'
# templates (which are always applied) and some 'optional' templates (which are
# applied after asking the user).
template_sets:
default:
description: Standard Goodie Instant Answer
required: [ pm, test ]
optional: [ js, css ]
cheatsheet:
description: Cheat Sheet Instant Answer
required: [ cheatsheet_json ]
all:
description: Goodie with all backend and frontend files
required: [ pm, test, js, css ]
...