From 2b2d133e971ff7ef8c59cf8eef0c4ef0254db16c Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Thu, 21 Jan 2016 13:00:19 +0000 Subject: [PATCH] Prepare Debian libs usage for Debian official release --- Makefile | 7 ++++--- lemonldap-ng-manager/site/templates/header.tpl | 6 +++++- .../site/templates/scripts.tpl | 11 ++++++++++- .../example/skins/bootstrap/header.tpl | 12 ++++++++++-- .../example/skins/common/script.tpl | 10 ++++++---- scripts/transform-templates | 18 +++++++++++++----- 6 files changed, 48 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 96438203f..4f9dde7e9 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,8 @@ DESTDIR= # Flag for optimizations -PROD=no +USEDEBIANLIBS=no +PROD=$(USEDEBIANLIBS) # Compression JSCOMPRESS=$(PROD) @@ -434,7 +435,7 @@ install_manager_site: install_conf_dir $(RMANAGERTEMPLATESDIR) @cp -pR $(SRCMANAGERDIR)/site/static/* $(RMANAGERSTATICDIR) @for f in $(SRCMANAGERDIR)/site/templates/*.tpl; do \ - ./scripts/transform-templates jsminified $(JSCOMPRESS) cssminified $(CSSCOMPRESS) <$$f \ + ./scripts/transform-templates usedebianlibs $(USEDEBIANLIBS) jsminified $(JSCOMPRESS) cssminified $(CSSCOMPRESS) <$$f \ > $(RMANAGERTEMPLATESDIR)/`basename $$f`; \ done @cp -pR $(SRCMANAGERDIR)/eg/* $(RMANAGERPSGIDIR) @@ -461,7 +462,7 @@ install_portal_site: install_conf_dir @cp -pR -f ${SRCPORTALDIR}/example/register.pl ${RPORTALDIR} @tar -cf - -C ${SRCPORTALDIR}/example/skins/ $$(ls ${SRCPORTALDIR}/example/skins/) |tar -xf - -C $(RPORTALSKINSDIR) @for f in `find $(RPORTALSKINSDIR) -type f -name '*.tpl'`; do \ - ./scripts/transform-templates jsminified $(JSCOMPRESS) cssminified $(CSSCOMPRESS) <$$f >$$f.tmp; \ + ./scripts/transform-templates usedebianlibs $(USEDEBIANLIBS) jsminified $(JSCOMPRESS) cssminified $(CSSCOMPRESS) <$$f >$$f.tmp; \ mv -f $$f.tmp $$f; \ done @if [ "$(PORTALDIR)/skins/" != "$(PORTALSKINSDIR)/" ]; then \ diff --git a/lemonldap-ng-manager/site/templates/header.tpl b/lemonldap-ng-manager/site/templates/header.tpl index 1904412bd..bb6e5b374 100644 --- a/lemonldap-ng-manager/site/templates/header.tpl +++ b/lemonldap-ng-manager/site/templates/header.tpl @@ -7,7 +7,11 @@ logos/favicon.ico" /> logos/favicon.ico" /> bwr/angular-ui-tree/dist/angular-ui-tree.min.css" /> - - - diff --git a/scripts/transform-templates b/scripts/transform-templates index 96bf82989..e84052f14 100755 --- a/scripts/transform-templates +++ b/scripts/transform-templates @@ -2,7 +2,8 @@ use strict; -our $cond = 1; +our $cond = 1; +our $condDone = 0; our %args; for ( my $i = 0 ; $i < @ARGV ; $i += 2 ) { $args{ $ARGV[$i] } = @@ -11,13 +12,20 @@ for ( my $i = 0 ; $i < @ARGV ; $i += 2 ) { while () { if (m#//if:(\w+)#) { - $cond = $args{$1}; + $cond = $args{$1}; + $condDone = $cond; } - elsif (m#//elsif:(\w+)# and not $cond) { - $cond = $args{$1}; + elsif (m#//elsif:(\w+)#) { + if ($condDone) { + $cond = 0; + } + else { + $cond = $args{$1}; + $condDone ||= $cond; + } } elsif (m#//else#) { - $cond = !$cond; + $cond = !$condDone; } elsif (m#//endif#) { $cond = 1;