Change formatter to use normal papis configuration
Whereas before everything would be written in the `ref-format` string, we can now simply put the customization options like any others passed to papis - through its config file. Comes with default options. Explanation added in README.
This commit is contained in:
parent
33221461ba
commit
c6b16e19e3
2 changed files with 54 additions and 41 deletions
51
README.md
51
README.md
|
|
@ -9,61 +9,74 @@ You can install from pypi with `pip install git+https://git.martyoeh.me/Marty/pa
|
|||
That's it! If you have papis and papis-bbt-formatter installed in the same environment (whether virtual or global),
|
||||
everything should now be installed.
|
||||
|
||||
## Usage:
|
||||
## Usage
|
||||
|
||||
In your papis configuration file (usually `~/.config/papis/config`), add the following under the main settings header:
|
||||
|
||||
```toml
|
||||
```cfg
|
||||
[settings]
|
||||
formater = bbt
|
||||
ref-format = bbt
|
||||
```
|
||||
|
||||
For now, the ref-format *has* to start with `bbt`.
|
||||
For now, the ref-format also *has* to start with `bbt`.
|
||||
|
||||
Formatted reference keys by default will look like:
|
||||
|
||||
`Harvey05briefhistoryneoliberalism` (for Harvey, D. (2005). A brief history of neoliberalism. Oxford New York: Oxford University Press.)
|
||||
|
||||
or `Harvey22reflectionsacademiclife` (for Harvey, D. (2022). Reflections on an academic life. Human Geography, 15, 14–24. doi:10.1177/19427786211046291)
|
||||
|
||||
## Configuration
|
||||
|
||||
No configuration except for the above setup is required for the formatting to work,
|
||||
but you can set a couple additional ones to customize the bevhavior to your liking:
|
||||
|
||||
### 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.
|
||||
the maximum length in words `title-words=4` or in characters `title-chars=20` under the `[plugins.bbt-formatter]` section in your papis configuration file (usually located at `~/.config/papis/config`).
|
||||
|
||||
To set a maximum word length, do:
|
||||
|
||||
```toml
|
||||
```cfg
|
||||
[settings]
|
||||
formater = bbt
|
||||
ref-format = bbt[title-words=4]
|
||||
ref-format = bbt
|
||||
|
||||
[plugins.bbt-formatter]
|
||||
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.
|
||||
Same idea for maximum character length:
|
||||
|
||||
```toml
|
||||
[settings]
|
||||
formater = bbt
|
||||
ref-format = bbt[title-chars=10]
|
||||
```cfg
|
||||
[plugins.bbt-formatter]
|
||||
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]
|
||||
```cfg
|
||||
[plugins.bbt-formatter]
|
||||
title-words = 4
|
||||
title-chars = 20
|
||||
```
|
||||
|
||||
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]
|
||||
```cfg
|
||||
[plugins.bbt-formatter]
|
||||
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).
|
||||
so will always be fully written out (the default behavior if no title length options are provided).
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue