From 403f08d3497b0b356c6d0370b4ad3f8c849704cc Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Thu, 20 Oct 2016 09:02:30 +0000 Subject: [PATCH] Upgrade trunk from 1.9 (#1096) --- Makefile | 21 ++++++++++++-- scripts/doc.pl | 78 ++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 95 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 480c79fee..9afd4dd26 100644 --- a/Makefile +++ b/Makefile @@ -703,8 +703,25 @@ install_examples_site: install_doc_site: # Offline documentation install @rm -rf $(RDEFDOCDIR) - @install -v -d $(RDEFDOCDIR) - @cp -a -f doc/* $(RDEFDOCDIR) + # Install doc directories + @install -v -d -m 755 $(RDEFDOCDIR) + @cd doc && find * -type d |(cd $(RDEFDOCDIR); xargs install -v -d -m 755) && cd - + # Install HTML files + @cd doc && for f in `find * -type f -name '*.html'`; do \ + echo "Installing $$f"; \ + ../scripts/transform-templates \ + usedebianlibs $(USEDEBIANLIBS) \ + useexternallibs $(USEEXTERNALLIBS) \ + jsminified $(JSCOMPRESS) \ + cssminified $(CSSCOMPRESS) <$$f \ + > $(RDEFDOCDIR)/$$f; \ + done && cd - + # Install other files + @cd doc && for f in `find * -type f ! -name '*.html'`; do \ + install -v -m 644 $$f $(RDEFDOCDIR)/$$f; \ + done && cd - + # Install symlinks + @cd doc && tar cf - `find * -type l` | tar xvf - -C $(RDEFDOCDIR) && cd - install_conf_dir: install_sessions_dir install_notif_dir install_captcha_dir # Configuration files install diff --git a/scripts/doc.pl b/scripts/doc.pl index 1ca7000a7..42fb5aea5 100755 --- a/scripts/doc.pl +++ b/scripts/doc.pl @@ -45,8 +45,82 @@ system('find . -name \*.html -exec sed -i "/#\n#" {} \;'); +# Remove embedded jQuery +open F, 'pages/documentation/current/lib/exe/js.php.t.bootstrap3.js'; +my $buf; +while () { + last if (m#^/\*.*jQuery#); + $buf .= $_; +} +close F; +open F, ">pages/documentation/current/lib/exe/js.php.t.bootstrap3.js"; +print F $buf; +close F; + +# Unminify CSS (to avoid "src is missing" warning +open F, 'pages/documentation/current/lib/exe/css.php.t.bootstrap3.css'; +$buf = join '', map { + s/([;\}\{])/$1\n/g; + $_; +} ; +close F; +open F, '>pages/documentation/current/lib/exe/css.php.t.bootstrap3.css'; +print F $buf; +close F; + +# Replace links in HTML files +my $cssbootstrap = ' + +'; +my $jquery = ' + +'; +my $jqueryui = ' + +'; + +open CMD, "find . -name '*.html'|"; +my @list = map { chomp; $_ } ; +close CMD; + +for my $file (@list) { + open F, $file; + my $buf = join '', map { +s#)#$1 +$cssbootstrap#; + s#()#$1 +$jquery +$jqueryui#; + $_; + } ; + open F, ">$file"; + print F $buf; + close F; +} + +# Restore jquery-ui +system('cp ../lemonldap-ng-portal/example/skins/common/js/jquery-ui-*.custom.js pages/documentation/current/lib/scripts/jquery-ui.js'); +system('cp ../lemonldap-ng-portal/example/skins/common/js/jquery-ui-*.custom.min.js pages/documentation/current/lib/scripts/jquery-ui.min.js'); # Put content in a container system('find . -name \*.html -exec sed -i "s#
#
#" {} \;');