Commit 403f08d3 authored by Xavier Guimard's avatar Xavier Guimard

Upgrade trunk from 1.9 (#1096)

parent 7431117e
......@@ -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
......
......@@ -45,8 +45,82 @@ system('find . -name \*.html -exec sed -i "/<link rel=\"alternate\"/d" {} \;');
system('find . -name \*.html -exec sed -i "/<link rel=\"canonical\"/d" {} \;');
system('find . -name \*.html -exec sed -i "/oss\.maxcdn\.com/d" {} \;');
# Add link to bootstrap
system('find . -name \*.html -exec sed -i "s#<link rel=\"stylesheet\" type=\"text/css\" href=\"lib/exe/css.php.t.bootstrap3.css\"/>#<link rel=\"stylesheet\" type=\"text/css\" href=\"lib/exe/css.php.t.bootstrap3.css\"/>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/static/bwr/bootstrap/dist/css/bootstrap.min.css\"/>#" {} \;');
# Remove embedded jQuery
open F, 'pages/documentation/current/lib/exe/js.php.t.bootstrap3.js';
my $buf;
while (<F>) {
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;
$_;
} <F>;
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 = '<!-- //if:usedebianlibs
<link rel="stylesheet" type="text/css" href="/javascript/bootstrap/css/bootstrap.min.css" />
//elsif:useexternallibs
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"></script>
//elsif:cssminified
<link rel="stylesheet" type="text/css" href="/static/bwr/bootstrap/dist/css/bootstrap.min.css" />
//else -->
<link rel="stylesheet" type="text/css" href="/static/bwr/bootstrap/dist/css/bootstrap.css" />
<!-- //endif -->';
my $jquery = '<!-- //if:usedebianlibs
<script type="text/javascript" src="/javascript/jquery/jquery.min.js"></script>
//elsif:useexternallibs
<script type="text/javascript" src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
//elsif:jsminified
<script type="text/javascript" src="/static/bwr/jquery/dist/jquery.min.js"></script>
//else -->
<script type="text/javascript" src="/static/bwr/jquery/dist/jquery.js"></script>
<!-- //endif -->';
my $jqueryui = '<!-- //if:usedebianlibs
<script type="text/javascript" src="/javascript/jquery-ui/jquery-ui.min.js"></script>
//elsif:useexternallibs
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
//elsif:jsminified
<script type="text/javascript" src="/lib/scripts/jquery-ui.min.js"></script>
//else -->
<script type="text/javascript" src="/lib/scripts/jquery-ui.js"></script>
<!-- //endif -->';
open CMD, "find . -name '*.html'|";
my @list = map { chomp; $_ } <CMD>;
close CMD;
for my $file (@list) {
open F, $file;
my $buf = join '', map {
s#<link.*,href=".*bootstrap\.min\.css.*$"#$cssbootstrap#;
s#src=".*bootstrap.min.js"#src="/javascript/bootstrap/js/bootstrap.min.js"#;
s#(<link.*?lib/exe/css.php.t.bootstrap3.css"/>)#$1
$cssbootstrap#;
s#(<script.*?bootstrap3.js"></script>)#$1
$jquery
$jqueryui#;
$_;
} <F>;
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#<div class=\"dokuwiki export\">#<div class=\"dokuwiki export container\">#" {} \;');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment