Permalink
Browse files

Plurial forms are now aso hidden from snippet

example:
"interpreter" and in the text "interpreters"
  • Loading branch information...
1 parent a6a1956 commit c6d69a625e015d91a68aa73bdcadfabbfc7aacbc @alexksikes committed Apr 6, 2009
Showing with 11 additions and 8 deletions.
  1. +3 −1 app/controllers/wikitrivia.py
  2. +1 −1 app/models/cache.py
  3. +2 −1 app/models/questions.py
  4. +3 −3 app/views/layout.html
  5. +2 −2 app/views/score.html
@@ -6,6 +6,7 @@
from app.models import questions
from app.models import score
from app.models import categories
+from app import lib
from config import view
class index:
@@ -35,4 +36,5 @@ def POST(self):
cscore = score.update_score(cscore)
category_name = categories.get_category_name(i.category)
- return view.layout(view.score(cscore, i, success), title='Wikitrivia - ' + category_name)
+ return view.layout(view.score(cscore, i, success, pub_id=lib.get_pub_id()),
+ title='Wikitrivia - ' + category_name)
View
@@ -21,5 +21,5 @@ def get_question(question):
"""Get a specific question from the cache."""
return web.listget(
db.select('wikitrivia_cache',
- vars=dict(url=wiki_url),
+ vars=dict(url=question.wiki_url),
where='wiki_url = $url', limit=1), 0, False)
@@ -68,7 +68,8 @@ def make_question(url, category):
snippet_secret = snippet
for a in answer.split():
- p = re.compile(r'\b%s\b' % re.escape(a), re.I)
+ if a[-1] == 's': a = a[:-1]
+ p = re.compile(r'\b%ss?\b' % re.escape(a), re.I)
snippet_secret = p.sub('<strong class="depleted">' + '?' * len(a) + '</strong>', snippet_secret)
image_url = web.listget(
@@ -5,7 +5,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <title>$title</title>
+ <title>$:title</title>
<link rel="stylesheet" href="/public/default.css" type="text/css" media="screen, print, projection" />
<script type="text/javascript" src="/public/default.js"></script>
</head>
@@ -19,10 +19,10 @@
<p class="footer">
<em>WikiTrivia, the trivia game <strong>freshly generated from <a href="http://www.wikipedia.org">Wikipedia</a></strong> articles.</em><br />
-By Alex Ksikes (concept and <a href='http://github.com/alexksikes/wikitrivia/tree/master'>programming</a>) and Philipp Lenssen (programming)<br />
+By Alex Ksikes (concept and <a href='http://github.com/alexksikes/wikitrivia/tree/master'>programming</a>) and Philipp Lenssen (design and programming)<br />
&copy; May 2005 - 2009 -
<small><a href='mailto:alexandre.ksikes@gmail.com?subject=Wikitrivia'>Feedback</a> -
-<a href='http://groups.google.com/group/wikitrivia'>Discuss</a> -
+<a href='http://groups.google.com/group/wikitrivia/topics?gvc=1'>Discuss</a> -
<a href='http://github.com/alexksikes/wikitrivia/tree/master'>Source code</a></small>
</p>
</div>
@@ -1,4 +1,4 @@
-$def with (score, question, success)
+$def with (score, question, success, pub_id)
$if success:
<p class="right">
@@ -15,7 +15,7 @@
<div class="ad">
<script type="text/javascript"><!--
- google_ad_client = "pub-1431948349807205";
+ google_ad_client = "$pub_id";
/* 468x60, created 1/5/09 */
google_ad_slot = "8422565837";
google_ad_width = 468;

0 comments on commit c6d69a6

Please sign in to comment.