Package: zensols.bibstract
BibTeX Extract and PopulateThis utility extractsBibTeXreferences (a.k.amarkers) from a(La)TeXfile and copies entries from a source, which themaster BibTeX file.  It also
provides easy customization to massage the entries of the BibTeX files (seefeatures).  The use case is exporting allBetterBibtexentries
to a file on your file system, usually one that is updated as you add, remove
and modify papers inZotero.  While the use case was intended for use with
Zoter and BetterBibtex, it will work on any BibTeX system.The program does the following:Parses some large master source BibTeX file.Parses a file or recursively all.tex,.sty, and.clsfiles
recursively in a directory.Copies the matching entries from the master source BibTeX to standard out.The program makes the assumption that the BibTeX entry IDs are unique as the
matches are very loose when parsing the (La)TeX file.FeaturesMany features relate to modifying older entries to accommodate newer systems
(i.e.BibLATEX) or modifying newer entries to accommodate older systems
(i.e.BibTex).Features:Replace or edit Unicode characters, which is useful when\usepackage[utf8]{inputenc}has no effect.Massage date strings.Remove certain entries that cause bibliography systems issues (useful forBibLATEX).Modify entries to normalizearXiventries.ObtainingThe easiest way to install the command line program is via thepipinstaller:pip3installzensols.bibstractBinaries are also available onpypi.UsageThis is a command line program written that has the following usage (also use--help):Print IDs in a master source file BibTeX file:bibstract showbib.Print cite references in a (La)TeX file:bibstract showtex <file|directory>Print IDs that will be exported from the BibTeX file:bibstract showexport <file|directory>Export the matching entries to standard out:bibstract export <file|directory>ConvertersA set ofconverterscan be specified in theconfiguration file, which
modify each parsed BibTeX entry in succession.  Currently there the following:date_year: Converts the year part of a date field to a year.  This is
useful when using Zotero's Better Biblatex extension that produces BibLatex
formats, but you need BibTeX entries.copy: Copy or move one or more fields in the entry.  This is useful when
your bibliography style expects one key, but the output (i.e.BibLatex)
outputs a different named field). Whendestructiveis set toTrue, this
copy operation becomes a move.Converters can be set be set and configured in theconfiguration file.  See
thetest casesfor more examples.ConfigurationAconfiguration filemust be given, whose location is either given with a-ccommand line argument, or set in the environment variableBIBSTRACTRC.An exampleconfiguration fileis available, which has only one INI sectiondefaultwith optionmaster_bibwith the master BibTeX file.Example Configuration FileThe following example configuration file points to the a home directory file
where you tell whereBetterBibtexto export.  It then specifies to convert
dates with years (deleting thedatefield after)when creating the output.In addition, it copies thejournaltitle(exported byBetterBibtex) tojournal, which is used by BibTeX.  This converter, calledreplaceis
configured thereplace_converterentry.[default]master_bib=${env:home}/.zotero-betterbib.bibconverters=date_year_destructive, replace[replace_converter]class_name=zensols.bibstract.CopyOrMoveConverterfields=dict: {'journaltitle': 'journal'}destructive=FalseDocumentationSee thefull documentation.
TheAPI referenceis also
available.ChangelogAn extensive changelog is availablehere.CommunityPlease star this repository and let me know how and where you use this API.
Contributions as pull requests, feedback and any input is welcome.LicenseCopyright (c) 2020 - 2023 Paul LandesPermission 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.