本文整理汇总了Python中notebook.Notebook.render_docmain方法的典型用法代码示例。如果您正苦于以下问题:Python Notebook.render_docmain方法的具体用法?Python Notebook.render_docmain怎么用?Python Notebook.render_docmain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类notebook.Notebook
的用法示例。
在下文中一共展示了Notebook.render_docmain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handler
# 需要导入模块: from notebook import Notebook [as 别名]
# 或者: from notebook.Notebook import render_docmain [as 别名]
def handler(self, message):
command = message.get('command')
print 'Handling bibliography command %s %s'%(command, datetime.datetime.now().strftime("%H:%M:%S.%f"))
if message.get('sub_type') in ('notebook'):
nb = Notebook(self.resource, self.render)
result = nb.handler(message)
elif command in ('parse_bibstring'):
result = Translator(None).string_reader(message.get('bibstring', ''), count=message.get('count', 10000))
elif command in ('save_bibnote'):
result = self.save_bibnote(message.get('file'), message)
elif command in ('save_bibtex'):
result = self.save_bibtex(message.get('file', '').replace('.bibnote', '.bib'), message)
elif command in ('save_html'):
result = self.save_html(message.get('file'), message)
elif command in ('save_and_load'):
try:
nb = Notebook(self.resource, self.render)
nb.save_notebook(message, message.get('file'))
result = nb.render_docmain(message.get('new_notebook'))
result['success'] = 'success'
except:
result = {'success' : 'failed to load file %s'%(message.get('file'))}
else:
result = {'success': 'undefined command: %s'%(command)}
print 'Returning from bibliography command %s %s'%(command, datetime.datetime.now().strftime("%H:%M:%S.%f"))
return result