Add title word and char length options

This commit is contained in:
Marty Oehme 2023-09-14 22:16:45 +02:00
parent 87a3ffdfaf
commit f8d9ae4d4b
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
2 changed files with 74 additions and 26 deletions

View file

@ -19,24 +19,57 @@ formater = bbt
ref-format = bbt
```
For now, the ref-format is simply `bbt` as well, though should I further develop this plugin (with additional options),
that settings will surely change.
For now, the ref-format *has* to start with `bbt`.
Currently, you can change the length that the `TitleShort` in `Name2008TitleShort` will be cut down to by setting:
### Title length
Currently, you can change the length that the `TitleShort` in `Name2008TitleShort` will be cut down to by setting
the maximum length in words or in characters.
To set a maximum word length, do:
```toml
[settings]
formater = bbt
ref-format = bbt[4]
ref-format = bbt[title-words=4]
```
In this case, the title will be shortened to 4 words maximum (the default), change the number to shorten/lengthen to your preference.
In this case, the title will be shortened to 4 words maximum (the default),
change the number to shorten/lengthen to your preference.
Same idea for maximum character length:
This plugin is a rather simple adaption from [this](https://github.com/hrdl-github/papis/commit/b9b9c6eaa3de159e1b210174ef49e90a89271eb8) commit,
turned into an installable papis plugin and extended slightly for now.
```toml
[settings]
formater = bbt
ref-format = bbt[title-chars=10]
```
This will allow a maximum of 10 characters for the title.
Using both:
```toml
[settings]
formater = bbt
ref-format = bbt[title-words=4][title-chars=15]
```
This will ensure a maximum of 4 words, however if they go more than 20 characters they will be cut off mid-word.
You can set either option to `-1` to turn it off:
```toml
[settings]
formater = bbt
ref-format = bbt[title-words=4][title-chars=-1]
```
This will ensure that a maximum of 4 words will be placed in the ref, but they do not have a maximum character length,
so will always be fully written out (the default behavior without title length options provided).
---
For now this plugin is a rather simple adaption from [this](https://github.com/hrdl-github/papis/commit/b9b9c6eaa3de159e1b210174ef49e90a89271eb8) commit,
turned into an installable papis plugin and extended slightly.
If you spot a bug or have an idea feel free to open an issue.\
I might be slow to respond but will consider them all!