From 3b420a7c579e8fd6024ebbc902d15792fa666c5a Mon Sep 17 00:00:00 2001 From: Zhaozhou Li Date: Fri, 16 Aug 2024 07:35:37 +0300 Subject: [PATCH 1/4] bugfix for merge-other Editing the property `bib.entries_dict` doesn't work. Use the underlying `bib._entries_dict` instead! --- adstex.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adstex.py b/adstex.py index f9bf1e3..9f5b027 100644 --- a/adstex.py +++ b/adstex.py @@ -454,8 +454,8 @@ def update(key): return if key_exists_in_others and args.merge_other: - bib.entries_dict[key] = bib_other.entries_dict[key] - bib.entries = list(bib.entries_dict.values()) + bib._entries_dict[key] = bib_other.entries_dict[key] + bib.entries = list(bib._entries_dict.values()) print("{}: FOUND IN OTHER BIB SOURCE, MERGED".format(key)) return From 27179c9797024e2b06e9bf436d7e2c485ccbbc8c Mon Sep 17 00:00:00 2001 From: Zhaozhou Li Date: Fri, 16 Aug 2024 07:45:35 +0300 Subject: [PATCH 2/4] add prompt when not writing the file I found that when the only changes are merging items from another bib, adstex does not write the file unless I delete the output file... This is a rare case maybe not worth a fix. Anyway, it would be good at least to remind users nothing to be written. --- adstex.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/adstex.py b/adstex.py index 9f5b027..b6b1460 100644 --- a/adstex.py +++ b/adstex.py @@ -519,6 +519,8 @@ def update(key): copyfile(args.output, args.output + ".bak") with open(args.output, "wb") as fp: fp.write(bib_dump_str) + else: + print('Nothing to write/update.') print(_headerize("Done!")) From 8abec4e8241c9e1f57282283344ddf622ceac027 Mon Sep 17 00:00:00 2001 From: Zhaozhou Li Date: Sun, 18 Aug 2024 22:36:15 +0300 Subject: [PATCH 3/4] update bib. entries instead of bib._entries_dict --- adstex.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/adstex.py b/adstex.py index b6b1460..9a09263 100644 --- a/adstex.py +++ b/adstex.py @@ -454,8 +454,7 @@ def update(key): return if key_exists_in_others and args.merge_other: - bib._entries_dict[key] = bib_other.entries_dict[key] - bib.entries = list(bib._entries_dict.values()) + bib.entries.append(bib_other.entries_dict[key]) print("{}: FOUND IN OTHER BIB SOURCE, MERGED".format(key)) return From c287a3ed4efcd9d83bd5ceb9ae7117659c42e4c4 Mon Sep 17 00:00:00 2001 From: Yao-Yuan Mao Date: Sun, 18 Aug 2024 19:32:11 -0600 Subject: [PATCH 4/4] Bump version to 0.5.3 --- adstex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adstex.py b/adstex.py index 9a09263..c5ccda9 100644 --- a/adstex.py +++ b/adstex.py @@ -30,7 +30,7 @@ except ImportError: from urllib import unquote -__version__ = "0.5.2" +__version__ = "0.5.3" _this_year = date.today().year % 100 _this_cent = date.today().year // 100