API Docs¶
Invenio module for previewing files.
-
class
invenio_previewer.ext.
InvenioPreviewer
(app, **kwargs)[source]¶ Invenio-Previewer extension.
Extension initialization.
-
invenio_previewer.ext.
load_or_import_from_config
(key, app=None, default=None)[source]¶ Load or import value from config.
-
invenio_previewer.ext.
obj_or_import_string
(value, default=None)[source]¶ Import string or return object.
Views¶
View method for Invenio-Records-UI for previewing files.
-
invenio_previewer.views.
blueprint
= <flask.blueprints.Blueprint object>¶ Blueprint used to register template and static folders.
-
invenio_previewer.views.
is_previewable
(extension)[source]¶ Test if a file can be previewed checking its extension.
-
invenio_previewer.views.
preview
(pid, record, template=None, **kwargs)[source]¶ Preview file for given record.
Plug this method into your
RECORDS_UI_ENDPOINTS
configuration:RECORDS_UI_ENDPOINTS = dict( recid=dict( # ... route='/records/<pid_value/preview/<path:filename>', view_imp='invenio_previewer.views.preview', record_class='invenio_records_files.api:Record', ) )
Previewers¶
CSV (d3.js)¶
Render a CSV file using d3.js.
-
invenio_previewer.extensions.csv_dthreejs.
can_preview
(file)[source]¶ Determine if the given file can be previewed.
Default¶
Default rendering returning a default web page.
JSON (prism.js)¶
Previews a JSON file.
-
invenio_previewer.extensions.json_prismjs.
can_preview
(file)[source]¶ Determine if the given file can be previewed.
-
invenio_previewer.extensions.json_prismjs.
preview
(file)[source]¶ Render appropiate template with embed flag.
Markdown¶
Markdown rendering using mistune library.
PDF (pdf.js)¶
PDF previewer based on pdf.js.
Simple Images¶
Previews simple image files.
-
invenio_previewer.extensions.simple_image.
can_preview
(file)[source]¶ Determine if the given file can be previewed.
XML (prism.js)¶
Previews an XML file.
-
invenio_previewer.extensions.xml_prismjs.
can_preview
(file)[source]¶ Determine if the given file can be previewed.
-
invenio_previewer.extensions.xml_prismjs.
preview
(file)[source]¶ Render appropiate template with embed flag.
Bundles¶
Previewer bundles.
-
invenio_previewer.bundles.
csv_previewer_js
= <Bundle output=gen/csv_previewer.%(version)s.js, filters=(), contents=(<NpmBundle output=None, filters=(), contents=()>, <Bundle output=None, filters=[<invenio_assets.filters.RequireJSFilter object>], contents=(u'js/csv_previewer/init.js',)>)>¶ JavaScript bundle for D3.js CSV previewer.
-
invenio_previewer.bundles.
fullscreen_js
= <Bundle output=gen/fullscreen.%(version)s.js, filters=[<webassets.filter.uglifyjs.UglifyJS object>], contents=(u'js/zip/fullscreen.js',)>¶ JavaScript bundle for ZIP file previewer.
-
invenio_previewer.bundles.
pdfjs_css
= <Bundle output=gen/pdfjs.%(version)s.css, filters=(), contents=(u'css/pdfjs/viewer.css',)>¶ CSS bundle for PDFjs previewer.
-
invenio_previewer.bundles.
pdfjs_js
= <Bundle output=gen/pdfjs.%(version)s.js, filters=(), contents=(<NpmBundle output=None, filters=(), contents=()>, u'node_modules/pdfjs-dist/web/compatibility.js', u'node_modules/pdfjs-dist/build/pdf.js', u'js/pdfjs/l10n.js', u'js/pdfjs/viewer.js')>¶ JavaScript bundle for PDFjs previewer.
-
invenio_previewer.bundles.
previewer_base_css
= <Bundle output=gen/previewer-base.%(version)s.css, filters=(), contents=(u'node_modules/bootstrap/dist/css/bootstrap.css', <NpmBundle output=None, filters=(), contents=()>)>¶ CSS bundle for ZIP file previewer.
-
invenio_previewer.bundles.
previewer_base_js
= <Bundle output=gen/previewer-base.%(version)s.js, filters=(), contents=(<NpmBundle output=None, filters=(), contents=()>, u'node_modules/bootstrap/dist/js/bootstrap.js')>¶ JavaScript bundle for basic tools.
-
invenio_previewer.bundles.
prism_css
= <Bundle output=gen/prism.%(version)s.css, filters=(), contents=(<NpmBundle output=None, filters=(), contents=()>, u'node_modules/prismjs/themes/prism.css', u'css/prismjs/simple.css')>¶ CSS bundle for prism.js syntax highlighter.
-
invenio_previewer.bundles.
prism_js
= <Bundle output=gen/prism.%(version)s.js, filters=[<webassets.filter.uglifyjs.UglifyJS object>], contents=(<NpmBundle output=None, filters=(), contents=()>, u'node_modules/prismjs/prism.js', u'node_modules/prismjs/components/prism-json.js')>¶ JavaScript bundle for prism.js syntax highlighter.