]> git.saurik.com Git - wxWidgets.git/blob - misc/scripts/update_doc_utils.py
Allow absent checkbox when transferring dimension data
[wxWidgets.git] / misc / scripts / update_doc_utils.py
1 ##############################################################################
2 # Name: misc/scripts/update_doc_utils.py
3 # Purpose: base utilities for others update_doc_*.py scripts
4 # Created: 2007-08-1
5 # Copyright: (c) 2007 Francesco Montorsi
6 # Licence: wxWindows licence
7 ##############################################################################
8
9 import sys, os, glob, distutils.file_util
10
11 DOCS_PATH="../../docs/latex/wx"
12
13 # Calls the given callback with the name of a documented class, its .tex related file,
14 # the content of that .tex file and the number of the line of the relative \class tag,
15 # for all documented class in DOCS_PATH. If the callback returns false the processing is stopped.
16 # Returns the number of .tex files processed.
17 def scanTexFiles(callback):
18 count = 0
19 for f in glob.glob(DOCS_PATH + '/*.tex'):
20 file = open(f, "r")
21 if not file:
22 print "could not open %s" % f
23 continue
24 print "opened file %s" % f
25 count = count + 1
26
27 # search \class tags
28 content = file.readlines()
29 classdecl = 0
30 for i in range(len(content)):
31 line = content[i]
32 if "\class{" in line:
33 classdecl = classdecl + 1
34
35 # polish the class name
36 classname = line
37 classname = classname[classname.find("\class{"):]
38 classname = classname[classname.find("{")+1:classname.find("}")]
39 print " the class declared is named '%s'" % classname
40
41 # process this \class
42 if not callback(classname, f, content, i):
43 return count
44
45 print " file %s contains %d class declarations" % (f, classdecl)
46
47 return count
48