@core_helper
def resource_preview(resource, package):
 if (not resource['url']):
  return False
 datapreview.res_format(resource)
 directly = False
 data_dict = {'resource': resource, 'package': package}
 if datapreview.get_preview_plugin(data_dict, return_first=True):
  url = url_for(controller='package', action='resource_datapreview', resource_id=resource['id'], id=package['id'], qualified=True)
 else:
  return False
 return snippet('dataviewer/snippets/data_preview.html', embed=directly, resource_url=url, raw_resource_url=resource.get('url'))

@ core_helper def resource_preview ( resource , package ) : if ( not resource [ 'url' ] ) : return False datapreview . res_format ( resource ) directly = False data_dict = { 'resource' : resource , 'package' : package } if datapreview . get_preview_plugin ( data_dict , return_first = True ) : url = url_for ( controller = 'package' , action = 'resource_datapreview' , resource_id = resource [ 'id' ] , id = package [ 'id' ] , qualified = True ) else : return False return snippet ( 'dataviewer/snippets/data_preview.html' , embed = directly , resource_url = url , raw_resource_url = resource . get ( 'url' ) )
returns a rendered snippet for a embedded resource preview .