blob: c8f10bf7331032fb2da8fef1957d677eab94e9d3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
#!/bin/sh -e
# Libreboot documentation build script: index
#
# This script borrows from gendocs.sh, part of gnulib, the GNU
# Portability Library (https://www.gnu.org/software/gnulib/). The
# objective is to generate a html document which indexes the libreboot
# documentation in its various formats.
#
# This script does not assume a certain set of formats have been
# generated. It generates the index based on which files are located
# in $man_dir.
# The relevant portion of gendocs.sh:
#
# curdate=`$SETLANG date '+%B %d, %Y'`
# sed \
# -e "s!%%TITLE%%!$MANUAL_TITLE!g" \
# -e "s!%%EMAIL%%!$EMAIL!g" \
# -e "s!%%PACKAGE%%!$PACKAGE!g" \
# -e "s!%%DATE%%!$curdate!g" \
# -e "s!%%HTML_MONO_SIZE%%!$html_mono_size!g" \
# -e "s!%%HTML_MONO_GZ_SIZE%%!$html_mono_gz_size!g" \
# -e "s!%%HTML_NODE_TGZ_SIZE%%!$html_node_tgz_size!g" \
# -e "s!%%HTML_SECTION_TGZ_SIZE%%!$html_section_tgz_size!g" \
# -e "s!%%HTML_CHAPTER_TGZ_SIZE%%!$html_chapter_tgz_size!g" \
# -e "s!%%INFO_TGZ_SIZE%%!$info_tgz_size!g" \
# -e "s!%%DVI_GZ_SIZE%%!$dvi_gz_size!g" \
# -e "s!%%PDF_SIZE%%!$pdf_size!g" \
# -e "s!%%ASCII_SIZE%%!$ascii_size!g" \
# -e "s!%%ASCII_GZ_SIZE%%!$ascii_gz_size!g" \
# -e "s!%%TEXI_TGZ_SIZE%%!$texi_tgz_size!g" \
# -e "s!%%DOCBOOK_HTML_NODE_TGZ_SIZE%%!$html_node_db_tgz_size!g" \
# -e "s!%%DOCBOOK_ASCII_SIZE%%!$docbook_ascii_size!g" \
# -e "s!%%DOCBOOK_PDF_SIZE%%!$docbook_pdf_size!g" \
# -e "s!%%DOCBOOK_XML_SIZE%%!$docbook_xml_size!g" \
# -e "s!%%DOCBOOK_XML_GZ_SIZE%%!$docbook_xml_gz_size!g" \
# -e "s,%%SCRIPTURL%%,$scripturl,g" \
# -e "s!%%SCRIPTNAME%%!$prog!g" \
# -e "$CONDS" \
# $GENDOCS_TEMPLATE_DIR/gendocs_template >"$outdir/index.html"
# TODO: Implement total size for directories (see e.g.
# http://www.gnu.org/software/findutils/manual/find.html)
man_dir="docs/manual/"
template_dir="docs/templates/"
pkg_title="GNU Libreboot manual"
pkg_email="example@libreboot.org" #sample
pkg_name="libreboot"
curdate=`date '+%B %d, %Y'`
# FUNCTION COPIED FROM gendocs.sh
# Function to return size of $1 in something resembling kilobytes.
calcsize()
{
size=`ls -ksl $1 | awk '{print $1}'`
echo $size
}
# END FUNCTION COPIED FROM gendocs.sh
concat_index()
{
if [ -e $man_dir$1 ]; then
if [ -d $man_dir$1 ]; then
echo "<li><a href=\"$1/index.html\">$2</a>$3</li>" >> "${man_dir}index.html"
else
echo "<li><a href=\"$1\">$2</a>$3</li>" >> "${man_dir}index.html"
fi
fi
}
echo "Building index..."
sed \
-e "s!%%TITLE%%!$pkg_title!g" \
-e "s!%%PACKAGE%%!$pkg_name!g" \
-e "s!%%DATE%%!$curdate!g" \
${template_dir}gendocs_template_header >"${man_dir}index.html"
for i in $(ls $man_dir); do
[ -d $man_dir$i ] || size=`calcsize "${man_dir}${i}"`
case $i in
${pkg_name}.dvi.gz)
dvi_gz_size=$size;;
${pkg_name}_html-by-node.tar.gz)
html_node_tgz_size=$size;;
${pkg_name}_html-by-section.tar.gz)
html_section_tgz_size=$size;;
${pkg_name}_html-one-page.html)
html_mono_size=$size;;
${pkg_name}_html-one-page.html.gz)
html_mono_gz_size=$size;;
${pkg_name}.info.gz)
info_gz_size=$size;;
${pkg_name}.pdf)
pdf_size=$size;;
${pkg_name}.pdf.gz)
pdf_gz_size=$size;;
${pkg_name}.ps)
ps_size=$size;;
${pkg_name}.ps.gz)
ps_gz_size=$size;;
${pkg_name}.txt)
plaintext_size=$size;;
${pkg_name}.txt.gz)
plaintext_gz_size=$size;;
${pkg_name}.texi.gz)
texinfo_gz_size=$size;;
*)
:;; # if a directory, do nothing (see TODO)
esac
done
concat_index "${pkg_name}_html-one-page.html" "HTML (${html_mono_size}K bytes)" " - entirely on one web page."
concat_index "${pkg_name}_html-by-node" "HTML" " - with one web page per node."
concat_index "${pkg_name}_html-by-section" "HTML" " - with one web page per section."
concat_index "${pkg_name}_html-one-page.html.gz" "HTML compressed (${html_mono_gz_size}K gzipped characters)" " - entirely on one web page."
concat_index "${pkg_name}_html-by-node.tar.gz" "HTML (${html_node_tgz_size}K gzipped tar file)" " - with one web page per node."
concat_index "${pkg_name}_html-by-section.tar.gz" "HTML (${html_section_tgz_size}K gzipped tar file)" " - with one web page per section."
concat_index "${pkg_name}.info.gz" "Info document (${info_gz_size}K bytes gzipped)."
concat_index "${pkg_name}.txt" "ASCII text (${plaintext_size}K bytes)."
concat_index "${pkg_name}.txt.gz" "ASCII text (${plaintext_gz_size}K bytes gzipped)."
concat_index "${pkg_name}.dvi.gz" "TeX dvi file (${dvi_gz_size}K bytes gzipped)."
concat_index "${pkg_name}.pdf" "PDF file (${pdf_size}K bytes)."
concat_index "${pkg_name}.pdf.gz" "PDF file compressed (${pdf_gz_size}K bytes gzipped)."
concat_index "${pkg_name}.ps" "Postscript file (${ps_size}K bytes)."
concat_index "${pkg_name}.ps.gz" "Postscript file compressed (${ps_gz_size}K bytes gzipped)."
concat_index "${pkg_name}.texi.gz" "Texinfo source (${texinfo_gz_size}K bytes gzipped)."
sed -e "s!%%EMAIL%%!$pkg_email!g" ${template_dir}gendocs_template_footer >>"$man_dir/index.html"
echo "Done."
|