kerko icon indicating copy to clipboard operation
kerko copied to clipboard

Add support for capturing group in tag inclusion.

Open mgao6767 opened this issue 1 year ago • 1 comments

This PR allows the use of capturing group when using regular expression to determine item inclusion by tags. If tag_include_re contains capturing group, the tags will be the concatenation of captured substrings.

For example:

  • In Zotero, I have tags of "-kerko-Topic 1", "-kerko-Topic 2".
  • In config.toml, I set tag_include_re to "-kerko-(.*)". Enable kerko.facets.tag.
  • In the web, facets will be "Topic 1" and "Topic 2", instead of "-kerko-Topic 1", "-kerko-Topic 2".

The changes pass all tests. Works as expected.

mgao6767 avatar Oct 27 '23 08:10 mgao6767

Sounds like a useful feature, will review it! Even though the tests pass, one should not rely on them too much when working on extractors, as there are currently no specific tests for covering the extractors. Of course you are welcome to write tests for this extractor, should you feel inclined to. :wink:

davidlesieur avatar Nov 07 '23 16:11 davidlesieur