From 837fc1ed0489d32f0d3d264167bd7c3b319936bc Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Mon, 6 Nov 2023 05:42:43 +0100 Subject: [PATCH 1/9] Change linter (#10614) --- .github/workflows/check-links.yaml | 22 --------- .github/workflows/check-links.yml | 35 ++++++++++++++ .gitignore | 2 + .lycheeignore | 14 ++++++ CHANGELOG.md | 14 +++--- PRIVACY.md | 4 +- buildres/LICENSE_with_Privacy.md | 6 +-- docs/code-howtos/IntelliJ.md | 2 +- docs/code-howtos/index.md | 2 +- docs/code-howtos/javafx.md | 2 +- .../openoffice/code-reorganization.md | 27 +++++------ docs/code-howtos/remote-storage.md | 2 +- docs/code-howtos/tools.md | 6 +-- docs/contributing.md | 2 +- .../0009-use-plain-junit5-for-testing.md | 2 +- .../development-strategy.md | 4 +- docs/teaching.md | 11 ++--- external-libraries.md | 2 +- lychee.toml | 1 + mlc_config.json | 46 ------------------- .../importer/fetcher/MedlineFetcher.java | 2 +- 21 files changed, 96 insertions(+), 112 deletions(-) delete mode 100644 .github/workflows/check-links.yaml create mode 100644 .github/workflows/check-links.yml create mode 100644 .lycheeignore create mode 100644 lychee.toml delete mode 100644 mlc_config.json diff --git a/.github/workflows/check-links.yaml b/.github/workflows/check-links.yaml deleted file mode 100644 index d570d9cb07e..00000000000 --- a/.github/workflows/check-links.yaml +++ /dev/null @@ -1,22 +0,0 @@ -name: Check external href links in the documentation - -on: - schedule: - # Run on the first of each month at 9:00 AM (See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07) - - cron: "0 9 1 * *" - workflow_dispatch: - -jobs: - markdown-link-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - show-progress: 'false' - - uses: gaurav-nelson/github-action-markdown-link-check@v1 - with: - use-quiet-mode: 'yes' - use-verbose-mode: 'no' - config-file: 'mlc_config.json' - folder-path: 'docs/' - file-path: './README.md' diff --git a/.github/workflows/check-links.yml b/.github/workflows/check-links.yml new file mode 100644 index 00000000000..a121d295643 --- /dev/null +++ b/.github/workflows/check-links.yml @@ -0,0 +1,35 @@ +name: Check external href links in the documentation + +on: + push: + paths: + - '.github/workflows/check-links.yml' + - '**/*.md' + schedule: + # Run on the first of each month at 9:00 AM (See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07) + - cron: "0 9 1 * *" + workflow_dispatch: + +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref }}" + cancel-in-progress: true + +jobs: + lychee: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + show-progress: 'false' + - name: Restore lychee cache + uses: actions/cache@v3 + with: + path: .lycheecache + key: cache-lychee-${{ github.sha }} + restore-keys: cache-lychee- + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v1.8.0 + with: + fail: true + args: --max-concurrency 1 --cache --no-progress --exclude-all-private './**/*.md' diff --git a/.gitignore b/.gitignore index 72603d9dc08..28c62cbe9f0 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ src/main/gen/ src/main/generated/ src-gen/ +.lycheecache + # generated by https://plugins.jetbrains.com/plugin/15991-plantuml-diagram-generator *.puml diff --git a/.lycheeignore b/.lycheeignore new file mode 100644 index 00000000000..8d3f2072f17 --- /dev/null +++ b/.lycheeignore @@ -0,0 +1,14 @@ +https://arxiv.org/ +https://contribute.jabref.org/ +https://donations.jabref.org/ +https://pubs.acs.org/ +https://web.archive.org/ +https://www.researchgate.net/privacy-policy +https://www.sciencedirect.com/ + +https://github.com/koppor/jabref/issue +https://github.com/koppor/jabref/pull +https://github.com/JabRef/jabref/issue +https://github.com/JabRef/jabref/pull + +0005-example.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 24c632a982d..55d8ccfcdb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -92,7 +92,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We added "Attach file from URL" to right-click context menu to download and store a file with the reference library. [#9646](https://github.com/JabRef/jabref/issues/9646) - We enabled updating an existing entry with data from InspireHEP. [#9351](https://github.com/JabRef/jabref/issues/9351) - We added a fetcher for the Bibliotheksverbund Bayern (experimental). [#9641](https://github.com/JabRef/jabref/pull/9641) -- We added support for more biblatex date formats for parsing dates. [#2753](https://github.com/JabRef/issues/2753) +- We added support for more biblatex date formats for parsing dates. [#2753](https://github.com/JabRef/jabref/issues/2753) - We added support for multiple languages for exporting to and importing references from MS Office. [#9699](https://github.com/JabRef/jabref/issues/9699) - We enabled scrolling in the groups list when dragging a group on another group. [#2869](https://github.com/JabRef/jabref/pull/2869) - We added the option to automatically download online files when a new entry is created from an existing ID (e.g., DOI). The option can be disabled in the preferences under "Import and Export". [#9756](https://github.com/JabRef/jabref/issues/9756) @@ -686,7 +686,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We fixed an issue with toggle of special fields does not work for sorted entries [#7016](https://github.com/JabRef/jabref/issues/7016) - We fixed an issue with the default path of external application. [#7641](https://github.com/JabRef/jabref/issues/7641) - We fixed an issue where urls must be embedded in a style tag when importing EndNote style Xml files. Now it can parse url with or without a style tag. [#6199](https://github.com/JabRef/jabref/issues/6199) -- We fixed an issue where the article title with colon fails to download the arXiv link (pdf file). [#7660](https://github.com/JabRef/issues/7660) +- We fixed an issue where the article title with colon fails to download the arXiv link (pdf file). [#7660](https://github.com/JabRef/jabref/issues/7660) - We fixed an issue where the keybinding for delete entry did not work on the main table [7580](https://github.com/JabRef/jabref/pull/7580) - We fixed an issue where the RFC fetcher is not compatible with the draft [7305](https://github.com/JabRef/jabref/issues/7305) - We fixed an issue where duplicate files (both file names and contents are the same) is downloaded and add to linked files [#6197](https://github.com/JabRef/jabref/issues/6197) @@ -788,7 +788,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv ### Added - We added a new fetcher to enable users to search mEDRA DOIs [#6602](https://github.com/JabRef/jabref/issues/6602) -- We added a new fetcher to enable users to search "[Collection of Computer Science Bibliographies](https://liinwww.ira.uka.de/bibliography/index.html)". [#6638](https://github.com/JabRef/jabref/issues/6638) +- We added a new fetcher to enable users to search "[Collection of Computer Science Bibliographies](https://en.wikipedia.org/wiki/Collection_of_Computer_Science_Bibliographies)". [#6638](https://github.com/JabRef/jabref/issues/6638) - We added default values for delimiters in Add Subgroup window [#6624](https://github.com/JabRef/jabref/issues/6624) - We improved responsiveness of general fields specification dialog window. [#6604](https://github.com/JabRef/jabref/issues/6604) - We added support for importing ris file and load DOI [#6530](https://github.com/JabRef/jabref/issues/6530) @@ -881,7 +881,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We fixed an issue about duplicated group color indicators [#6175](https://github.com/JabRef/jabref/issues/6175) - We fixed an issue where entries with the entry type Misc from an imported aux file would not be saved correctly to the bib file on disk [#6405](https://github.com/JabRef/jabref/issues/6405) - We fixed an issue where percent sign ('%') was not formatted properly by the HTML formatter [#6753](https://github.com/JabRef/jabref/issues/6753) -- We fixed an issue with the [SAO/NASA Astrophysics Data System](https://docs.jabref.org/collect/import-using-online-bibliographic-database/ads) fetcher where `\textbackslash` appeared at the end of the abstract. +- We fixed an issue with the [SAO/NASA Astrophysics Data System](https://docs.jabref.org/collect/add-entry-using-an-id#sao-nasa-a-ds) fetcher where `\textbackslash` appeared at the end of the abstract. - We fixed an issue with the Science Direct fetcher where PDFs could not be downloaded. Fixes [#5860](https://github.com/JabRef/jabref/issues/5860) - We fixed an issue with the Library of Congress importer. - We fixed the [link to the external libraries listing](https://github.com/JabRef/jabref/blob/master/external-libraries.md) in the about dialog @@ -891,7 +891,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We removed the option of the "enforce legal key". [#6295](https://github.com/JabRef/jabref/issues/6295) - We removed the obsolete `External programs / Open PDF` section in the preferences, as the default application to open PDFs is now set in the `Manage external file types` dialog. [#6130](https://github.com/JabRef/jabref/pull/6130) -- We removed the option to configure whether a `.bib.bak` file should be generated upon save. It is now always enabled. Documentation at . [#6092](https://github.com/JabRef/jabref/issues/6092) +- We removed the option to configure whether a `.bib.bak` file should be generated upon save. It is now always enabled. Documentation at . [#6092](https://github.com/JabRef/jabref/issues/6092) - We removed the built-in list of IEEE journal abbreviations using BibTeX strings. If you still want to use them, you have to download them separately from . ## [5.0] – 2020-03-06 @@ -1021,7 +1021,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv ### Removed - We removed some obsolete notifications. [#5555](https://github.com/JabRef/jabref/issues/5555) -- We removed an internal step in the [ISBN-to-BibTeX fetcher](https://docs.jabref.org/import-using-publication-identifiers/isbntobibtex): The [ISBN to BibTeX Converter](https://manas.tungare.name/software/isbn-to-bibtex) by [@manastungare](https://github.com/manastungare) is not used anymore, because it is offline: "people using this tool have not been generating enough sales for Amazon." +- We removed an internal step in the [ISBN-to-BibTeX fetcher](https://docs.jabref.org/collect/add-entry-using-an-id#isbn): The [ISBN to BibTeX Converter](https://manas.tungare.name/software/isbn-to-bibtex) by [@manastungare](https://github.com/manastungare) is not used anymore, because it is offline: "people using this tool have not been generating enough sales for Amazon." - We removed the option to control the default drag and drop behaviour. You can use the modifier keys (like CtrL or Alt) instead. ## [5.0-alpha] – 2019-08-25 @@ -1054,7 +1054,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - Change default icon for groups to a circle because a colored version of the old icon was hard to distinguish from its black counterpart. - In the main table, the context menu appears now when you press the "context menu" button on the keyboard. [feature request in the forum](https://discourse.jabref.org/t/how-to-enable-keyboard-context-key-windows) - We added icons to the group side panel to quickly switch between `union` and `intersection` group view mode. [#3269](https://github.com/JabRef/jabref/issues/3269). -- We use `https` for [fetching from most online bibliographic database](https://docs.jabref.org/import-using-online-bibliographic-database). +- We use `https` for [fetching from most online bibliographic database](https://docs.jabref.org/collect/import-using-online-bibliographic-database). - We changed the default keyboard shortcuts for moving between entries when the entry editor is active to ̀alt + up/down. - Opening a new file now prompts the directory of the currently selected file, instead of the directory of the last opened file. - Window state is saved on close and restored on start. diff --git a/PRIVACY.md b/PRIVACY.md index d7a1ca68b48..91df8163523 100644 --- a/PRIVACY.md +++ b/PRIVACY.md @@ -46,7 +46,7 @@ These third-party services are the following: | [arXiv.org](https://arxiv.org/) | | | [Bibliotheksverbund Bayern](https://www.bib-bvb.de/) | | | [Biodiversity Heritage Library](https://www.biodiversitylibrary.org/) | | -| [Collection of Computer Science Bibliographies](http://liinwww.ira.uka.de/) | **currently unavailable**, offline | +| [Collection of Computer Science Bibliographies](https://en.wikipedia.org/wiki/Collection_of_Computer_Science_Bibliographies) | **currently unavailable**, offline | | [CrossRef](https://www.crossref.org/) | | | [dblp](https://dblp.uni-trier.de/) | | | [Directory of Open Access Books](https://www.doabooks.org/) | | @@ -62,7 +62,7 @@ These third-party services are the following: | [Library of Congress](https://lccn.loc.gov/) | | | [National Library of Medicine](https://www.ncbi.nlm.nih.gov/) | | | [MathSciNet](http://www.ams.org/mathscinet) | | -| [mEDRA](https://medra.org/) | | +| [mEDRA](https://www.medra.org/) | | | [Mr. DLib](https://mr-dlib.org/) [1] | | | [Openlibrary](https://openlibrary.org) | | | [ResearchGate](https://www.researchgate.net/) | | diff --git a/buildres/LICENSE_with_Privacy.md b/buildres/LICENSE_with_Privacy.md index 41264b1efcc..291dd3e5f34 100644 --- a/buildres/LICENSE_with_Privacy.md +++ b/buildres/LICENSE_with_Privacy.md @@ -1,6 +1,6 @@ MIT License -Copyright © 2003-2021 [JabRef Authors](https://github.com/JabRef/jabref/blob/master/AUTHORS) +Copyright © 2003-2021 JabRef Authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -89,7 +89,7 @@ Service;Privacy Policy [arXiv.org](https://arxiv.org/); [Bibliotheksverbund Bayern](https://www.bib-bvb.de/); [Biodiversity Heritage Library](https://www.biodiversitylibrary.org/); -[Collection of Computer Science Bibliographies](http://liinwww.ira.uka.de/);**currently unavailable**, offline +[Collection of Computer Science Bibliographies](https://en.wikipedia.org/wiki/Collection_of_Computer_Science_Bibliographies);**currently unavailable**, offline [CrossRef](https://www.crossref.org/); [dblp](https://dblp.uni-trier.de/); [Directory of Open Access Books](https://www.doabooks.org/); @@ -105,7 +105,7 @@ Service;Privacy Policy [Library of Congress](https://lccn.loc.gov/); [National Library of Medicine](https://www.ncbi.nlm.nih.gov/); [MathSciNet](http://www.ams.org/mathscinet); -[mEDRA](https://medra.org/); +[mEDRA](https://www.medra.org/); [Mr. DLib](https://mr-dlib.org/) [1]; [Openlibrary](https://openlibrary.org); [ResearchGate](https://www.researchgate.net/); diff --git a/docs/code-howtos/IntelliJ.md b/docs/code-howtos/IntelliJ.md index 5cac3dac319..be1e13d611c 100644 --- a/docs/code-howtos/IntelliJ.md +++ b/docs/code-howtos/IntelliJ.md @@ -17,7 +17,7 @@ Did you know that [IntelliJ allows for reformatting selected code](https://www.j ## Show variable values in IntelliJ -1. Go to a test case (example: [`org.jabref.model.entry.BibEntryTest#settingTypeToNullThrowsException`](https://github.com/JabRef/jabref/blob/refine-intellij-howto/src/test/java/org/jabref/model/entry/BibEntryTest.java#L52-L52) +1. Go to a test case (example: [`org.jabref.model.entry.BibEntryTest#settingTypeToNullThrowsException`](https://github.com/JabRef/jabref/blob/main/src/test/java/org/jabref/model/entry/BibEntryTest.java#L52-L52) 2. Set the breakpoint to the first line 3. Execute the test 4. Go to the settings of the debugger and activate "Show Variable Values in Editor" and "Show Method Return Values" diff --git a/docs/code-howtos/index.md b/docs/code-howtos/index.md index fff2c645b44..eb11987445d 100644 --- a/docs/code-howtos/index.md +++ b/docs/code-howtos/index.md @@ -5,7 +5,7 @@ has_children: true # Code Howtos This page provides some development support in the form of howtos. -See also [High Level Documentation](../getting-into-thecode/high-level-documentation.md). +See also [High Level Documentation](../getting-into-the-code/high-level-documentation.md). ## Generic code how tos diff --git a/docs/code-howtos/javafx.md b/docs/code-howtos/javafx.md index c045b12fc12..2dfb8514351 100644 --- a/docs/code-howtos/javafx.md +++ b/docs/code-howtos/javafx.md @@ -62,7 +62,7 @@ The goal of the MVVM architecture is to separate the state/behavior from the app The only class which access model and logic classes is the ViewModel. Controller and View have only access the ViewModel and never the backend. The ViewModel does not know the Controller or View. -More details about the MVVM pattern can be found in [an article by Microsoft](https://msdn.microsoft.com/en-us/magazine/dd419663.aspx) and in [an article focusing on the implementation with JavaFX](http://blog.buildpath.de/javafx-decouple-the-view-and-its-behavior-to-create-a-testable-ui/). +More details about the MVVM pattern can be found in [an article by Microsoft](https://msdn.microsoft.com/en-us/magazine/dd419663.aspx) and in [an article focusing on the implementation with JavaFX](https://web.archive.org/web/20140825151304/http://blog.buildpath.de/javafx-decouple-the-view-and-its-behavior-to-create-a-testable-ui/). ## An example diff --git a/docs/code-howtos/openoffice/code-reorganization.md b/docs/code-howtos/openoffice/code-reorganization.md index c9c37fe47d8..d7bd01a1244 100644 --- a/docs/code-howtos/openoffice/code-reorganization.md +++ b/docs/code-howtos/openoffice/code-reorganization.md @@ -29,15 +29,15 @@ Why * `OOListUtil`: some utilities working on List * `uno` : helpers for various tasks via UNO.\ These are conceptually independent of JabRef code and logic. - * `ootext` : to separate decisions on the format of references and citation marks from the actual insertion into the document, the earlier method [OOUtil.insertOOFormattedTextAtCurrentLocation](https://github.com/JabRef/jabref/blob/475b2989ffa8ec61c3327c62ed8f694149f83220/src/main/java/org/jabref/logic/openoffice/OOUtil.java#L112) was extended to handle new tags that describe actions earlier done in code. - * This became [OOTextIntoOO.write](https://github.com/antalk2/jabref/blob/122d5133fa6c7b44245c5ba5600d398775718664/src/main/java/org/jabref/model/openoffice/ootext/OOTextIntoOO.java#L149) + * `ootext` : to separate decisions on the format of references and citation marks from the actual insertion into the document, the earlier method `OOUtil.insertOOFormattedTextAtCurrentLocation` was extended to handle new tags that describe actions earlier done in code. + * This became `OOTextIntoOO.write` * `(change)` Now all output to the document goes through this, not only those from Layout. This allows the citation markers and `jstyle:Title` to use these tags. * This allows some backward-compatible extensions to jstyle.\ - `(change)` [Added](https://github.com/antalk2/jabref/blob/122d5133fa6c7b44245c5ba5600d398775718664/src/main/java/org/jabref/logic/openoffice/style/OOBibStyle.java#L92) some extra keywords, in `{prefix}_MARKUP_BEFORE`, `{prefix}_MARKUP_AFTER` pairs to allow bracketing some parts of citation marks with text and/or open/close tag pairs. - * [OOFormat](https://github.com/antalk2/jabref/blob/improve-reversibility-rebased-03/src/main/java/org/jabref/model/openoffice/ootext/OOFormat.java) contains helpers to create the appropriate tags - * [OOText](https://github.com/antalk2/jabref/blob/improve-reversibility-rebased-03/src/main/java/org/jabref/model/openoffice/ootext/OOText.java) formalizes the distinction from `String`. I did not change `String` to `OOText` in old code, (in particular in OOStyle). + `(change)` Added some extra keywords, in `{prefix}_MARKUP_BEFORE`, `{prefix}_MARKUP_AFTER` pairs to allow bracketing some parts of citation marks with text and/or open/close tag pairs. + * `OOFormat` contains helpers to create the appropriate tags + * `OOText` formalizes the distinction from `String`. I did not change `String` to `OOText` in old code, (in particular in OOStyle). * `rangesort` : ordering objects that have an `XTextRange`, optionally with an extra integer to break ties. - * `RangeSort.partitionAndSortRanges` : since `XTextRangeCompare` can only compare `XTextRange` values in the same `XText`, we partition them accordingly and only sort within each partiion. + * `RangeSort.partitionAndSortRanges` : since `XTextRangeCompare` can only compare `XTextRange` values in the same `XText`, we partition them accordingly and only sort within each partition. * `RangeSortable` (interface), `RangeSortEntry` (implements) :\ When we replace `XTextRange` of citation marks in footnotes with the range of the footnote mark, multiple citation marks may be mapped to the same location. To preserve the order between these, `RangeSortable` allows this order to be indicated by returning appropriate indices from `getIndexInPosition` * `RangeSortVisual` : sort in top-to-bottom left-to-right order.\ @@ -61,12 +61,12 @@ At the core, * a list of citations (`citationsInStorageOrder`) * an identifier `CitationGroupId cgid` * this allows to refer to the group - * also used to associate the group to its citation markers location (outside the style part, in [Backend](https://github.com/antalk2/jabref/blob/fed0952cbdaf7a76bcb09b3db5ac48f34f5ca388/src/main/java/org/jabref/logic/openoffice/backend/Backend52.java#L46)) + * also used to associate the group to its citation markers location (outside the style part, in `Backend52`) * `OODataModel dataModel` is here, in order to handle old (Jabref5.2) structure where pageInfo belonged to CitationGroup not Citation * `referenceMarkNameForLinking` is optional: can be used to crosslink to the citation marker from the bibliography. * `CitationGroups` represents the collection of citation groups.\ Processing starts with creating a `CitationGroups` instance from the data stored in the document. -* `CitedKey` represents a cited source, with ordered backreferences (using `CitationPath`) to the correponding citations. +* `CitedKey` represents a cited source, with ordered back references (using `CitationPath`) to the corresponding citations. * `CitedKeys` is just an order-preserving collection of `CitedKeys` that also supports lookup by `citationKey`. While producing citation markers, we also create a corresponding `CitedKeys` instance, and store it in `CitationGroups.bibliography`. This is already sorted, its entries have `uniqueLetter` or `number` assigned, but not converted to markup yet. Common processing steps: @@ -79,10 +79,11 @@ Common processing steps: We can create a `CitedKeys` instance (`bibliography`) according to this order. * For citations numbered in order of first appearance we number the sources and distribute the numbers to the corresponding citations. * For citations numbered in order of bibliography, we sort the bibliography, number, distribute. -* For author-year citations we have to decide on the letters `uniqueLetter` used to distinguish sources. This needs order of first appearance of the sources and recognizing clashing citation markers. This is done in logic, in [`OOProcessAuthorYearMarkers.createUniqueLetters()`](https://github.com/antalk2/jabref/blob/122d5133fa6c7b44245c5ba5600d398775718664/src/main/java/org/jabref/logic/openoffice/style/OOProcessAuthorYearMarkers.java#L49) -* We also mark first appearance of each source ([`setIsFirstAppearanceOfSourceInCitations`](https://github.com/antalk2/jabref/blob/fed0952cbdaf7a76bcb09b3db5ac48f34f5ca388/src/main/java/org/jabref/logic/openoffice/style/OOProcessAuthorYearMarkers.java#L146)) +* For author-year citations we have to decide on the letters `uniqueLetter` used to distinguish sources. This needs order of first appearance of the sources and recognizing clashing citation markers. This is done in logic, in `OOProcessAuthorYearMarkers.createUniqueLetters()` +* We also mark first appearance of each source (`setIsFirstAppearanceOfSourceInCitations`) + +The entry point for this processing is: `OOProcess.produceCitationMarkers`. -The entry point for this processing is: [`OOProcess.produceCitationMarkers`](https://github.com/antalk2/jabref/blob/fed0952cbdaf7a76bcb09b3db5ac48f34f5ca388/src/main/java/org/jabref/logic/openoffice/style/OOProcess.java#L69).\ It fills * each `CitationGroup.citationMarker` @@ -94,7 +95,7 @@ It fills * `StyleLoader` : not changed (knows about default styles) Used by GUI * `OOPreFormatter` : LaTeX code to unicode and OOText tags. (not changed) * `OOBibStyle` : is mostly concerned by loading/parsing jstyle files and presenting its pieces to the rest. Originally it also contains code to format numeric and author-year citation markers. - * Details of their new implementations are in [`OOBibStyleGetNumCitationMarker`](https://github.com/antalk2/jabref/blob/improve-reversibility-rebased-03/src/main/java/org/jabref/logic/openoffice/style/OOBibStyleGetNumCitationMarker.java) and [`OOBibStyleGetCitationMarker`](https://github.com/antalk2/jabref/blob/improve-reversibility-rebased-03/src/main/java/org/jabref/logic/openoffice/style/OOBibStyleGetCitationMarker.java) + * Details of their new implementations are in `OOBibStyleGetNumCitationMarker` and `OOBibStyleGetCitationMarker` * The new implementations * support pageInfo for each citation * support unresolved citations @@ -106,7 +107,7 @@ It fills * `CitationMarkerNumericBibEntry` * `CitationMarkerNormEntry`\ describe their expected input entries. -* [`OOProcess.produceCitationMarkers`](https://github.com/antalk2/jabref/blob/fed0952cbdaf7a76bcb09b3db5ac48f34f5ca388/src/main/java/org/jabref/logic/openoffice/style/OOProcess.java#L69) is the main entry point for style application. Calls to specific implementations in `OOProcessCitationKeyMarkers`, `OOProcessNumericMarkers` and `OOProcessAuthorYearMarkers` according to jstyle flags. +* `OOProcess.produceCitationMarkers` is the main entry point for style application. Calls to specific implementations in `OOProcessCitationKeyMarkers`, `OOProcessNumericMarkers` and `OOProcessAuthorYearMarkers` according to jstyle flags. ## logic/backend diff --git a/docs/code-howtos/remote-storage.md b/docs/code-howtos/remote-storage.md index 0f845913aa5..01a402afc79 100644 --- a/docs/code-howtos/remote-storage.md +++ b/docs/code-howtos/remote-storage.md @@ -12,4 +12,4 @@ JabRef supports kinds of remote storage: The first one is the more modern approach allowing offline-work. The second approach makes use of the SQL features of databases and require direct online connections. -More details in [JabDrive](remote-storeage-jabdrive.md) and [SQL Storage](remote-storage-sql.md) respectively. +More details in [JabDrive](remote-storage-jabdrive.md) and [SQL Storage](remote-storage-sql.md) respectively. diff --git a/docs/code-howtos/tools.md b/docs/code-howtos/tools.md index c4e9853a21f..f2b344da05a 100644 --- a/docs/code-howtos/tools.md +++ b/docs/code-howtos/tools.md @@ -16,9 +16,9 @@ This page lists some software we consider useful. Here, we collect some helpful git hints -* [https://github.com/blog/2019-how-to-undo-almost-anything-with-git](https://github.com/blog/2019-how-to-undo-almost-anything-with-git) -* [https://github.com/RichardLitt/docs/blob/master/amending-a-commit-guide.md](https://github.com/RichardLitt/docs/blob/master/amending-a-commit-guide.md) -* awesome hints and tools regarding git: [https://github.com/dictcp/awesome-git](https://github.com/dictcp/awesome-git) +* +* [So you need to change your commit](https://github.com/RichardLitt/knowledge/blob/master/github/amending-a-commit-guide.md#so-you-need-to-change-your-commit) +* awesome hints and tools regarding git: ### Rebase everything as one commit on main diff --git a/docs/contributing.md b/docs/contributing.md index bd187bf1f3f..06451efcbc9 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -78,7 +78,7 @@ Actual :[Opens\ JabRef's\ Twitter\ page (src\main\java\org\jabref\gui\JabRefFr Add the above snippet to the English translation file located at `src/main/resources/l10n/JabRef_en.properties`. [Crowdin](https://crowdin.com/project/jabref) will automatically pick up the new string and add it to the other translations. -You can also directly run the specific test in your IDE. The test "LocalizationConsistencyTest" is placed under `src/test/java/org.jabref.logic.l10n/LocalizationConsistencyTest.java`. Find more information in the [JabRef developer docs](https://devdocs.jabref.org/getting-into-the-code/code-howtos#using-localization-correctly). +You can also directly run the specific test in your IDE. The test "LocalizationConsistencyTest" is placed under `src/test/java/org.jabref.logic.l10n/LocalizationConsistencyTest.java`. Find more information in the [JabRef developer docs](code-howtos/localization.md). #### When adding a library diff --git a/docs/decisions/0009-use-plain-junit5-for-testing.md b/docs/decisions/0009-use-plain-junit5-for-testing.md index 3d88c5989e3..5ca034a33cd 100644 --- a/docs/decisions/0009-use-plain-junit5-for-testing.md +++ b/docs/decisions/0009-use-plain-junit5-for-testing.md @@ -34,7 +34,7 @@ Chosen option: "Plain JUnit5", because comes out best \(see below\). ### Plain JUnit5 Homepage: -JabRef testing guidelines: +JabRef testing guidelines: <../testing.md> Example: diff --git a/docs/getting-into-the-code/development-strategy.md b/docs/getting-into-the-code/development-strategy.md index 8fddcd79b47..b58387ba1c8 100644 --- a/docs/getting-into-the-code/development-strategy.md +++ b/docs/getting-into-the-code/development-strategy.md @@ -12,7 +12,7 @@ To ensure high code-quality, * We follow the principles of [Effective Java](https://www.oreilly.com/library/view/effective-java-3rd/9780134686097/). * We use [Design Patterns](https://java-design-patterns.com/patterns/) when applicable. * We document our design decisions using the lightweight architectural decision records [MADR](https://adr.github.io/madr/). -* We review each external pull request by at least two [JabRef Core Developers](https://github.com/JabRef/jabref/blob/main/MAINTAINERS/README.md). +* We review each external pull request by at least two [JabRef Core Developers](https://github.com/JabRef/jabref/blob/main/MAINTAINERS). Read on about our automated quality checks at [Code Quality](../code-howtos/code-quality.md). @@ -35,7 +35,7 @@ Other branches are used for discussing improvements with the help of [pull reque ## How JabRef acquires contributors -* We participate in [Hacktoberfest](https://hacktoberfest.digitalocean.com). See [https://www.jabref.org/hacktoberfest/](https://www.jabref.org/hacktoberfest/) for details. +* We participate in [Hacktoberfest](https://www.hacktoberfest.com). * We participate in [Google Summer of Code](https://developers.google.com/open-source/gsoc/). ## Historical notes diff --git a/docs/teaching.md b/docs/teaching.md index dedc12bde3f..6c617826f50 100644 --- a/docs/teaching.md +++ b/docs/teaching.md @@ -21,7 +21,6 @@ By using JabRef as training object in exercises and labs, students can level-up implementation effort, testing effort, and "issue understanding effort". The latter category is important, because some issues are "quick wins" and others need thorough thinking. - In general, all issues of JabRef are free to take. Be aware that the difficulty of bugs and feature vary. For the brave, the [Bug Board](https://github.com/orgs/JabRef/projects/7) or the [Feature Board](https://github.com/JabRef/jabref/projects/6) provide other issue sources. @@ -34,7 +33,7 @@ By using JabRef as training object in exercises and labs, students can level-up 6. Students address review feedback 7. Students submit pull request 8. Code reviews by JabRef maintainers -9. Students address feedback and learn more about good coding practices by incoporating feedback +9. Students address feedback and learn more about good coding practices by incorporating feedback 10. Students update their pull request 11. Pull request is merged @@ -50,19 +49,19 @@ There is no special process for student contributions. We want to discuss it nev The process for accepting contributions is as below. The syntax is [BPMN](https://en.wikipedia.org/wiki/Business\_Process\_Model\_and\_Notation) modeled using [bpmn.io](https://bpmn.io). -[![process]()](https://github.com/JabRef/jabref/tree/ed275b62fe7dac57a086e43802e36deb93c63e31/docs/images/contribution-process-reviews.svg) +[![process](images/contribution-process-reviews.svg)](https://raw.githubusercontent.com/JabRef/jabref/main/docs/images/contribution-process-reviews.svg) In short, the contribution is **reviewed by two JabRef developers**. Typically, they have constructive feedback on their contribution. This means, that the contributors get comments on their contribution enabling them to level-up their coding skill. Incorporating improvements takes time, too. The benefit is two-fold: a) contributors improve their coding skills and b) JabRef's code quality improves. All in all, we ask to respect the aims of the JabRef team and to reserve time to incorporate the reviewer's comments. GitHub describes that in their page [Understanding the GitHub flow](https://guides.github.com/introduction/flow/): -[![GitHub flow]()](https://github.com/JabRef/jabref/tree/ed275b62fe7dac57a086e43802e36deb93c63e31/docs/images/github-flow.png) +[![GitHub flow](images/github-flow.png)](https://raw.githubusercontent.com/JabRef/jabref/main/docs/images/github-flow.png) ## Process for Java newcomers Newcomers contributing in the context of a university teaching experience are invited to follow the process described above. In case the capacity of the instructing university allows, we propose a three-step approach. First, the contributors prepare their contribution as usual. Then, they submit the pull request _to a separate repository_. There, the instructor reviews the pull request and provides feedback. This happens in a loop until the instructor shows the green light. Then, the pull request can be submitted to the main JabRef repository. This will help to reduce the load on the JabRef team and improve the quality of the initial pull request. -[![process with instructor]()](https://github.com/JabRef/jabref/tree/ed275b62fe7dac57a086e43802e36deb93c63e31/docs/images/contribution-process-reviews-with-instructor.svg) +[![process with instructor](images/contribution-process-reviews-with-instructor.svg)](https://raw.githubusercontent.com/JabRef/jabref/main/docs/images/contribution-process-reviews-with-instructor.svg) ## Past courses @@ -129,7 +128,7 @@ Course "Programming and Software Development" as part of the [BSc Software Engin Course [DD2480 Software Engineering Fundamentals](https://www.kth.se/student/kurser/kurs/DD2480?l=en) -* Summary: Groups of students from three to five persons experienced the whole software engineering process within a week: From the requirements specification to the final pull request. +* Summary: Groups of students from three to five persons experienced the whole software engineering process within a week: From the requirements' specification to the final pull request. * Successfully run in 2020 ### Portuguese diff --git a/external-libraries.md b/external-libraries.md index 6e68aa9bd68..f3d05010490 100644 --- a/external-libraries.md +++ b/external-libraries.md @@ -4,7 +4,7 @@ This document lists the fonts, icons, and libraries used by JabRef. This file is manually kept in sync with build.gradle and the binary jars contained in the lib/ directory. One can list all dependencies by using Gradle task `dependencyReport`. -It generates the file [build/reports/project/dependencies.txt](build/reports/project/dependencies.txt). +It generates the file `build/reports/project/dependencies.txt`. Below, there is a howto to generate the content at "Sorted list of runtime dependencies output by gradle". ## Legend diff --git a/lychee.toml b/lychee.toml new file mode 100644 index 00000000000..ffc6ffe8716 --- /dev/null +++ b/lychee.toml @@ -0,0 +1 @@ +exclude_path = ["build/", "buildres/abbrv.jabref.org", "out/", "src/main/resources/csl-locales", "src/main/resources/csl-styles"] diff --git a/mlc_config.json b/mlc_config.json deleted file mode 100644 index e4ae50df899..00000000000 --- a/mlc_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "ignorePatterns": [ - { - "pattern": "autohotkey.com" - }, - { - "pattern": "baeldung.com" - }, - { - "pattern": "^CONTRIBUTING\\.md" - }, - { - "pattern": "^https://codecov\\.io/" - }, - { - "pattern": "^https://dl\\.acm\\.org" - }, - { - "pattern": "^https://github\\.com" - }, - { - "pattern": "^https://.*\\.jabref\\.org" - }, - { - "pattern": "^https://sourcespy\\.com/.*" - }, - { - "pattern": "^http://purl\\.org/net/bibteXMP" - }, - { - "pattern": "tldrlegal.com" - }, - { - "pattern": "^https://web\\.archive\\.org" - }, - { - "pattern": "^https://www\\.slant\\.co/" - }, - { - "pattern": "^http://localhost" - }, - { - "pattern": "^https://demo.teamscale.com" - } - ] -} diff --git a/src/main/java/org/jabref/logic/importer/fetcher/MedlineFetcher.java b/src/main/java/org/jabref/logic/importer/fetcher/MedlineFetcher.java index f0cf950e1eb..900122f2594 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/MedlineFetcher.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/MedlineFetcher.java @@ -43,7 +43,7 @@ /** * Fetch or search from PubMed www.ncbi.nlm.nih.gov * The MedlineFetcher fetches the entries from the PubMed database. - * See docs.jabref.org for a detailed documentation of the available fields. + * See docs.jabref.org for a detailed documentation of the available fields. */ public class MedlineFetcher implements IdBasedParserFetcher, SearchBasedFetcher { private static final Logger LOGGER = LoggerFactory.getLogger(MedlineFetcher.class); From 8287a6f0462dce4e3a6ade2258e30a28f3ed1348 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 14:55:06 +0000 Subject: [PATCH 2/9] Bump com.tngtech.archunit:archunit-junit5-api from 1.1.0 to 1.2.0 Bumps [com.tngtech.archunit:archunit-junit5-api](https://github.com/TNG/ArchUnit) from 1.1.0 to 1.2.0. - [Release notes](https://github.com/TNG/ArchUnit/releases) - [Commits](https://github.com/TNG/ArchUnit/compare/v1.1.0...v1.2.0) --- updated-dependencies: - dependency-name: com.tngtech.archunit:archunit-junit5-api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6e1338369a0..e9f9d5f3c5f 100644 --- a/build.gradle +++ b/build.gradle @@ -242,7 +242,7 @@ dependencies { testImplementation 'org.xmlunit:xmlunit-core:2.9.1' testImplementation 'org.xmlunit:xmlunit-matchers:2.9.1' testRuntimeOnly 'com.tngtech.archunit:archunit-junit5-engine:1.1.0' - testImplementation 'com.tngtech.archunit:archunit-junit5-api:1.1.0' + testImplementation 'com.tngtech.archunit:archunit-junit5-api:1.2.0' testImplementation "org.testfx:testfx-core:4.0.16-alpha" testImplementation "org.testfx:testfx-junit5:4.0.16-alpha" testImplementation "org.hamcrest:hamcrest-library:2.2" From e5467a048c97eb4e48c55b4b1f8d8c280e0c3c19 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 14:55:12 +0000 Subject: [PATCH 3/9] Bump com.dlsc.gemsfx:gemsfx from 1.84.0 to 1.90.0 Bumps [com.dlsc.gemsfx:gemsfx](https://github.com/dlsc-software-consulting-gmbh/GemsFX) from 1.84.0 to 1.90.0. - [Release notes](https://github.com/dlsc-software-consulting-gmbh/GemsFX/releases) - [Changelog](https://github.com/dlsc-software-consulting-gmbh/GemsFX/blob/master/CHANGELOG.md) - [Commits](https://github.com/dlsc-software-consulting-gmbh/GemsFX/commits/v1.90.0) --- updated-dependencies: - dependency-name: com.dlsc.gemsfx:gemsfx dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6e1338369a0..23f1911d32a 100644 --- a/build.gradle +++ b/build.gradle @@ -174,7 +174,7 @@ dependencies { implementation('com.tobiasdiez:easybind:2.2.1-SNAPSHOT') implementation 'org.fxmisc.flowless:flowless:0.7.1' implementation 'org.fxmisc.richtext:richtextfx:0.11.1' - implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '1.84.0') { + implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '1.90.0') { exclude module: 'javax.inject' // Split package, use only jakarta.inject exclude group: 'org.apache.logging.log4j' } From 924b573a9deba5338e43a4508022d426d8cbd289 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 14:55:17 +0000 Subject: [PATCH 4/9] Bump org.fxmisc.flowless:flowless from 0.7.1 to 0.7.2 Bumps [org.fxmisc.flowless:flowless](https://github.com/FXMisc/Flowless) from 0.7.1 to 0.7.2. - [Release notes](https://github.com/FXMisc/Flowless/releases) - [Changelog](https://github.com/FXMisc/Flowless/blob/master/CHANGELOG.md) - [Commits](https://github.com/FXMisc/Flowless/compare/v0.7.1...v0.7.2) --- updated-dependencies: - dependency-name: org.fxmisc.flowless:flowless dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6e1338369a0..27354d16d1d 100644 --- a/build.gradle +++ b/build.gradle @@ -172,7 +172,7 @@ dependencies { implementation 'com.github.sialcasa.mvvmFX:mvvmfx-validation:f195849ca9' //jitpack implementation 'de.saxsys:mvvmfx:1.8.0' implementation('com.tobiasdiez:easybind:2.2.1-SNAPSHOT') - implementation 'org.fxmisc.flowless:flowless:0.7.1' + implementation 'org.fxmisc.flowless:flowless:0.7.2' implementation 'org.fxmisc.richtext:richtextfx:0.11.1' implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '1.84.0') { exclude module: 'javax.inject' // Split package, use only jakarta.inject From a44cbd9a060ce2c9f8c0cf45f02c859b51b9105a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 14:55:33 +0000 Subject: [PATCH 5/9] Bump org.junit.jupiter:junit-jupiter from 5.10.0 to 5.10.1 Bumps [org.junit.jupiter:junit-jupiter](https://github.com/junit-team/junit5) from 5.10.0 to 5.10.1. - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.10.0...r5.10.1) --- updated-dependencies: - dependency-name: org.junit.jupiter:junit-jupiter dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6e1338369a0..cde14aea7f7 100644 --- a/build.gradle +++ b/build.gradle @@ -235,7 +235,7 @@ dependencies { // implementation 'org.glassfish.jersey.media:jersey-media-json-gson:3.1.1' testImplementation 'io.github.classgraph:classgraph:4.8.163' - testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0' + testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1' testImplementation 'org.junit.platform:junit-platform-launcher:1.10.0' testImplementation 'org.mockito:mockito-core:5.6.0' From fe9483a9be7a89da9265d76858ef6dbd61663b0c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 15:05:41 +0000 Subject: [PATCH 6/9] Bump org.jsoup:jsoup from 1.16.1 to 1.16.2 (#10625) Bumps [org.jsoup:jsoup](https://github.com/jhy/jsoup) from 1.16.1 to 1.16.2. - [Release notes](https://github.com/jhy/jsoup/releases) - [Changelog](https://github.com/jhy/jsoup/blob/master/CHANGES) - [Commits](https://github.com/jhy/jsoup/compare/jsoup-1.16.1...jsoup-1.16.2) --- updated-dependencies: - dependency-name: org.jsoup:jsoup dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6e1338369a0..c0ef9a56e90 100644 --- a/build.gradle +++ b/build.gradle @@ -181,7 +181,7 @@ dependencies { implementation 'org.controlsfx:controlsfx:11.1.2' - implementation 'org.jsoup:jsoup:1.16.1' + implementation 'org.jsoup:jsoup:1.16.2' implementation 'com.konghq:unirest-java:3.14.5' implementation 'org.slf4j:slf4j-api:2.0.9' From a88772d878cde3ea11e3117c2ced2bd5584eb758 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Mon, 6 Nov 2023 17:05:45 +0100 Subject: [PATCH 7/9] fix tests --- .../fetcher/transformers/IEEEQueryTransformerTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/jabref/logic/importer/fetcher/transformers/IEEEQueryTransformerTest.java b/src/test/java/org/jabref/logic/importer/fetcher/transformers/IEEEQueryTransformerTest.java index b9673370292..91f2fccce28 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/transformers/IEEEQueryTransformerTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/transformers/IEEEQueryTransformerTest.java @@ -46,7 +46,7 @@ public void convertJournalFieldPrefix() throws Exception { QueryNode luceneQuery = new StandardSyntaxParser().parse(queryString, AbstractQueryTransformer.NO_EXPLICIT_FIELD); transformer.transformLuceneQuery(luceneQuery); - assertEquals("\"Nature\"", transformer.getJournal().get()); + assertEquals(Optional.of("Nature"), transformer.getJournal()); } @Override @@ -60,8 +60,8 @@ public void convertYearField() throws Exception { QueryNode luceneQuery = new StandardSyntaxParser().parse(queryString, AbstractQueryTransformer.NO_EXPLICIT_FIELD); transformer.transformLuceneQuery(luceneQuery); - assertEquals(2021, transformer.getStartYear()); - assertEquals(2021, transformer.getEndYear()); + assertEquals(Optional.of(2021), transformer.getStartYear()); + assertEquals(Optional.of(2021), transformer.getEndYear()); } @Override @@ -72,8 +72,8 @@ public void convertYearRangeField() throws Exception { QueryNode luceneQuery = new StandardSyntaxParser().parse(queryString, AbstractQueryTransformer.NO_EXPLICIT_FIELD); transformer.transformLuceneQuery(luceneQuery); - assertEquals(2018, transformer.getStartYear()); - assertEquals(2021, transformer.getEndYear()); + assertEquals(Optional.of(2018), transformer.getStartYear()); + assertEquals(Optional.of(2021), transformer.getEndYear()); } private static Stream getTitleTestData() { From a2aa2c638c910c3eadb45ed69388acb121b3dae7 Mon Sep 17 00:00:00 2001 From: liyou969 <117704913+liyou969@users.noreply.github.com> Date: Tue, 7 Nov 2023 07:04:15 +1100 Subject: [PATCH 8/9] Fix #10498 Create Fetcher and Transformer for ScholarArchive (#10549) * Create Fetcher and Transformer for ScholarArchive * Finish change requirement including code style, testing, some error , and comment. * Finish and fix archive scholar fetcher * add url * fix arch * fix test * fix var name * remove comments * add changelog * fuck this changelog --------- Co-authored-by: youliyou Co-authored-by: Siedlerchr --- CHANGELOG.md | 1 + .../jabref/logic/importer/WebFetchers.java | 2 + .../fetcher/ScholarArchiveFetcher.java | 158 ++++++++++++++++++ .../ScholarArchiveQueryTransformer.java | 71 ++++++++ .../ManageStudyDefinitionViewModelTest.java | 36 ++-- .../fetcher/ScholarArchiveFetcherTest.java | 51 ++++++ 6 files changed, 304 insertions(+), 15 deletions(-) create mode 100644 src/main/java/org/jabref/logic/importer/fetcher/ScholarArchiveFetcher.java create mode 100644 src/main/java/org/jabref/logic/importer/fetcher/transformers/ScholarArchiveQueryTransformer.java create mode 100644 src/test/java/org/jabref/logic/importer/fetcher/ScholarArchiveFetcherTest.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 55d8ccfcdb5..98c21e0915c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We added a dropdown menu to let users change the reference library during AUX file import. [#10472](https://github.com/JabRef/jabref/issues/10472) - We added a button to let users reset the cite command to the default value. [#10569](https://github.com/JabRef/jabref/issues/10569) +- We added [scholar.archive.org](https://scholar.archive.org/) as a new fetcher. [#10498](https://github.com/JabRef/jabref/issues/10498) ### Changed diff --git a/src/main/java/org/jabref/logic/importer/WebFetchers.java b/src/main/java/org/jabref/logic/importer/WebFetchers.java index 344fa6399b3..332811085fa 100644 --- a/src/main/java/org/jabref/logic/importer/WebFetchers.java +++ b/src/main/java/org/jabref/logic/importer/WebFetchers.java @@ -37,6 +37,7 @@ import org.jabref.logic.importer.fetcher.OpenAccessDoi; import org.jabref.logic.importer.fetcher.ResearchGate; import org.jabref.logic.importer.fetcher.RfcFetcher; +import org.jabref.logic.importer.fetcher.ScholarArchiveFetcher; import org.jabref.logic.importer.fetcher.ScienceDirect; import org.jabref.logic.importer.fetcher.SemanticScholar; import org.jabref.logic.importer.fetcher.SpringerFetcher; @@ -126,6 +127,7 @@ public static SortedSet getSearchBasedFetchers(ImportFormatP set.add(new ResearchGate(importFormatPreferences)); set.add(new BiodiversityLibrary(importerPreferences)); set.add(new LOBIDFetcher(importerPreferences)); + set.add(new ScholarArchiveFetcher()); return set; } diff --git a/src/main/java/org/jabref/logic/importer/fetcher/ScholarArchiveFetcher.java b/src/main/java/org/jabref/logic/importer/fetcher/ScholarArchiveFetcher.java new file mode 100644 index 00000000000..0f6b810c6ac --- /dev/null +++ b/src/main/java/org/jabref/logic/importer/fetcher/ScholarArchiveFetcher.java @@ -0,0 +1,158 @@ +package org.jabref.logic.importer.fetcher; + +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.stream.IntStream; + +import org.jabref.logic.importer.FetcherException; +import org.jabref.logic.importer.PagedSearchBasedParserFetcher; +import org.jabref.logic.importer.ParseException; +import org.jabref.logic.importer.Parser; +import org.jabref.logic.importer.fetcher.transformers.ScholarArchiveQueryTransformer; +import org.jabref.logic.importer.util.JsonReader; +import org.jabref.logic.net.URLDownload; +import org.jabref.model.entry.AuthorList; +import org.jabref.model.entry.BibEntry; +import org.jabref.model.entry.field.StandardField; +import org.jabref.model.entry.types.EntryType; +import org.jabref.model.entry.types.StandardEntryType; + +import jakarta.ws.rs.core.MediaType; +import kong.unirest.json.JSONArray; +import kong.unirest.json.JSONException; +import kong.unirest.json.JSONObject; +import org.apache.http.client.utils.URIBuilder; +import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ScholarArchiveFetcher implements PagedSearchBasedParserFetcher { + + public static final String FETCHER_NAME = "ScholarArchive"; + + private static final Logger LOGGER = LoggerFactory.getLogger(ScholarArchiveFetcher.class); + + private static final String API_URL = "https://scholar.archive.org/search"; + + /** + * Gets the query URL by luceneQuery and pageNumber. + * + * @param luceneQuery the search query + * @param pageNumber the number of the page indexed from 0 + * @return URL + */ + @Override + public URL getURLForQuery(QueryNode luceneQuery, int pageNumber) throws URISyntaxException, MalformedURLException, FetcherException { + URIBuilder uriBuilder = new URIBuilder(API_URL); + uriBuilder.addParameter("q", new ScholarArchiveQueryTransformer().transformLuceneQuery(luceneQuery).orElse("")); + uriBuilder.addParameter("from", String.valueOf(getPageSize() * pageNumber)); + uriBuilder.addParameter("size", String.valueOf(getPageSize())); + uriBuilder.addParameter("format", "json"); + + LOGGER.debug("using URL for search {}", uriBuilder.build()); + return uriBuilder.build().toURL(); + } + + @Override + public URLDownload getUrlDownload(URL url) { + URLDownload download = new URLDownload(url); + download.addHeader("Accept", MediaType.APPLICATION_JSON); + return download; + } + + /** + * Gets the list of BibEntry by given Json response from scholar archive fetcher API + * + * @return Parser, list of BibEntry + */ + @Override + public Parser getParser() { + return inputStream -> { + JSONObject response = JsonReader.toJsonObject(inputStream); + List entries = new ArrayList<>(); + if (response.has("results")) { + JSONArray results = response.getJSONArray("results"); + for (int i = 0; i < results.length(); i++) { + JSONObject jsonEntry = results.getJSONObject(i); + BibEntry entry = parseJSONtoBibtex(jsonEntry); + entries.add(entry); + } + } + + return entries; + }; + } + + @Override + public String getName() { + return FETCHER_NAME; + } + + private BibEntry parseJSONtoBibtex(JSONObject jsonEntry) throws ParseException { + try { + BibEntry entry = new BibEntry(); + EntryType entryType = StandardEntryType.InCollection; + JSONObject biblio = jsonEntry.optJSONObject("biblio"); + + JSONArray abstracts = jsonEntry.getJSONArray("abstracts"); + String foundAbstract = IntStream.range(0, abstracts.length()) + .mapToObj(abstracts::getJSONObject) + .map(object -> object.optString("body")) + .findFirst().orElse(""); + + String url = Optional.ofNullable(jsonEntry.optJSONObject("fulltext")).map(fullText -> fullText.optString("access_url")).orElse(""); + + // publication type + String type = biblio.optString("release_type"); + entry.setField(StandardField.TYPE, type); + if (type.toLowerCase().contains("book")) { + entryType = StandardEntryType.Book; + } else if (type.toLowerCase().contains("article")) { + entryType = StandardEntryType.Article; + } + entry.setType(entryType); + + entry.setField(StandardField.TITLE, biblio.optString("title")); + entry.setField(StandardField.JOURNAL, biblio.optString("container_name")); + entry.setField(StandardField.DOI, biblio.optString("doi")); + entry.setField(StandardField.ISSUE, biblio.optString("issue")); + entry.setField(StandardField.LANGUAGE, biblio.optString("lang_code")); + entry.setField(StandardField.PUBLISHER, biblio.optString("publisher")); + + entry.setField(StandardField.YEAR, String.valueOf(biblio.optInt("release_year"))); + entry.setField(StandardField.VOLUME, String.valueOf(biblio.optInt("volume_int"))); + entry.setField(StandardField.ABSTRACT, foundAbstract); + entry.setField(StandardField.URL, url); + + String dateString = biblio.optString("date"); + entry.setField(StandardField.DATE, dateString); + + // Authors are in contrib_names + if (biblio.has("contrib_names")) { + JSONArray authors = biblio.getJSONArray("contrib_names"); + List authorList = new ArrayList<>(); + for (int i = 0; i < authors.length(); i++) { + authorList.add(authors.getString(i)); + } + AuthorList parsedAuthors = AuthorList.parse(String.join(" and ", authorList)); + entry.setField(StandardField.AUTHOR, parsedAuthors.getAsLastFirstNamesWithAnd(false)); + } + + if (biblio.has("issns")) { + JSONArray issn = biblio.getJSONArray("issns"); + List issnList = new ArrayList<>(); + for (int i = 0; i < issn.length(); i++) { + issnList.add(issn.getString(i)); + } + entry.setField(StandardField.ISSN, String.join(" ", issnList)); + } + return entry; + } catch (JSONException exception) { + throw new ParseException("ScholarArchive API JSON format has changed", exception); + } + } +} diff --git a/src/main/java/org/jabref/logic/importer/fetcher/transformers/ScholarArchiveQueryTransformer.java b/src/main/java/org/jabref/logic/importer/fetcher/transformers/ScholarArchiveQueryTransformer.java new file mode 100644 index 00000000000..18f84521901 --- /dev/null +++ b/src/main/java/org/jabref/logic/importer/fetcher/transformers/ScholarArchiveQueryTransformer.java @@ -0,0 +1,71 @@ +package org.jabref.logic.importer.fetcher.transformers; + +/** + * This class extends the AbstractQueryTransformer to provide specific implementations + * for transforming standard queries into ones suitable for the Scholar Archive's unique format. + */ +public class ScholarArchiveQueryTransformer extends AbstractQueryTransformer { + + @Override + protected String getLogicalAndOperator() { + return " AND "; + } + + @Override + protected String getLogicalOrOperator() { + return " OR "; + } + + @Override + protected String getLogicalNotOperator() { + return "NOT "; + } + + @Override + protected String handleAuthor(String author) { + return createKeyValuePair("contrib_names", author); + } + + @Override + protected String handleTitle(String title) { + return createKeyValuePair("title", title); + } + + @Override + protected String handleJournal(String journalTitle) { + return createKeyValuePair("container_name", journalTitle); + } + + /** + * Handles the year query by formatting it specifically for a range search in the Scholar Archive. + * This method is for an exact year match. + * + * @param year the publication year to be searched in the Scholar Archive. + * @return A string query segment formatted for the year search. + */ + @Override + protected String handleYear(String year) { + return "publication.startDate:[" + year + " TO " + year + "]"; + } + + /** + * Handles a year range query, transforming it for the Scholar Archive's query format. + * If only a start year is provided, the range will extend to the current year. + * + * @param yearRange the range of years to be searched in the Scholar Archive, usually in the format "startYear-endYear". + * @return A string query segment formatted for the year range search. + */ + @Override + protected String handleYearRange(String yearRange) { + parseYearRange(yearRange); + if (endYear == Integer.MAX_VALUE) { + // If no specific end year is set, it assumes the range extends to the current year. + return yearRange; + } + return "publication.startDate:[" + startYear + " TO " + endYear + "]"; + } +} + + + + diff --git a/src/test/java/org/jabref/gui/slr/ManageStudyDefinitionViewModelTest.java b/src/test/java/org/jabref/gui/slr/ManageStudyDefinitionViewModelTest.java index eac16dd0c3f..272a045746c 100644 --- a/src/test/java/org/jabref/gui/slr/ManageStudyDefinitionViewModelTest.java +++ b/src/test/java/org/jabref/gui/slr/ManageStudyDefinitionViewModelTest.java @@ -51,6 +51,7 @@ public void emptyStudyConstructorFillsDatabasesCorrectly() { new StudyCatalogItem("Medline/PubMed", false), new StudyCatalogItem("ResearchGate", false), new StudyCatalogItem("SAO/NASA ADS", false), + new StudyCatalogItem("ScholarArchive", false), new StudyCatalogItem("SemanticScholar", false), new StudyCatalogItem("Springer", true), new StudyCatalogItem("zbMATH", false) @@ -59,21 +60,7 @@ public void emptyStudyConstructorFillsDatabasesCorrectly() { @Test public void studyConstructorFillsDatabasesCorrectly(@TempDir Path tempDir) { - List databases = List.of( - new StudyDatabase("ACM Portal", true)); - Study study = new Study( - List.of("Name"), - "title", - List.of("Q1"), - List.of(), - databases - ); - ManageStudyDefinitionViewModel manageStudyDefinitionViewModel = new ManageStudyDefinitionViewModel( - study, - tempDir, - importFormatPreferences, - importerPreferences, - dialogService); + ManageStudyDefinitionViewModel manageStudyDefinitionViewModel = getManageStudyDefinitionViewModel(tempDir); assertEquals(List.of( new StudyCatalogItem("ACM Portal", true), new StudyCatalogItem("ArXiv", false), @@ -92,9 +79,28 @@ public void studyConstructorFillsDatabasesCorrectly(@TempDir Path tempDir) { new StudyCatalogItem("Medline/PubMed", false), new StudyCatalogItem("ResearchGate", false), new StudyCatalogItem("SAO/NASA ADS", false), + new StudyCatalogItem("ScholarArchive", false), new StudyCatalogItem("SemanticScholar", false), new StudyCatalogItem("Springer", false), new StudyCatalogItem("zbMATH", false) ), manageStudyDefinitionViewModel.getCatalogs()); } + + private ManageStudyDefinitionViewModel getManageStudyDefinitionViewModel(Path tempDir) { + List databases = List.of( + new StudyDatabase("ACM Portal", true)); + Study study = new Study( + List.of("Name"), + "title", + List.of("Q1"), + List.of(), + databases + ); + return new ManageStudyDefinitionViewModel( + study, + tempDir, + importFormatPreferences, + importerPreferences, + dialogService); + } } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/ScholarArchiveFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/ScholarArchiveFetcherTest.java new file mode 100644 index 00000000000..0af2c4f0eb4 --- /dev/null +++ b/src/test/java/org/jabref/logic/importer/fetcher/ScholarArchiveFetcherTest.java @@ -0,0 +1,51 @@ +package org.jabref.logic.importer.fetcher; + +import java.util.List; + +import org.jabref.logic.importer.FetcherException; +import org.jabref.model.entry.BibEntry; +import org.jabref.model.entry.field.StandardField; +import org.jabref.model.entry.types.StandardEntryType; +import org.jabref.testutils.category.FetcherTest; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +@FetcherTest +public class ScholarArchiveFetcherTest { + private ScholarArchiveFetcher fetcher; + private BibEntry bibEntry; + + @BeforeEach + public void setUp() { + fetcher = new ScholarArchiveFetcher(); + bibEntry = new BibEntry(StandardEntryType.InCollection) + .withField(StandardField.TITLE, "Query expansion using associated queries") + .withField(StandardField.AUTHOR, "Billerbeck, Bodo and Scholer, Falk and Williams, Hugh E. and Zobel, Justin") + .withField(StandardField.VOLUME, "0") + .withField(StandardField.DOI, "10.1145/956863.956866") + .withField(StandardField.JOURNAL, "Proceedings of the twelfth international conference on Information and knowledge management - CIKM '03") + .withField(StandardField.PUBLISHER, "ACM Press") + .withField(StandardField.TYPE, "paper-conference") + .withField(StandardField.YEAR, "2003") + .withField(StandardField.URL, "https://web.archive.org/web/20170810164449/http://goanna.cs.rmit.edu.au/~jz/fulltext/cikm03.pdf"); + } + + @Test + public void getNameReturnsCorrectName() { + assertEquals("ScholarArchive", fetcher.getName()); + } + + @Test + public void performSearchReturnsExpectedResults() throws FetcherException { + List fetchedEntries = fetcher.performSearch("query"); + fetchedEntries.forEach(entry -> entry.clearField(StandardField.ABSTRACT)); + assertTrue(fetchedEntries.contains(bibEntry), "Found the following entries " + fetchedEntries); + } +} + + + From 2afd1f622a3ab85fc2cf5fa879c5a4d41c245eca Mon Sep 17 00:00:00 2001 From: Christoph Date: Tue, 7 Nov 2023 17:27:15 +0100 Subject: [PATCH 9/9] Update to JavaFX 21.01 (#10627) update controlsfx --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 9af4dc131a9..2ad41343bed 100644 --- a/build.gradle +++ b/build.gradle @@ -101,7 +101,7 @@ dependencyLocking { } javafx { - version = "20.0.2" + version = "21.0.1" modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.web', 'javafx.swing' ] } @@ -179,7 +179,7 @@ dependencies { exclude group: 'org.apache.logging.log4j' } - implementation 'org.controlsfx:controlsfx:11.1.2' + implementation 'org.controlsfx:controlsfx:11.2.0' implementation 'org.jsoup:jsoup:1.16.2' implementation 'com.konghq:unirest-java:3.14.5'