Changeset 195
- Timestamp:
- 08/22/08 18:12:15 (11 months ago)
- Location:
- trunk
- Files:
-
- 2 removed
- 5 modified
-
shakespeare/concordance.py (deleted)
-
shakespeare/concordance_test.py (deleted)
-
shakespeare/controllers/site.py (modified) (2 diffs)
-
shakespeare/controllers/text.py (modified) (1 diff)
-
shakespeare/templates/guide.html (modified) (4 diffs)
-
shakespeare/tests/functional/test_site.py (modified) (1 diff)
-
test.ini (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/shakespeare/controllers/site.py
r188 r195 8 8 import shakespeare.index 9 9 import shakespeare.format 10 import shakespeare.concordance11 10 import shakespeare.model as model 12 11 … … 26 25 def guide(self): 27 26 return render('guide') 28 29 def concordance(self, word=None):30 # TODO: support concordance/word31 return self.concordance_index()32 33 def concordance_index(self):34 stats = shakespeare.concordance.Statistics()35 c.words = stats.keys()36 return render('concordance')37 38 def concordance_word(self, word=None):39 # TODO: sort by work etc40 import shakespeare.textutils41 refs = []42 cc = shakespeare.concordance.Concordance()43 if word is not None:44 refs = list(cc.get(word))45 newrefs = []46 for ref in refs:47 # we use the 'plain' format when building the concordance48 ff = ref.text.get_text()49 snippet = shakespeare.textutils.get_snippet(ff, ref.char_index)50 ref.snippet = snippet51 c.word = word52 c.refs = refs53 return render('concordance_by_word')54 27 55 28 # 2008-04-26 (rgrp): none of these annotater related items -
trunk/shakespeare/controllers/text.py
r188 r195 8 8 import shakespeare.index 9 9 import shakespeare.format 10 import shakespeare.concordance11 10 import shakespeare.model as model 12 11 -
trunk/shakespeare/templates/guide.html
r181 r195 13 13 </h2> 14 14 <p> 15 The <a href=" /index/">index page</a> contains a list of all of the16 material on the system.15 The <a href="${h.url_for(controller='text', action='index')}">text index 16 page</a> contains a list of all of the material on the system. 17 17 </p> 18 18 <h2> … … 22 22 You can view works by clicking on the link available from the index page. 23 23 If you know the 'id' of a text you can view it directly by visiting the 24 url: /view?name={id} (you can work out id names by looking at the link25 urls on the index page).24 url: ${h.url_for(controller='text', action='view', name='id')} (you can work 25 out id names by looking at the link urls on the index page). 26 26 </p> 27 27 … … 30 30 You can view a given text in a different format by setting the format 31 31 argument in the url query string like so: 32 /view?name={id}&format={format_name} So to view hamlet with line 33 numbers visit: <a 34 href="/view?name=hamlet_gut&format=lineno">/view?name=hamlet_gut&format=lineno</a> Available formats are: 32 </p> 33 <pre> 34 ${h.url_for(controller='text', action='view', name='id', format='format_name')} 35 </pre> 36 <p> 37 So to view Hamlet with line numbers shown you would visit: 38 </p> 39 <blockquote><p> 40 <a href="${h.url_for(controller='text', action='view', name='hamlet_gut', format='lineno')}"> 41 ${h.url_for(controller='text', action='view', name='hamlet_gut', format='lineno')}</a> 42 </p></blockquote> 43 <p> 44 Available formats are: 35 45 </p> 36 46 <ul> … … 45 55 separated by '+'. For example to see the Gutenberg folio and non-folio 46 56 Othello side-by-side you would visit: <a 47 href="/view?name=othello_gut_f+othello_gut">/view?name=othello_gut_f+othello_gut</a> 57 href="${h.url_for(controller='text', action='view', name='othello_gut_f othello_gut')}"> 58 ${h.url_for(controller='text', action='view', name='othello_gut_f othello_gut')} 59 </a> 48 60 </p> 49 61 50 62 <h2> 51 Concordance63 Search 52 64 </h2> 53 65 <p> 54 The <a href="/concordance/">concordance page</a> provides a concordance of 55 Shakespeare's work along with some associated statistics on word 56 occurences. 66 See the <a href="${h.url_for(controller='search', action='index')}">search section</a>. 57 67 </p> 68 69 <h2> 70 Search 71 </h2> 72 <p> 73 See the <a href="${h.url_for(controller='stats', action='index')}">stats section</a>. 74 </p> 75 58 76 59 77 <h2>Comments</h2> 60 78 <p> 61 If you wish to comment on this guide (or help improve it!) please visit62 <a href="http://www.openshakespeare.org/">http://www.openshakespeare.org</a>79 If you wish to comment on this guide (or help improve it!) please drop a 80 line to the Open Shakespeare team via at info [at] okfn [dot] org. 63 81 </p> 64 82 </div> -
trunk/shakespeare/tests/functional/test_site.py
r176 r195 16 16 res = self.app.get(url) 17 17 assert 'guide to the features of the Open Shakespeare web' in res 18 19 def _test_concordance(self):20 url = url_for(controller='site', action='concordance')21 res = self.app.get(url)22 18 23 19 # 2008-04-26 rgrp: not working -
trunk/test.ini
r148 r195 20 20 21 21 # Add additional test specific configuration options as necessary. 22 sqlalchemy.url = sqlite:///%(here)s/testshkspr.db
