# joelcarranza/bikebus

better directions

1 parent 3194d18 commit f0c5e8c8775054901010b79a64ff7c2456af03f9 committed Jun 25, 2012
Showing with 25 additions and 19 deletions.
3. +20 −8 templates/question.html
4. +4 −4 textdirections.py
 @@ -22,7 +22,7 @@ A user can ask for directions via text message by texting XXX-XXXX (TODO). An ex Audubon Park to Superdome directions from Audobon Park to Superdome by bike bus directions from Audubon Park to Superdome - Audubon Park to Superdome by bike bus @ 3:40 + Audubon Park to Superdome by bike bus at 3:40 Texting HELP to the service provides some brief instructions
 @@ -1,6 +0,0 @@ -\$def with (response) -\$var title: Answer - -
-\$response
-
28 templates/question.html
 @@ -1,18 +1,30 @@ \$def with (question,response) -\$var title: SMS Test +\$var title: BikeBus SMS Test
-

SMS Test

-
- - - Entry a text message like thing here +

BikeBus SMS Test

+ + + + Examples
+ Audubon Park to Superdome
+ directions from Audobon Park to Superdome by bike
+ bus directions from Audubon Park to Superdome
+ Audubon Park to Superdome by bus at 3:40
+
- \$for text in response: -
\$text
+ \$if response: +

Response

+ \$for text in response: +
+ + \$len(text) + +
\$text
+
8 textdirections.py
 @@ -23,19 +23,19 @@ AT_PATTERN = r'(\s+(?:at|in)\s+.+)?' MODE_PATTERN = r'bike|bus|walk|walking|streetcar' -FROM_TO_PATTERN = r'(?:from)?(.+?)\s+to\s+(.+?)' +FROM_TO_PATTERN = r'(?:from\s+)?(.+?)\s+to\s+(.+?)' ACTIONS = ( (r'^help\$','help'), # MODE directions from FROM to TO at AT - ('^('+MODE_PATTERN+r')(?:\s+directions\s+)'+ + ('^('+MODE_PATTERN+r')(?:\s+directions\s+)?'+ FROM_TO_PATTERN+ AT_PATTERN+ '\$' ,'directions1'), # from FROM to TO via MODE at AT - (r'^'+FROM_TO_PATTERN+ - '(\s+by|via\s+'+MODE_PATTERN+')?'+ + (r'^(?:directions\s+)?'+FROM_TO_PATTERN+ + '(?:\s+(?:by|via)\s+('+MODE_PATTERN+'))?'+ AT_PATTERN+ '\$' ,'directions2')