zensols.zotsite package#
Submodules#
zensols.zotsite.app#
This project exports your local Zotero library to a usable HTML website.
- class zensols.zotsite.app.Application(site_creator, prune_pattern=None)[source]#
Bases:
object
This project exports your local Zotero library to a usable HTML website.
- __init__(site_creator, prune_pattern=None)#
-
site_creator:
SiteCreator
# Creates the Zotero content web site.
zensols.zotsite.betterbib#
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.cli#
Command line entry point to the application.
- class zensols.zotsite.cli.ApplicationFactory(*args, **kwargs)[source]#
Bases:
ApplicationFactory
zensols.zotsite.db#
Contains access to the Zotero SQLite database.
zensols.zotsite.domain#
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.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#
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 fromDatabaseReader.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#
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#
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#
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:
DatabaseReader
# 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.