Update of /cvsroot/tmda/tmda/contrib
In directory sc8-pr-cvs1:/tmp/cvs-serv31202
Modified Files:
def2html
Log Message:
Replaced function is_all_caps with function looks_like_term for detecting terms
in Defaults.py. All function didn't catch terms with numbers in them. New
function uses a regular expression instead of a loop.
Index: def2html
===================================================================
RCS file: /cvsroot/tmda/tmda/contrib/def2html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- def2html 1 Oct 2002 19:55:32 -0000 1.1
+++ def2html 5 Dec 2002 18:23:50 -0000 1.2
@@ -56,11 +56,10 @@
text = text.replace(char, entity)
return text
-def is_all_caps(text):
- for ch in list(text):
- if ch not in string.uppercase + '_':
- return 0
- return 1
+def looks_like_term(text):
+ if re.match(r'^\w+$', text):
+ return 1
+ return 0
def is_indented(text):
return text[0] == ' '
@@ -73,7 +72,7 @@
def is_line_header(idx, section):
if idx < len(section):
line = section[idx]
- if (re.match(r'[\w_-]+:', line, re.IGNORECASE) and
+ if (re.match(r'[\w-]+:', line) and
not line.startswith('Example') and
not line.startswith('NOTE') and
not line.startswith('WARNING')):
@@ -115,7 +114,7 @@
break
else:
line = line[2:].rstrip()
- if not in_section and line and is_all_caps(line):
+ if not in_section and line and looks_like_term(line):
name = line
in_section = 1
elif in_section:
_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs