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:
_Application
Map Zotero keys to BetterBibtex citekeys.
- __init__(resource)¶
- class zensols.zotsite.app.ExportApplication(resource, prune_pattern=None)[source]¶
Bases:
_Application
This 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:
_Application
Query the Zotero database.
- __init__(resource)¶
- class zensols.zotsite.app.Resource(zotero_db, cite_db, site_creator)[source]¶
Bases:
object
Zotsite 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:
object
Read 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.
- class zensols.zotsite.cli.ApplicationFactory(*args, **kwargs)[source]¶
Bases:
ApplicationFactory
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:
object
Provides 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:
Container
Represents a (sub)collection, which is a container for other collections and items.
- property name¶
- class zensols.zotsite.domain.CollectionVisitor(predicate)[source]¶
Bases:
Visitor
A visitor that prints items for debugging.
- class zensols.zotsite.domain.Container(items, collections)[source]¶
Bases:
ZoteroObject
Container class holds items and sub-collections.
- property children¶
- class zensols.zotsite.domain.Item(sel, children)[source]¶
Bases:
ZoteroObject
Represents 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:
Container
Represents the top level object that contains the root level collections.
- property name¶
- property title¶
- class zensols.zotsite.domain.Note(sel)[source]¶
Bases:
ZoteroObject
Represents a note Zotero data object.
- property name¶
- property title¶
- class zensols.zotsite.domain.PrintVisitor(writer)[source]¶
Bases:
Visitor
A visitor that prints items for debugging.
- class zensols.zotsite.domain.SortedWalker(key_fn=None, reverse=False)[source]¶
Bases:
Walker
Iterates through the Zotero visiting children in sorted order.
- __init__(key_fn=None, reverse=False)[source]¶
Initialize.
- Parameters:
key_fn (
Callable
) – a function/callable used to sort the data that takes a single argument to access compared data, which defaults to :function:`str`reverse (
bool
) – whether or not to reverse the visited results
- class zensols.zotsite.domain.UnsortedWalker[source]¶
Bases:
Walker
Iterates through the Zotero visiting children in whatever order is provided by the database.
- class zensols.zotsite.domain.Walker[source]¶
Bases:
ABC
Iterates the Zotero data and calls the visitor for each node.
- exception zensols.zotsite.domain.ZoteroApplicationError[source]¶
Bases:
ApplicationError
Thrown for application errors meant to be reported by the command line.
- __module__ = 'zensols.zotsite.domain'¶
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:
Visitor
This 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:
ItemMapper
Map by using item IDs.
- class zensols.zotsite.itemmap.ItemMapper[source]¶
Bases:
ABC
Maps
Item
unique identifiers.- EXT_RE = re.compile('.+\\.(.+)?$')¶
- class zensols.zotsite.itemmap.RegexItemMapper(lib, fmatch_re=None, repl_re=None)[source]¶
Bases:
ItemMapper
Map 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:
Visitor
This that filters out
Collection
instances based on a regular expression. Optionally,Item
level 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:
object
Creates 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
Walker
instance.
-
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:
item
orlong
- property item_mapper¶
- 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.