Example #1
0
 def test_get_passage_footnotes(self):
     value = esv.get_passage('gen 1:7', footnotes=True)
     OUT = '<div class="esv"><h2>Genesis 1:7 <object type="application/x-shockwave-flash"  data="http://www.esvapi.org/assets/play.swf?myUrl=hw%2F01001007" width="40" height="12" class="audio"><param name="movie" value="http://www.esvapi.org/assets/play.swf?myUrl=hw%2F01001007" /><param name="wmode" value="transparent" /></object></h2>\n<div class="esv-text"><p id="p01001007.01-1"><span class="verse-num" id="v01001007-1">7&nbsp;</span>And God made<span class="footnote">&nbsp;<a href="#f1" id="b1" title="Or \'fashioned\'; also verse 16">[1]</a></span> the expanse and separated the waters that were under the expanse from the waters that were above the expanse. And it was so.  (<a href="http://www.esv.org" class="copyright">ESV</a>)</p>\n</div>\n<div class="footnotes">\n<h3>Footnotes</h3>\n<p><span class="footnote"><a href="#b1" id="f1">[1]</a></span> <span class="footnote-ref">1:7</span> Or <em>fashioned</em>; also verse 16\n</p>\n</div>\n</div>'
     self.assertEqual(value, OUT)
     value = esv.get_passage('gen 1:7', footnotes=False)
     OUT = '<div class="esv"><h2>Genesis 1:7 <object type="application/x-shockwave-flash"  data="http://www.esvapi.org/assets/play.swf?myUrl=hw%2F01001007" width="40" height="12" class="audio"><param name="movie" value="http://www.esvapi.org/assets/play.swf?myUrl=hw%2F01001007" /><param name="wmode" value="transparent" /></object></h2>\n<div class="esv-text"><p id="p01001007.01-1"><span class="verse-num" id="v01001007-1">7&nbsp;</span>And God made the expanse and separated the waters that were under the expanse from the waters that were above the expanse. And it was so.  (<a href="http://www.esv.org" class="copyright">ESV</a>)</p>\n</div>\n</div>'
     self.assertEqual(value, OUT)
Example #2
0
 def render(self, context):
     passage = ""
     try:
         passage = esv.get_passage(self.reference.resolve(context), footnotes=self.footnotes, headings=self.headings, audio=self.audio)
     except (PassageNotFoundError, EsvQuotaExceededError):
         if settings.TEMPLATE_DEBUG:
             raise
     return passage
Example #3
0
 def get_context(self):
     try:
         passage = esv.get_passage(self.value, footnotes=self.footnotes, headings=self.headings, audio=self.audio)
         return {"passage": passage}
     except PassageNotFoundError:
         raise InlinePassageNotFoundError
     except EsvQuotaExceededError:
         raise InlineQuotaExceededError
Example #4
0
 def test_get_passage_audio(self):
     value = esv.get_passage('gen 1:1', audio=False)
     OUT = '<div class="esv"><h2>Genesis 1:1</h2>\n<div class="esv-text">\n<p class="chapter-first" id="p01001001.06-1"><span class="chapter-num" id="v01001001-1">1:1&nbsp;</span>In the beginning, God created the heavens and the earth.  (<a href="http://www.esv.org" class="copyright">ESV</a>)</p>\n</div>\n</div>'
     self.assertEqual(value, OUT)
Example #5
0
 def test_get_passage_headings(self):
     value = esv.get_passage('gen 1:1', headings=True)
     OUT = '<div class="esv"><h2>Genesis 1:1 <object type="application/x-shockwave-flash"  data="http://www.esvapi.org/assets/play.swf?myUrl=hw%2F01001001" width="40" height="12" class="audio"><param name="movie" value="http://www.esvapi.org/assets/play.swf?myUrl=hw%2F01001001" /><param name="wmode" value="transparent" /></object></h2>\n<div class="esv-text"><h3 id="p01001001.01-1">The Creation of the World</h3>\n<p class="chapter-first" id="p01001001.06-1"><span class="chapter-num" id="v01001001-1">1:1&nbsp;</span>In the beginning, God created the heavens and the earth.  (<a href="http://www.esv.org" class="copyright">ESV</a>)</p>\n</div>\n</div>'
     self.assertEqual(value, OUT)