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