Skip to main content

This project attempts to export a local Zotero library to a usable HTML website.

Project description

Export Zotero to a web site

Gitter chat

Travis CI Build Status

This project exports your local Zotero library to a usable HTML website. This generated website has the following features:

  • Easily access your papers, site snapshots, notes from a navigation tree.
  • Provides metadata from collections and attachments (i.e. referenes etc).
  • Display PDF papers and website snapshot (the latter as framed).
  • Method to navigate to/view the paper/website snapshot directly.
  • Snazzy look and feel from the latest Bootstrap CSS/Javascript library.

Table of Contents

Obtaining

The easist way to install the command line program is via the pip installer:

pip install zensols.zotsite

Binaries are also available on pypi.

Sample Site

See the live demo, which provides a variety of resources found in my own library. Note: To my knowledge, all of these resources are free to distribute and violate no laws. If I've missed one, please create an issue.

Usage

Important: You must shut down Zotero before you invoking this script. Nothing goes wrong when you don't. However, the script uses an SQLite file that the program (pessimistically) locks.

The program has two modes: show configuration (a good first step) and create the web site.

Show Structure

You can see what the program is parsing from your Zotero library:

zotsite print

Website Creation

Run the program (without the angle brackets):

zotsite export -o <sitedir>

After the program runs, sitedir will be where the tool creates/generates the the new site. Note you can also give a --datadir to tell the program where your Zotero library is. This can also be configured in your configuration.

The website will work as served from either a website or from the local file system. You can pass levels as a URL encoded parameter to produce the number of levels when the page is loaded.

On the left you can click on the tree to select collections or attachments. You have to drill all the way down to the leaf level in the tree to get at your attachements and notes. At the leaf level you can select and unselect a node but all other nodes are note selectable.

By clicking on a non-leaf node it expands or collapses everything and gives the meta data for that collection. Note that this behavior was decided more by the way Tree View works more than anything else since it is designed to show the entire tree list at once.

Export Subcollections

The folder directory structure in Zotero are called collections. You can export only collections given a regular expression with the --collection flag.

Configuration File

All command line parameters you provide can also be given in a ini style configuration file, for example:

[default]
data_dir=%(HOME)s/.zotero

tells the program where the Zotero data directory is located in the user's home directory with name .zotero (this defaults to the Zotero default).

You can indicate where the program configuration file is with the ZOTSITERC environment variable or use the --config command line program.

Process

The tool does the following:

  1. Exports the meta data (directory structure, references, notes, etc) from your Zotero library. On MacOS, this is done by querying the file system SQLite DB files.
  2. Copies a static site that enables traversal of the exported data.
  3. Copies your Zotero stored papers, snapshot (sites) etc.
  4. Generates a navigation tree to easily find your papers/content.

Keeping the Website In Sync With Zotero

Currently there is no way to do this (contributions are welcome). However there is a script I use to do this when I know I'm going to need to use the site, which is here.

Platform

This project uses the SQLite Python library and should run on other platforms but assumes a directory structure that's been tested on OSX.

Command Line Help

Command line usage as provided with the --help option:

Usage: usage: zotsite <list|export|print> [options]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -w NUMBER, --whine=NUMBER
                        add verbosity to logging
  -c FILE, --config=FILE
                        configuration file
Actions:
  export  Export
  -d, --datadir <string>      the location of the Zotero data directory
  -o, --outputdir <string>    the directory to output the website
  --collection <string>       regular expression to match collections
  --staticdirs <string>       comma separated directories to static files

  print   Print structure
  -d, --datadir <string>      the location of the Zotero data directory
  --collection <string>       SQL like pattern to match collections

Attribution

This software uses:

Screenshot

Also see the live demo.

Screenshot

Todo

  • Make the site portion a proper Javascript site. Right now, all the mins are added in the distribution to same directory as the main navigation/content file.
  • Add functionality to the disabled View button that drills down in a paper and finds a PDF or site to view withouth the user having to do this.
  • Use something like zotxt to make this work with a plugin rather than directly against the SQLite DB.

Zotero Plugin Listing

This is listed as a plugin on the Zotero site.

Changelog

An extensive changelog is available here.

License

Copyright © 2018 Paul Landes

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

zensols.zotsite-0.2.3-py3.6.egg (446.6 kB view details)

Uploaded Source

zensols.zotsite-0.2.3-py3-none-any.whl (430.5 kB view details)

Uploaded Python 3

File details

Details for the file zensols.zotsite-0.2.3-py3.6.egg.

File metadata

  • Download URL: zensols.zotsite-0.2.3-py3.6.egg
  • Upload date:
  • Size: 446.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.3

File hashes

Hashes for zensols.zotsite-0.2.3-py3.6.egg
Algorithm Hash digest
SHA256 13d3ae76bbc92c2f3dcc5020889648c71bdab63e982e11960eb9c143d7754915
MD5 ea8c9c3f6298f121fb3ffbef532c4445
BLAKE2b-256 d20e980fec7a87de181de38f2d27936895eb82d7790a921b4ddc59b1ccedca36

See more details on using hashes here.

File details

Details for the file zensols.zotsite-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: zensols.zotsite-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 430.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.3

File hashes

Hashes for zensols.zotsite-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bdb95a71472edcef81665f319f7aa9a6e017c61b15965a042c80ebb8d303ed02
MD5 ebc1f7ed41b0063db2b92a51d7fc5cd0
BLAKE2b-256 f8f3bb805b141bca2e5a1cafcb3f746d8771b2647c96f100a40fc9ee11d3f48d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page