Blame Scripts/Bash/Functions/Html/Config/output_forHeadingsToc.awk
|
|
f3bce7 |
#!/usr/bin/gawk
|
|
|
f3bce7 |
#
|
|
|
f3bce7 |
|
|
|
f3bce7 |
# required by html_updateHeadings.sh function, inside centos-art.sh
|
|
|
f3bce7 |
# script.
|
|
|
f3bce7 |
#
|
|
|
f3bce7 |
# Copyright (C) 2009-2010 Alain Reguera Delgado
|
|
|
f3bce7 |
#
|
|
|
f3bce7 |
# This program is free software; you can redistribute it and/or modify
|
|
|
f3bce7 |
|
|
|
f3bce7 |
|
|
|
f3bce7 |
|
|
|
f3bce7 |
#
|
|
|
f3bce7 |
|
|
|
f3bce7 |
|
|
|
f3bce7 |
|
|
|
f3bce7 |
# General Public License for more details.
|
|
|
f3bce7 |
#
|
|
|
f3bce7 |
|
|
|
f3bce7 |
# along with this program; if not, write to the Free Software
|
|
|
f3bce7 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
f3bce7 |
# USA.
|
|
|
f3bce7 |
#
|
|
|
f3bce7 |
# ----------------------------------------------------------------------
|
|
|
f3bce7 |
# $Id$
|
|
|
f3bce7 |
# ----------------------------------------------------------------------
|
|
|
f3bce7 |
|
|
|
f3bce7 |
BEGIN {FS=":"}
|
|
|
f3bce7 |
|
|
|
f3bce7 |
{
|
|
|
f3bce7 |
if ($1 == 0 && $2 == $3) {
|
|
|
f3bce7 |
opentags = "
|
|
|
f3bce7 |
closetags = ""
|
|
|
f3bce7 |
}
|
|
|
f3bce7 |
|
|
|
f3bce7 |
if ($1 > 0 && $2 > $3) {
|
|
|
f3bce7 |
opentags = "
|
|
|
f3bce7 |
closetags = ""
|
|
|
f3bce7 |
}
|
|
|
f3bce7 |
|
|
|
f3bce7 |
if ($1 > 0 && $2 == $3) {
|
|
|
f3bce7 |
opentags = ""
|
|
|
f3bce7 |
closetags = ""
|
|
|
f3bce7 |
}
|
|
|
f3bce7 |
|
|
|
f3bce7 |
if ($1 > 0 && $2 < $3) {
|
|
|
f3bce7 |
opentags = ""
|
|
|
f3bce7 |
for (i = 1; i <= ($3 - $2); i++) {
|
|
|
f3bce7 |
opentags = opentags ""
|
|
|
f3bce7 |
closetags = ""
|
|
|
f3bce7 |
}
|
|
|
f3bce7 |
opentags = opentags ""
|
|
|
f3bce7 |
}
|
|
|
f3bce7 |
|
|
|
f3bce7 |
printf "%s%s%s\n",opentags,$4,closetags
|
|
|
f3bce7 |
|
|
|
f3bce7 |
}
|
|
|
f3bce7 |
|
|
|
f3bce7 |
END {
|
|
|
f3bce7 |
|
|
|
f3bce7 |
if ($1 > 0 && $2 >= $3 && $3 > 1) {
|
|
|
f3bce7 |
for (i = 1; i <= $3; i++) {
|
|
|
f3bce7 |
print ""
|
|
|
f3bce7 |
}
|
|
|
f3bce7 |
}
|
|
|
f3bce7 |
|
|
|
f3bce7 |
if ($1 > 0 && $2 >= $3 && $3 == 1) {
|
|
|
f3bce7 |
print ""
|
|
|
f3bce7 |
print ""
|
|
|
f3bce7 |
}
|
|
|
f3bce7 |
|
|
|
f3bce7 |
if ($1 > 0 && $2 < $3) {
|
|
|
f3bce7 |
for (i = 1; i <= $2; i++) {
|
|
|
f3bce7 |
print ""
|
|
|
f3bce7 |
}
|
|
|
f3bce7 |
}
|
|
|
f3bce7 |
|
|
|
f3bce7 |
print ""
|
|
|
f3bce7 |
}
|