Skip to content

Commit

Permalink
v0.10.2: fix pandoc error based on separate BibTeX file
Browse files Browse the repository at this point in the history
  • Loading branch information
geritwagner committed Oct 15, 2023
1 parent 2b44e83 commit 0dff513
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0).

### Fixed

## 0.10.2 - 2023-10-15

### Fixed

- paper_md: export BibTeX file and replace keys containing `.` to prevent pandoc error

## 0.10.1 - 2023-10-06

### Changed
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ authors:
given-names: "Julian"
orcid: "https://orcid.org/0000-0003-2682-8036"
title: "CoLRev: An open-source environment for collaborative reviews"
version: 0.10.1
date-released: 2023-10-06
version: 0.10.2
date-released: 2023-10-15
url: "https://github.com/CoLRev-Environment/colrev"
1 change: 1 addition & 0 deletions colrev/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class Dataset:
"data/prep_man/records_prep_man.bib",
"data/prep/",
"data/dedupe/",
"data/data/sample_references.bib",
]
DEPRECATED_GIT_IGNORE_ITEMS = [
"missing_pdf_files.csv",
Expand Down
17 changes: 17 additions & 0 deletions colrev/ops/built_in/data/paper_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import colrev.ops.data


# pylint: disable=too-many-instance-attributes
@zope.interface.implementer(colrev.env.package_manager.DataPackageEndpointInterface)
@dataclass
class PaperMarkdown(JsonSchemaMixin):
Expand All @@ -53,6 +54,7 @@ class PaperMarkdown(JsonSchemaMixin):
the corresponding record will be marked as rev_synthesized."""

NON_SAMPLE_REFERENCES_RELATIVE = Path("non_sample_references.bib")
SAMPLE_REFERENCES_RELATIVE = Path("sample_references.bib")

ci_supported: bool = False

Expand Down Expand Up @@ -109,6 +111,9 @@ def __init__(
self.non_sample_references = (
data_operation.review_manager.data_dir / self.NON_SAMPLE_REFERENCES_RELATIVE
)
self.sample_references = (
data_operation.review_manager.data_dir / self.SAMPLE_REFERENCES_RELATIVE
)
self.data_operation = data_operation

self.settings.paper_output = (
Expand All @@ -128,6 +133,8 @@ def __init__(
)
self.__temp_path.mkdir(exist_ok=True, parents=True)

self.review_manager = data_operation.review_manager

# pylint: disable=unused-argument
@classmethod
def add_endpoint(cls, operation: colrev.ops.data.Data, params: str) -> None:
Expand Down Expand Up @@ -651,6 +658,15 @@ def __create_non_sample_references_bib(self) -> None:
except AttributeError:
pass

def __copy_references_bib(self) -> None:
records = self.review_manager.dataset.load_records_dict()
for record_id, record_dict in records.items():
record_dict = {k.replace(".", "_"): v for k, v in record_dict.items()}
records[record_id] = record_dict
self.review_manager.dataset.save_records_dict_to_file(
records=records, save_path=self.sample_references
)

def __call_docker_build_process(
self, *, data_operation: colrev.ops.data.Data, script: str
) -> None:
Expand Down Expand Up @@ -700,6 +716,7 @@ def build_paper(self, *, data_operation: colrev.ops.data.Data) -> None:

self.__retrieve_default_csl()
self.__create_non_sample_references_bib()
self.__copy_references_bib()

word_template = self.settings.word_template

Expand Down
18 changes: 17 additions & 1 deletion colrev/ops/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ def main(self) -> None:
"script": self.__migrate_0_10_1,
"released": True,
},
{
"version": CoLRevVersion("0.10.1"),
"target_version": CoLRevVersion("0.10.2"),
"script": self.__migrate_0_10_2,
"released": True,
},
]
print(f"installed_colrev_version: {installed_colrev_version}")
print(f"settings_version: {settings_version}")
Expand Down Expand Up @@ -523,8 +529,18 @@ def __migrate_0_10_1(self) -> bool:
source["search_type"] = "FILES"

self.__save_settings(settings)
return self.repo.is_dirty()

return False
def __migrate_0_10_2(self) -> bool:
paper_md_path = Path("data/data/paper.md")
paper_md_content = paper_md_path.read_text(encoding="utf-8")
paper_md_content = paper_md_content.replace(
"data/records.bib", "data/data/sample_references.bib"
)
paper_md_path.write_text(paper_md_content, encoding="utf-8")
self.repo.index.add([str(paper_md_path)])

return self.repo.is_dirty()


# Note: we can ask users to make decisions (when defaults are not clear)
Expand Down
2 changes: 1 addition & 1 deletion colrev/template/paper_md/paper.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "{{project_title}}"
author: "{{author}}"
bibliography: [data/records.bib,data/data/non_sample_references.bib]
bibliography: [data/data/sample_references.bib,data/data/non_sample_references.bib]
figPrefix: "Figure"
tblPrefix: "Table"
csl: "https://raw.githubusercontent.com/citation-style-language/styles/master/apa.csl"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "colrev"
version = "0.10.1"
version = "0.10.2"
description = "CoLRev: An open-source environment for collaborative reviews"
authors = ["Gerit Wagner <gerit.wagner@uni-bamberg.de>", "Julian Prester <julian.prester@sydney.edu.au>"]
license = "MIT"
Expand Down
4 changes: 2 additions & 2 deletions release-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
- Run `colrev env --update_package_list`.
- Update Docker image versions and test.
- Collect release notes and update the `CHANGELOG.md`.
- Update version and date in `CITATION.cff`.
- Update **version** and **date** and date in `CITATION.cff`.
- Update version in `SECURITY.md`.
- Update the **version** and **date** in `pyproject.toml`. Check whether other parts of the `pyproject.toml` need to be updated. Check whether dependencies can be removed.
- Update the version in `pyproject.toml`. Check whether other parts of the `pyproject.toml` need to be updated. Check whether dependencies can be removed.
- Update the Github milestones, close current one, make plans for the next milestones
- Commit the changes (`release 0.10.0`).
- Push to Github. Check whether the installation, tests, and pre-commit hooks pass.
Expand Down
2 changes: 1 addition & 1 deletion tests/2_ops/check_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_checks( # type: ignore

checker = colrev.checker.Checker(review_manager=base_repo_review_manager)

expected = ["0.10.1", "0.10.1"]
expected = ["0.10.2", "0.10.2"]
actual = checker.get_colrev_versions()
assert expected == actual

Expand Down

0 comments on commit 0dff513

Please sign in to comment.