Skip to content
Browse files

made progress on manparse but get entity before changing the members,

remmeber manuals have mulltiple functions but are refed by function not
manual
  • Loading branch information...
1 parent ed2cc9e commit b9f4d8a48bfaa7a3cfba2d08d757c63260693415 @dacresni committed
Showing with 26 additions and 10 deletions.
  1. +26 −10 appengine/manparse.py
View
36 appengine/manparse.py
@@ -3,27 +3,43 @@
from google.appengine.ext import db
from Models import Manual, Function
# the following strings are to regular expressions to find
-name_pattern=re.compile("^.Nm",re.DEBUG)
-date_string=re.compile("^.Dd",re.DEBUG)
-headder_pattern=re.compile( "^.Fd"re.DEBUG)
-function_name_pattern=re.compile("^.BR"re.DEBUG)
+name_pattern=re.compile(r"^.Nm",re.DEBUG)
+date_string=re.compile(r"^.Dd",re.DEBUG)
+headder_pattern=re.compile( r"^.Fd"re.DEBUG)
+function_name_pattern=re.compile(r"^.BR"re.DEBUG)
patterns = { "name":name_pattern,
"date": date_string,
"headder":headder_pattern,
"function":function_name_pattern }
-def scan(block, patterns):
- """ takes a block of text and a dictionary{"name":pattern} of compiled regex patterns returns a {name:results} dictionary
+docstring= """ takes a block of text and a dictionary{"name":pattern} of compiled regex patterns returns a {name:results} dictionary
+def scan(block):
"""
- for pat in patterns.viewkeys:
- pat.search(b)
+def scan(file):
+ result = {"name":"",
+ "date","",
+ "headder":[],
+ "function":[]
+ "whatis":""}
+ for line in file:
+ if line.beginswith(".Dd")
+ result["date"]=line
+ if line.beginswith(".Nm")
+ result["name"]=line
+ if line.beginswith(".Nd")
+ result["whatis"]=line
+ if line.beginswith(".Fo")
+ result["function"].append(line)
+ if line.beginswith(".In")
+ result["headder"].append(line)
def names():
for page in os.listdir("."):
manname = page.split(".")[0]
- scan(manname, )
- newman = Manual(manname,)
+ man = open(manname, 'r')
+ scan(man))
+ #newman = Manual(manname,)
#action

0 comments on commit b9f4d8a

Please sign in to comment.
Something went wrong with that request. Please try again.