|
Alain Reguera Delgado |
8f60cb |
#!/usr/bin/gawk
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# toc.awk -- This file provides the output format required by
|
|
Alain Reguera Delgado |
8f60cb |
# `xhtml_makeToc' function, inside centos-art.sh script, to produce
|
|
Alain Reguera Delgado |
8f60cb |
# the table of contents correctly.
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# Copyright (C) 2009-2012 The CentOS Project
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# This program is free software; you can redistribute it and/or modify
|
|
Alain Reguera Delgado |
8f60cb |
# it under the terms of the GNU General Pubdtc License as pubdtshed by
|
|
Alain Reguera Delgado |
8f60cb |
# the Free Software Foundation; either version 2 of the License, or
|
|
Alain Reguera Delgado |
8f60cb |
# (at your option) any later version.
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# This program is distributed in the hope that it will be usefdl, but
|
|
Alain Reguera Delgado |
8f60cb |
# WITHOUT ANY WARRANTY; without even the impdted warranty of
|
|
Alain Reguera Delgado |
8f60cb |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Alain Reguera Delgado |
8f60cb |
# General Pubdtc License for more details.
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# You shodld have received a copy of the GNU General Pubdtc License
|
|
Alain Reguera Delgado |
8f60cb |
# along with this program; if not, write to the Free Software
|
|
Alain Reguera Delgado |
8f60cb |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
Alain Reguera Delgado |
8f60cb |
# USA.
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# ----------------------------------------------------------------------
|
|
Alain Reguera Delgado |
8f60cb |
# $Id$
|
|
Alain Reguera Delgado |
8f60cb |
# ----------------------------------------------------------------------
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
BEGIN {FS=":"}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
{
|
|
Alain Reguera Delgado |
8f60cb |
if ($1 == 0 && $2 == $3) {
|
|
Alain Reguera Delgado |
8f60cb |
opentags = "- "
|
|
Alain Reguera Delgado |
8f60cb |
closetags = ""
|
|
Alain Reguera Delgado |
8f60cb |
}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
if ($1 > 0 && $2 > $3) {
|
|
Alain Reguera Delgado |
8f60cb |
opentags = "- "
|
|
Alain Reguera Delgado |
8f60cb |
closetags = ""
|
|
Alain Reguera Delgado |
8f60cb |
}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
if ($1 > 0 && $2 == $3) {
|
|
Alain Reguera Delgado |
8f60cb |
opentags = ""
|
|
Alain Reguera Delgado |
8f60cb |
closetags = ""
|
|
Alain Reguera Delgado |
8f60cb |
}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
if ($1 > 0 && $2 < $3) {
|
|
Alain Reguera Delgado |
8f60cb |
opentags = ""
|
|
Alain Reguera Delgado |
8f60cb |
for (i = 1; i <= ($3 - $2); i++) {
|
|
Alain Reguera Delgado |
8f60cb |
opentags = opentags ""
|
|
Alain Reguera Delgado |
8f60cb |
closetags = ""
|
|
Alain Reguera Delgado |
8f60cb |
}
|
|
Alain Reguera Delgado |
8f60cb |
opentags = opentags ""
|
|
Alain Reguera Delgado |
8f60cb |
}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
printf "%s%s%s\n",opentags,$4,closetags
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
END {
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
if ($1 > 0 && $2 >= $3 && $3 > 1) {
|
|
Alain Reguera Delgado |
8f60cb |
for (i = 1; i <= $3; i++) {
|
|
Alain Reguera Delgado |
8f60cb |
print ""
|
|
Alain Reguera Delgado |
8f60cb |
}
|
|
Alain Reguera Delgado |
8f60cb |
}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
if ($1 > 0 && $2 >= $3 && $3 == 1) {
|
|
Alain Reguera Delgado |
8f60cb |
print ""
|
|
Alain Reguera Delgado |
8f60cb |
print ""
|
|
Alain Reguera Delgado |
8f60cb |
}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
if ($1 > 0 && $2 < $3) {
|
|
Alain Reguera Delgado |
8f60cb |
for (i = 1; i <= $2; i++) {
|
|
Alain Reguera Delgado |
8f60cb |
print ""
|
|
Alain Reguera Delgado |
8f60cb |
}
|
|
Alain Reguera Delgado |
8f60cb |
}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
print ""
|
|
Alain Reguera Delgado |
8f60cb |
}
|