File: index-cleaner

package info (click to toggle)
doc-linux-fr 2013.01-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 21,580 kB
  • ctags: 123
  • sloc: xml: 139,071; sh: 361; makefile: 182; lisp: 27
file content (63 lines) | stat: -rwxr-xr-x 1,491 bytes parent folder | download | duplicates (5)
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
#! /bin/sh 
# Copyright (c) 2003 Pierre Machard <pmachard@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this package; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

cp $1 $1.awk

# Remove the paragraph about RedHat CDROM
awk 'BEGIN { display=1 
	FS= "\n";
	loop=1 } 
{
    for (i = 1; i <= NF; i++) {
	    if ( $i ~ /RedHat\-CD\-HOWTO/) {
	    display = 0 ;
	    loop = 1 ;
	    }
	    
	    if(display) {
	    print $i }
	     
	    if ( $i ~ /<\/p><hr\/>/ && loop == 1 ) {
	    display=1 ;
	    loop=0 ;
	    }
    }
}' < $1.awk > $1

rm -f $1.awk
cp $1 $1.awk

# Clean the index and fix links
awk 'BEGIN {coeur=0} \
        /Coupez/ { 
       coeur++ ; 
       next 
       } 
       { 
       if (coeur==1) {
          gsub("vf/","")
	  gsub("html?.*\">","html\">")
          print }
       }' < $1.awk > $1

rm -f $1.awk


tidy -latin1 -m $1 > /dev/null 2> /dev/null

exit 0