icinga2/doc/mkdoc.sh

75 lines
1.5 KiB
Bash
Raw Normal View History

2013-09-26 08:59:29 +02:00
#!/bin/sh
cd -- `dirname $0`
2013-10-10 08:53:12 +02:00
2013-10-10 09:40:50 +02:00
while read badword; do
if grep -i "$badword" *.md; then
2013-10-10 08:53:12 +02:00
echo "Documentation contains banned word."
exit 1
fi
2013-10-10 09:40:50 +02:00
done < BLACKLIST
2013-10-10 08:53:12 +02:00
cat <<HTML
<!DOCTYPE html>
<html>
2013-09-26 14:01:29 +02:00
<head>
<link rel="stylesheet" type="text/css" href="toc.css" media="all" />
<link rel="stylesheet" type="text/css" href="toc-print.css" media="print" />
2013-09-26 14:55:43 +02:00
<xmp theme="cerulean" style="display:none;">
HTML
for file in *.md; do
cat $file
2013-09-26 14:01:29 +02:00
echo; echo
done
cat <<HTML
</xmp>
2013-09-27 07:35:39 +02:00
<script src="strapdownjs/strapdown.js"></script>
<script src="jquery.min.js"></script>
2013-09-26 14:01:29 +02:00
<script src="jquery.toc.min.js"></script>
<script>
\$('div#content').prepend('<div id="toc"></div>');
\$('#toc').toc({
'selectors': 'h1,h2,h3,h4,h5,h6'
});
</script>
2013-09-26 14:55:43 +02:00
<link rel="stylesheet" type="text/css" href="toc-margin.css" media="screen" />
2013-09-26 14:01:29 +02:00
</head>
<body>
<div id="content" />
<script>
var indices = [];
function addIndex() {
// jQuery will give all the HNs in document order
jQuery('h1,h2,h3,h4,h5,h6').each(function(i,e) {
var hIndex = parseInt(this.nodeName.substring(1)) - 1;
// just found a levelUp event
if (indices.length - 1 > hIndex) {
indices= indices.slice(0, hIndex + 1 );
}
// just found a levelDown event
if (indices[hIndex] == undefined) {
indices[hIndex] = 0;
}
// count + 1 at current level
indices[hIndex]++;
// display the full position in the hierarchy
jQuery(this).prepend(indices.join(".") + " ");
});
}
jQuery(document).ready(function() {
addIndex();
});
</script>
</body>
</html>
HTML