Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements various non-exact searching and matching features
* docs: update Changelog * docs: document the new options * docs: add new settings to example config * docs: remove short-hands * docs: document the new settings * docs: document the new command-line options in the man-page * ci: mark missing coverage on optional library checks This code is in fact covered by the `no-optionals` CI run but this is not picked up by the report of the `coverage` job. * refactor: extract ListCommand._RESERVED_FIELDS * fix: remove order dependence for search command tests * refactor: reorder test functions again Due to the configuration reset, this order is relevant! * test: --fuzziness in the list command * test: --decode-latex and --decode-unicode in the list command * refactor: reorder unittest methods * refactor: new argument short-hands - replaces `-f` with `-z` as the short-hand for `--fuzziness` - the idea here is, that `-f` is more likely to come in handy in the future (think of `formatting` or `file`-related arguments) - removes the short-hands for `--(no-)decode-latex` and `--(no-)decode-unicode` in the `list` command - I think these will be less commonly used (compared to the `search` command, where they are more relevant) and this avoids conflicts with `-l` already taken up by `--limit` * feat: expose non-exact filter matching via list command * test: unittest the new Entry.matches arguments * feat: extend non-exact matching to Entry.matches * refactor: make extra Entry.search arguments keyword-only * test: more timeout exception handling in the ISBNParser tests * meta: properly test optional dependencies in CI * [wip] fix: add optional dependency into tox The unittests should run at least once without it installed. There must also be a better way of linking to the optional dependencies listed in the pyproject.toml. * feat: basic fuzzy searching This is achieved via an alternate `regex` package which is a new optional dependency of coBib. * Lint * feat: permit LaTeX decoding during search * feat: permit Unicode decoding during search * refactor: inline internal Entry._search method Turns out, we don't need to re-use the code for the file grep highlights because we don't want to post-process them any further since grep already returns them in chunks with the correct context. * fix: re-enable query highlight for file matches * refactor: support multiple Span inside Match * refactor: loop merging * fix: mypy * refactor: move match module to cobib.utils * fix: Entry.search unittests * fix: search command unittests * refactor: extract internal regex searching method * refactor: extract Match.stylize * refactor: track spans from re.Match objects during search This refactors the handling of search results inside of `Entry.search`. In the near future, I plan to add the `regex` library as an optional dependency to support fuzzy regex matching. This will result in the current word highlighting to fail. In fact, the current approach already fails to highlight properly for regex searches. Instead, in this new approach, we avoid multiple repetitions of identical regex searches and, instead, parse the matches from the first search to extract all the relevant spanning data we may need.
- Loading branch information