summaryrefslogtreecommitdiffstats
path: root/scripts.dmp
diff options
context:
space:
mode:
authordequis2014-08-06 21:15:25 -0300
committerdequis2014-08-07 02:06:41 -0300
commite8ccd4beeccdc54695648c8a88f0612de529d5e8 (patch)
treed93e8a57e50a1008786c0db3687482f1f25921b3 /scripts.dmp
parent37faad67b5238555bb6b754d6d3291bb98cc6123 (diff)
downloadscripts.irssi.org-e8ccd4beeccdc54695648c8a88f0612de529d5e8.tar.bz2
Use for loops over attributes to generate scripts.dmp output
It's shorter and also reduces redundant whitespace in output. This liquid templating engine is dumb. Writing it this way is the only way to avoid whitespace between tags.
Diffstat (limited to 'scripts.dmp')
-rw-r--r--scripts.dmp31
1 files changed, 7 insertions, 24 deletions
diff --git a/scripts.dmp b/scripts.dmp
index fc396fe..d80b6b4 100644
--- a/scripts.dmp
+++ b/scripts.dmp
@@ -2,33 +2,16 @@
layout: nil
---
+{% assign required_attributes = "filename modified version authors contact name description license" | split: ' ' %}
+{% assign optional_attributes = "url changed commands note modules" | split: ' ' %}
+
$scripts = {
{% for script in site.data.scripts %}
'{{ script.filename }}' => {
- 'filename' => '{{ script.filename }}',
- 'last_modified' => '{{ script.modified }}',
- 'version' => '{{ script.version }}',
- 'authors' => '{{ script.authors }}',
- 'contact' => '{{ script.contact }}',
- 'name' => '{{ script.name }}',
- 'description' => '{{ script.description }}',
- 'license' => '{{ script.license }}',
-{% if script.url %}
- 'url' => '{{ script.url }}',
-{% endif %}
-{% if script.changed %}
- 'changed' => '{{ script.changed }}',
-{% endif %}
-{% if script.commands %}
- 'commands' => '{{ script.commands }}',
-{% endif %}
-{% if script.note %}
- 'note' => '{{ script.note }}',
-{% endif %}
-{% if script.modules %}
- 'modules' => '{{ script.modules }}',
-{% endif %}
-
+{% for attr in required_attributes %}
+ '{{ attr }}' => '{{ script[attr] }}',{% endfor %}
+{% for attr in optional_attributes %}{% if script contains attr %}
+ '{{ attr }}' => '{{ script[attr] }}',{% endif %}{% endfor %}
},
{% endfor %}
};