X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/eaa785079ca4234e6bb97983e24e54d7af21c257..fa0681e744ae94b515fe76704f6584053b1fc218:/misc/scripts/update_doc_utils.py diff --git a/misc/scripts/update_doc_utils.py b/misc/scripts/update_doc_utils.py index 7b8382e41a..3da5ef741b 100755 --- a/misc/scripts/update_doc_utils.py +++ b/misc/scripts/update_doc_utils.py @@ -1,49 +1,48 @@ -############################################################################## -# Name: misc/scripts/update_doc_utils.py -# Purpose: base utilities for others update_doc_*.py scripts -# Created: 2007-08-1 -# RCS-ID: $Id: makeunixtags.sh 46320 2007-06-04 11:02:29Z VZ $ -# Copyright: (c) 2007 Francesco Montorsi -# Licence: wxWindows licence -############################################################################## - -import sys, os, glob, distutils.file_util - -DOCS_PATH="../../docs/latex/wx" - -# Calls the given callback with the name of a documented class, its .tex related file, -# the content of that .tex file and the number of the line of the relative \class tag, -# for all documented class in DOCS_PATH. If the callback returns false the processing is stopped. -# Returns the number of .tex files processed. -def scanTexFiles(callback): - count = 0 - for f in glob.glob(DOCS_PATH + '/*.tex'): - file = open(f, "r") - if not file: - print "could not open %s" % f - continue - print "opened file %s" % f - count = count + 1 - - # search \class tags - content = file.readlines() - classdecl = 0 - for i in range(len(content)): - line = content[i] - if "\class{" in line: - classdecl = classdecl + 1 - - # polish the class name - classname = line - classname = classname[classname.find("\class{"):] - classname = classname[classname.find("{")+1:classname.find("}")] - print " the class declared is named '%s'" % classname - - # process this \class - if not callback(classname, f, content, i): - return count - - print " file %s contains %d class declarations" % (f, classdecl) - - return count - +############################################################################## +# Name: misc/scripts/update_doc_utils.py +# Purpose: base utilities for others update_doc_*.py scripts +# Created: 2007-08-1 +# Copyright: (c) 2007 Francesco Montorsi +# Licence: wxWindows licence +############################################################################## + +import sys, os, glob, distutils.file_util + +DOCS_PATH="../../docs/latex/wx" + +# Calls the given callback with the name of a documented class, its .tex related file, +# the content of that .tex file and the number of the line of the relative \class tag, +# for all documented class in DOCS_PATH. If the callback returns false the processing is stopped. +# Returns the number of .tex files processed. +def scanTexFiles(callback): + count = 0 + for f in glob.glob(DOCS_PATH + '/*.tex'): + file = open(f, "r") + if not file: + print "could not open %s" % f + continue + print "opened file %s" % f + count = count + 1 + + # search \class tags + content = file.readlines() + classdecl = 0 + for i in range(len(content)): + line = content[i] + if "\class{" in line: + classdecl = classdecl + 1 + + # polish the class name + classname = line + classname = classname[classname.find("\class{"):] + classname = classname[classname.find("{")+1:classname.find("}")] + print " the class declared is named '%s'" % classname + + # process this \class + if not callback(classname, f, content, i): + return count + + print " file %s contains %d class declarations" % (f, classdecl) + + return count +