Esempio n. 1
0
def syntax(request):
    if 'fr' in request.LANGUAGE_CODE.lower():
        doc_id = '1EhJTsqX3noztyW-UdKRBABhIln6R3TAvXv58DTZWCU4'
    else:
        doc_id = '1xD5gSjeyjGjw-V9g5hXx7FWeasRvn-L6zeQJsNeAGBI'
    url = 'https://docs.google.com/document/pub?id=%s' % doc_id
    doc = GoogleDoc(url)
    context = RequestContext(request)
    context.content = doc.to_html()
    return render_to_response('base.html', context_instance=context)
Esempio n. 2
0
 def test_view(self):
     doc = GoogleDoc()
     folder = os.path.join(
         os.path.dirname(__file__), "fixtures", "google_doc"
         )
     input_path = os.path.join(folder, "input.html")
     with open(input_path) as f:
         input_html = f.read()
     doc.set_html(input_html)
     self.assertEqual(doc._html, input_html)
     self.assertEqual(len(doc._sections), 14)
     output_path = os.path.join(folder, "navigation.html")
     with open(output_path) as f:
         self.assertEquals(doc._navigation_html(), f.read())