zensols.zotsite package¶
Submodules¶
zensols.zotsite.app module¶
This project exports your local Zotero library to a usable HTML website.
- class zensols.zotsite.app.CiteApplication(resource)[source]¶
Bases:
_ApplicationMap Zotero keys to BetterBibtex citekeys.
- __init__(resource)¶
- class zensols.zotsite.app.ExportApplication(resource, prune_pattern=None)[source]¶
Bases:
_ApplicationThis project exports your local Zotero library to a usable HTML website.
- __init__(resource, prune_pattern=None)¶
- export(output_dir=None)[source]¶
Generate and export the Zotero website.
- Parameters:
output_dir (
Path) – the directory to dump the site; default to configuration file
- property site_creator: SiteCreator¶
- class zensols.zotsite.app.PrototypeApplication(config_factory)[source]¶
Bases:
object- CLI_META = {'is_usage_visible': False}¶
- __init__(config_factory)¶
-
config_factory:
ConfigFactory¶
- class zensols.zotsite.app.QueryApplication(resource)[source]¶
Bases:
_ApplicationQuery the Zotero database.
- __init__(resource)¶
- class zensols.zotsite.app.Resource(zotero_db, cite_db, site_creator)[source]¶
Bases:
objectZotsite first class objects.
- __init__(zotero_db, cite_db, site_creator)¶
-
cite_db:
CiteDatabase¶ Maps Zotero keys to BetterBibtex citekeys.
-
site_creator:
SiteCreator¶ Creates the Zotero content web site.
-
zotero_db:
ZoteroDatabase¶ The database access object.
zensols.zotsite.betterbib module¶
A class that replaces item IDs with BetterBibtex IDs
- class zensols.zotsite.betterbib.BetterBibtexMapper(lib)[source]¶
Bases:
objectRead the BetterBibtex database and create a mapping from item DB ids to citation keys.
zensols.zotsite.cite module¶
Query Zotero collections metadata.
zensols.zotsite.cli module¶
Command line entry point to the application.
zensols.zotsite.db module¶
Data access objects to the Zotero SQLite database.
- class zensols.zotsite.db.ZoteroDatabase(_persister, _data_dir, _collection_like, _library_id)[source]¶
Bases:
objectProvides access to data from the Zotero database.
- __init__(_persister, _data_dir, _collection_like, _library_id)¶
zensols.zotsite.domain module¶
Contains domain and visitor (GoF pattern) classes.
- class zensols.zotsite.domain.Collection(sel, items, collections)[source]¶
Bases:
ContainerRepresents a (sub)collection, which is a container for other collections and items.
- property name¶
- class zensols.zotsite.domain.CollectionVisitor(predicate)[source]¶
Bases:
VisitorA visitor that prints items for debugging.
- class zensols.zotsite.domain.Container(items, collections)[source]¶
Bases:
ZoteroObjectContainer class holds items and sub-collections.
- property children¶
- class zensols.zotsite.domain.Item(sel, children)[source]¶
Bases:
ZoteroObjectRepresents an attachement object, like PDFs, site links etc.
- property creators: (<class 'list'>, <class 'zensols.zotsite.domain.Name'>)¶
- property metadata¶
- property name¶
- property path¶
- class zensols.zotsite.domain.Library(data_dir, library_id, collections)[source]¶
Bases:
ContainerRepresents the top level object that contains the root level collections.
- property name¶
- property title¶
- class zensols.zotsite.domain.Note(sel)[source]¶
Bases:
ZoteroObjectRepresents a note Zotero data object.
- property name¶
- property title¶
- class zensols.zotsite.domain.PrintVisitor(writer)[source]¶
Bases:
VisitorA visitor that prints items for debugging.
- class zensols.zotsite.domain.SortedWalker(key_fn=None, reverse=False)[source]¶
Bases:
WalkerIterates through the Zotero visiting children in sorted order.
- class zensols.zotsite.domain.UnsortedWalker[source]¶
Bases:
WalkerIterates through the Zotero visiting children in whatever order is provided by the database.
- class zensols.zotsite.domain.Walker[source]¶
Bases:
ABCIterates the Zotero data and calls the visitor for each node.
- exception zensols.zotsite.domain.ZoteroApplicationError(*args, is_usage=False, **kwargs)[source]¶
Bases:
ApplicationErrorThrown for application errors meant to be reported by the command line.
- __firstlineno__ = 18¶
- __module__ = 'zensols.zotsite.domain'¶
- __static_attributes__ = ()¶
zensols.zotsite.fscpvisitor module¶
Contains a class to copy files from the package resource location to the target website path.
- class zensols.zotsite.fscpvisitor.FileSystemCopyVisitor(lib, out_dir, robust, itemmapper)[source]¶
Bases:
VisitorThis class copies all Item objects to their destination.
- __init__(lib, out_dir, robust, itemmapper)[source]¶
Initialize the visitor object.
- Parameters:
lib (
Library) – the object graph returned fromZoteroDatabase.get_library()out_dir (
Path) – the target directory to copy datarobust (
bool) – whether to raise an exception on file system errorsitemmapper (
ItemMapper) – used for file name substitution so the widget uses the correct names (i.e. underscore substitution)
zensols.zotsite.itemmap module¶
Contains classes that map Item unique identifiers.
- class zensols.zotsite.itemmap.IdItemMapper(lib, fmatch_re=None, repl_re=None)[source]¶
Bases:
ItemMapperMap by using item IDs.
- class zensols.zotsite.itemmap.ItemMapper[source]¶
Bases:
ABCMaps
Itemunique identifiers.- EXT_RE = re.compile('.+\\.(.+)?$')¶
- class zensols.zotsite.itemmap.RegexItemMapper(lib, fmatch_re=None, repl_re=None)[source]¶
Bases:
ItemMapperMap by using regular expression replacements.
zensols.zotsite.prunevisitor module¶
A class that prunes collections based on a regular expression.
- class zensols.zotsite.prunevisitor.PruneVisitor(prune_pattern=None, match_children=False)[source]¶
Bases:
VisitorThis that filters out
Collectioninstances based on a regular expression. Optionally,Itemlevel nodes are included if based onmatch_children.- __init__(prune_pattern=None, match_children=False)¶
zensols.zotsite.screate module¶
Generates the the static HTML pages that make up the Zotero exported website.
- class zensols.zotsite.screate.SiteCreator(config_factory, package, site_resource, db, prune_visitor, sort_walkers, sort='none', id_mapping='none', file_mapping='item', out_dir=None, robust_fs=False)[source]¶
Bases:
objectCreates the Zotero content web site.
- __init__(config_factory, package, site_resource, db, prune_visitor, sort_walkers, sort='none', id_mapping='none', file_mapping='item', out_dir=None, robust_fs=False)¶
-
config_factory:
ConfigFactory¶ The configuration factory used to create the
Walkerinstance.
-
db:
ZoteroDatabase¶ The database access object.
-
file_mapping:
str= 'item'¶ Whether to use unique item IDs for the file names or the full PDF file name; either:
itemorlong
- property item_mapper¶
-
out_dir:
Path= None¶ The default output directory to store the collection.
- print_structure(writer=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]¶
Print (sub)collections and papers in those collections as a tree.
-
prune_visitor:
PruneVisitor¶ A visitor that prunes collections based on a regular expression.
-
site_resource:
Path¶ The (resource) path the static site files.