From c62b83e02359c24973344699116acc12b4a04108 Mon Sep 17 00:00:00 2001
From: lukeflo
Date: Tue, 14 Oct 2025 08:54:35 +0200
Subject: skip set and xdata entries by default
---
src/bibiman/citekeys.rs | 7 +++++--
src/bibiman/citekeys/citekey_utils.rs | 5 +++++
src/config.rs | 10 ++++++++++
3 files changed, 20 insertions(+), 2 deletions(-)
(limited to 'src')
diff --git a/src/bibiman/citekeys.rs b/src/bibiman/citekeys.rs
index 0cec28e..999c6cb 100644
--- a/src/bibiman/citekeys.rs
+++ b/src/bibiman/citekeys.rs
@@ -28,7 +28,7 @@ use owo_colors::OwoColorize;
use serde::{Deserialize, Serialize};
use crate::{
- bibiman::citekeys::citekey_utils::{build_citekey, formatting_help},
+ bibiman::citekeys::citekey_utils::{SKIPPED_ENTRIES, build_citekey, formatting_help},
config::{BibiConfig, IGNORED_SPECIAL_CHARS, IGNORED_WORDS},
};
@@ -167,6 +167,10 @@ impl CitekeyFormatting {
pub fn do_formatting(&mut self, ignored_chars: &[char], ignored_words: &[String]) -> &mut Self {
let mut old_new_keys: Vec<(String, String)> = Vec::new();
for entry in self.bib_entries.iter() {
+ // Skip specific entries
+ if SKIPPED_ENTRIES.contains(&entry.entry_type.to_string().to_lowercase().as_str()) {
+ continue;
+ }
old_new_keys.push((
entry.key.clone(),
build_citekey(
@@ -181,7 +185,6 @@ impl CitekeyFormatting {
}
self.old_new_keys_map = old_new_keys;
- // dbg!(&self.old_new_keys_map);
self
}
diff --git a/src/bibiman/citekeys/citekey_utils.rs b/src/bibiman/citekeys/citekey_utils.rs
index 5f70224..58a8274 100644
--- a/src/bibiman/citekeys/citekey_utils.rs
+++ b/src/bibiman/citekeys/citekey_utils.rs
@@ -15,6 +15,8 @@
// along with this program. If not, see .
/////
+use std::sync::LazyLock;
+
use biblatex::{ChunksExt, Entry, Type};
use deunicode::deunicode;
use indoc::formatdoc;
@@ -25,6 +27,8 @@ use owo_colors::{
use crate::bibiman::{citekeys::CitekeyCase, sanitize::sanitize_single_string_fully};
+pub(super) const SKIPPED_ENTRIES: [&str; 2] = ["set", "xdata"];
+
pub(super) fn formatting_help() {
let help = vec![
formatdoc!(
@@ -200,6 +204,7 @@ pub(super) fn build_citekey(
match case {
Some(CitekeyCase::Lower) => new_citekey.to_lowercase(),
Some(CitekeyCase::Upper) => new_citekey.to_uppercase(),
+ // otherwise skip, since camelcase is processed in char loop
_ => new_citekey,
}
}
diff --git a/src/config.rs b/src/config.rs
index 7c1a0f8..b8d8b45 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -52,6 +52,10 @@ pub static IGNORED_WORDS: LazyLock> = LazyLock::new(|| {
String::from("at"),
String::from("to"),
String::from("and"),
+ String::from("him"),
+ String::from("her"),
+ String::from("his"),
+ String::from("hers"),
String::from("der"),
String::from("die"),
String::from("das"),
@@ -63,6 +67,12 @@ pub static IGNORED_WORDS: LazyLock> = LazyLock::new(|| {
String::from("und"),
String::from("für"),
String::from("vor"),
+ String::from("er"),
+ String::from("sie"),
+ String::from("es"),
+ String::from("ihm"),
+ String::from("ihr"),
+ String::from("ihnen"),
]
});
--
cgit v1.2.3