Skip to content

v0.8.0

Choose a tag to compare

@goerz goerz released this 03 Aug 16:58
· 17 commits to master since this release
v0.8.0
  • Added: Library.info, a read-write dict-like view of BibDesk's document info -- the key/value metadata that the "Document Info" panel attaches to the database as a whole, stored in the @bibdesk_info block of the .bib file. Keys are matched case-insensitively (preserving their stored spelling and order); values are plain Unicode strings, with the empty string allowed. A mutation regenerates the block in BibDesk's own layout (deleting the last key removes it from the file) and, on a plain BibTeX file, converts to the database format with a FormatConversionWarning; an unmodified block round-trips byte-for-byte. On the command line, info (read-only) prints the data (all pairs, or the value of a given KEY), and set_info KEY VALUE / delete_info KEY modify it. The %i{Key} format specifier (case-insensitive lookup, empty for a missing key, %i{Key}N truncating to N characters) is now implemented on top of this data instead of raising NotImplementedError. [[#69], [#70]]
  • Fixed: a @bibdesk_info block is now preserved byte-for-byte as long as the document info is not modified. The block has the syntactic shape of an entry, and was previously treated as one: it appeared in the entry API under the pseudo-key document_info (in keys, show, search, the check audits, ...), and any save that rewrote the file re-serialized it in entry layout (closing brace fused onto the last field line instead of on its own line) and could plant date-added/date-modified bookkeeping inside it. It is no longer exposed as an entry; a file containing one counts as a BibDesk database for the purpose of plain-format detection. [[#69], [#70]]
  • Added: an assets configuration table declaring the library's asset files -- companion files keyed by citation key (summaries, extracted full texts) or belonging to the library as a whole -- as path patterns in the format-specifier language, e.g. summary = "%f{Cite Key}_summary.md" (a trailing slash marks a directory-valued asset, an empty pattern disables a class, and a pattern built only from %i{Key} document info and literal text is library-level). Library.asset(name, key=None) resolves a class to a path relative to the .bib file's directory, and Library.assets(*keys) reports which asset files exist on disk; on the command line, the asset and assets commands (both taking optional citation keys and --json, asset also --relative). Whether a citation key is required follows from the pattern: a per-entry class needs one and a library-level class refuses one, in both methods (assets without keys reports the library-level classes, and the coverage table over all entries is the explicit bib.assets(*bib) / assets $(bibdeskparser keys)). asset verifies by default that something is on disk at the resolved path -- a directory for a directory-valued class, a file otherwise -- and raises FileNotFoundError if not; check_that_file_exists=False (CLI: --no-check-exists) resolves without touching the filesystem, which is what a generator needs in order to learn where to write an asset. Patterns are validated when the configuration is loaded; unique (%u/%U/%n), random (%r/%R/%d), and original-name (%l/%L/%e/%E) specifiers are rejected, so resolution is deterministic. See the new "External Assets" documentation page. [[#71], [#72]]
  • Added: two new check audits over the asset files. asset_orphans (on by default, --no-orphans to skip) inverts each per-entry assets pattern into a glob and reports every match on disk that belongs to no entry, e.g. a summary left behind by a delete or named after an old citation key. assets (opt-in via --assets, like --files) reports every resolving asset that is missing from disk. Both audit names appear in the --json output. [[#71], [#72]]
  • Changed: Library.rekey (and the rekey command) now renames the files named after the citation key along with the entry: the entry's asset files are moved to the paths the new key resolves to (the deepest entry-dependent path component of each assets pattern moves as one unit, so a bundle directory travels whole), and every attachment whose current path matches what the configured auto-file format generates is re-filed under the new key via rename_file (hand-named attachments are left alone; a skipped file -- no format for the entry's type, not following the format, absent from disk, or a target conflict -- is reported as a warning, and never fails the rename). The new keyword arguments rename_assets/rename_attachments (CLI: --rename-assets/--no-rename-assets, --rename-attachments/--no-rename-attachments) default to the new rekey configuration table, both true. To keep the previous behavior (rename the key only), set rename_assets = false and rename_attachments = false in the rekey table, or pass the --no-* options. [[#71], [#72]]
  • Added: Library.delete(key, remove_assets=..., remove_attachments=...), backing entry deletion (del) and the delete command (CLI: --remove-assets/--no-remove-assets, --remove-attachments/--no-remove-attachments, defaulting to the new delete configuration table, both false). With removal on, the entry's asset files and/or attached files are deleted from disk (to the Trash where possible; an attachment still linked from another entry is kept); with removal off (the default), a warning reports any files the deleted entry leaves behind. [[#71], [#72]]