1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-27 04:32:55 +00:00
conky/check_docs.py
Brenden Matthews e8e6d1c819 Few misc doc related things.
Added the (incomplete) check_docs.py, to 'synchronize' the docs with the
code, as well as vim/nano syntax stuff.

Removed some unused OBJ_* stuff from text_objects.h, and updated docs
with some missing things.  Also removed a couple deprecated objects
which were still documented.
2009-05-01 16:53:50 -06:00

55 lines
1.4 KiB
Python
Executable File

#!/usr/bin/python
#
# TODO: finish this to update nano/vim syntax files, and also handle config
# settings.
#
import os.path
import re
file_names = dict()
file_names["text_objects"] = "src/text_object.h"
file_names["conky"] = "src/conky.c"
file_names["vim_syntax"] = "extras/vim/syntax/conkyrc.vim"
file_names["nano_syntax"] = "extras/nano/conky.nanorc"
file_names["variables"] = "doc/variables.xml"
file_names["config_settings"] = "doc/config_settings.xml"
for fn in file_names.values():
if not os.path.exists(fn) or not os.path.isfile(fn):
print "'%s' doesn't exist, or isn't a file" % (fn)
exit(0)
objects = []
file = open(file_names["text_objects"], "r")
exp = re.compile("\s*OBJ_(\w*).*")
while file:
line = file.readline()
if len(line) == 0:
break
res = exp.match(line)
if res:
obj = res.group(1)
if not re.match("color\d", obj) and obj != "text":
# ignore colourN stuff
objects.append(res.group(1))
doc_objects = []
exp = re.compile("\s*<command><option>(\w*)</option></command>.*")
file = open(file_names["variables"], "r")
while file:
line = file.readline()
if len(line) == 0:
break
res = exp.match(line)
if res:
doc_objects.append(res.group(1))
if doc_objects[len(doc_objects) - 1] not in objects:
print "'%s' is documented, but doesn't seem to be an object" % (doc_objects[len(doc_objects) - 1])
for obj in objects:
if obj not in doc_objects:
print "'%s' seems to be undocumented" % (obj)