File: filter.py

package info (click to toggle)
mathgl 2.4.2.1-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 32,488 kB
  • sloc: cpp: 81,486; ansic: 3,138; pascal: 1,562; python: 37; makefile: 17; sh: 7
file content (25 lines) | stat: -rwxr-xr-x 855 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
#!/usr/bin/python

import os,string,re,glob

print 'Tuning resulting html files for Qt\n'

beginskip=0
for filename in glob.glob('./*ru.html/*html'):
    fpin=open(filename,'r')
    fpout=open(filename+'.tmp','w')
    for line in fpin.readlines():
        if re.search('<html>',line): 
            beginskip=1
            fpout.write(line)
            continue
        if re.search('<head>',line): beginskip=0
        if re.search('<meta name=\"keywords"\"',line): continue
        if re.search('<meta name=\"description\"',line): continue
        if re.search('<meta name=\"distribution\" content=\"global\">',line): continue
        if re.search('<meta name=\"Generator\" content=\"texi2html',line): continue
        if beginskip==0 : fpout.write(line)
    fpin.close()
    fpout.close()
    os.remove(filename)
    os.rename(filename+'.tmp', filename)