matrix-spec/scripts/add-matrix-org-stylings.sh

45 lines
1.1 KiB
Bash
Raw Normal View History

2015-11-20 00:13:40 +01:00
#!/bin/bash -eu
2015-02-19 17:00:21 +01:00
2015-11-20 00:13:40 +01:00
if [[ $# != 1 || ! -d $1 ]]; then
echo >&2 "Usage: $0 include_dir"
exit 1
2015-10-12 20:11:35 +02:00
fi
2015-11-20 00:13:40 +01:00
HEADER="$1/head.html"
NAV_BAR="$1/nav.html"
FOOTER="$1/footer.html"
2015-10-12 20:11:35 +02:00
2015-11-20 00:16:02 +01:00
for f in "$1"/{head,nav,footer}.html; do
2015-11-20 00:13:40 +01:00
if [[ ! -e "${f}" ]]; then
echo >&2 "Need ${f} to exist"
2015-10-12 20:11:35 +02:00
exit 1
2015-11-20 00:13:40 +01:00
fi
done
2015-10-12 20:11:35 +02:00
2015-11-27 16:03:22 +01:00
files=gen/*.html
2015-10-12 20:57:41 +02:00
perl -MFile::Slurp -pi -e 'BEGIN { $header = read_file("'$HEADER'") } s#<head>#<head>$header
<link rel="stylesheet" href="//matrix.org/docs/guides/css/docs_overrides.css">
2015-11-27 16:03:22 +01:00
#' ${files}
2015-02-19 17:00:21 +01:00
2015-10-12 20:11:35 +02:00
perl -MFile::Slurp -pi -e 'BEGIN { $nav = read_file("'$NAV_BAR'") } s#<body># <body class="blog et_fixed_nav et_cover_background et_right_sidebar">
<div id="page-wrapper">
<div class="page-content" id="page-container">
$nav
<div id="main-content">
<div class="wrapper" id="wrapper">
<div class="document_foo" id="document">
2015-11-27 16:03:22 +01:00
#' ${files}
2015-02-19 17:00:21 +01:00
2015-10-12 20:11:35 +02:00
perl -MFile::Slurp -pi -e 'BEGIN { $footer = read_file("'$FOOTER'") } s#</body>#
</div>
</div>
<div class="push">
</div>
</div>
</div>
$footer
</div>
</div>
2015-11-27 16:03:22 +01:00
</body>#' ${files}