Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed BibTeX file type and included HTML and Markdown types #9318

Merged
merged 14 commits into from
Oct 30, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where a message about changed metadata would occur on saving although nothing changed. [#9159](https://github.com/JabRef/jabref/issues/9159)
- When adding or editing a subgroup it is placed w.r.t. to alphabetical ordering rather than at the end. [koppor#577](https://github.com/koppor/jabref/issues/577)
- We modified the Directory of Open Access Books (DOAB) fetcher so that it will now also fetch the ISBN when possible. [#8708](https://github.com/JabRef/jabref/issues/8708)
- We modified the "Delete file" dialog and add the full file path to the dialog text. The file path in the title was changed to file name only. [koppor#534](https://github.com/koppor/jabref/issues/534)
- Download from URL now automatically fills with URL from clipboard. [koppor#535](https://github.com/koppor/jabref/issues/535)
- We added HTML and Markdown files to Find Unlinked Files and removed BibTex. Markdown was added as a StandardFileType and StandardExternalFileType [koppor#547](https://github.com/koppor/jabref/issues/547)
Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved

### Fixed

Expand Down Expand Up @@ -768,10 +771,10 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where some importers used the field `pubstatus` instead of the standard BibTeX field `pubstate`.
- We changed the latex command removal for docbook exporter. [#3838](https://github.com/JabRef/jabref/issues/3838)
- We changed the location of some fields in the entry editor (you might need to reset your preferences for these changes to come into effect)
- Journal/Year/Month in biblatex mode -> Deprecated (if filled)
- DOI/URL: General -> Optional
- Internal fields like ranking, read status and priority: Other -> General
- Moreover, empty deprecated fields are no longer shown
- Journal/Year/Month in biblatex mode -> Deprecated (if filled)
- DOI/URL: General -> Optional
- Internal fields like ranking, read status and priority: Other -> General
- Moreover, empty deprecated fields are no longer shown
- Added server timezone parameter when connecting to a shared database.
- We updated the dialog for setting up general fields.
- URL field formatting is updated. All whitespace chars, located at the beginning/ending of the URL, are trimmed automatically
Expand Down Expand Up @@ -903,12 +906,12 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We removed the coloring of cells in the main table according to whether the field is optional/required.
- We removed the feature to find and resolve duplicate BibTeX keys (as this use case is already covered by the integrity check).
- We removed a few commands from the right-click menu that are not needed often and thus don't need to be placed that prominently:
- Print entry preview: available through entry preview
- All commands related to marking: marking is not yet reimplemented
- Set/clear/append/rename fields: available through Edit menu
- Manage keywords: available through the Edit menu
- Copy linked files to folder: available through File menu
- Add/move/remove from group: removed completely (functionality still available through group interface)
- Print entry preview: available through entry preview
- All commands related to marking: marking is not yet reimplemented
- Set/clear/append/rename fields: available through Edit menu
- Manage keywords: available through the Edit menu
- Copy linked files to folder: available through File menu
- Add/move/remove from group: removed completely (functionality still available through group interface)
- We removed the option to change the column widths in the preferences dialog. [#4546](https://github.com/JabRef/jabref/issues/4546)

## Older versions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,52 +1,36 @@
package org.jabref.gui.externalfiles;

import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.DirectoryStream.Filter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.List;
import java.util.Optional;
import java.util.function.Predicate;
import java.util.stream.Collectors;

import javax.swing.undo.UndoManager;

import javafx.beans.property.BooleanProperty;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleListProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import de.saxsys.mvvmfx.utils.validation.FunctionBasedValidator;
import de.saxsys.mvvmfx.utils.validation.ValidationMessage;
import de.saxsys.mvvmfx.utils.validation.ValidationStatus;
import javafx.beans.property.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.control.TreeItem;

import org.jabref.gui.DialogService;
import org.jabref.gui.StateManager;
import org.jabref.gui.util.BackgroundTask;
import org.jabref.gui.util.DirectoryDialogConfiguration;
import org.jabref.gui.util.FileDialogConfiguration;
import org.jabref.gui.util.FileNodeViewModel;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.gui.util.*;
import org.jabref.logic.importer.ImportFormatReader;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.util.FileUpdateMonitor;
import org.jabref.preferences.PreferencesService;

import de.saxsys.mvvmfx.utils.validation.FunctionBasedValidator;
import de.saxsys.mvvmfx.utils.validation.ValidationMessage;
import de.saxsys.mvvmfx.utils.validation.ValidationStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.swing.undo.UndoManager;
import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.DirectoryStream.Filter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.List;
import java.util.Optional;
import java.util.function.Predicate;
import java.util.stream.Collectors;

public class UnlinkedFilesDialogViewModel {

Expand Down Expand Up @@ -102,7 +86,8 @@ public UnlinkedFilesDialogViewModel(DialogService dialogService,

this.fileFilterList = FXCollections.observableArrayList(
new FileExtensionViewModel(StandardFileType.ANY_FILE, preferences.getFilePreferences()),
new FileExtensionViewModel(StandardFileType.BIBTEX_DB, preferences.getFilePreferences()),
new FileExtensionViewModel(StandardFileType.HTML, preferences.getFilePreferences()),
new FileExtensionViewModel(StandardFileType.MARKDOWN, preferences.getFilePreferences()),
new FileExtensionViewModel(StandardFileType.PDF, preferences.getFilePreferences()));

this.dateFilterList = FXCollections.observableArrayList(DateRange.values());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public enum StandardExternalFileType implements ExternalFileType {
TIFF(Localization.lang("%0 image", "TIFF"), "tiff", "image/tiff", "gimp", "picture", IconTheme.JabRefIcons.PICTURE),
URL("URL", "html", "text/html", "firefox", "www", IconTheme.JabRefIcons.WWW),
MHT("MHT", "mht", "multipart/related", "firefox", "www", IconTheme.JabRefIcons.WWW),
ePUB("ePUB", "epub", "application/epub+zip", "firefox", "www", IconTheme.JabRefIcons.WWW);

ePUB("ePUB", "epub", "application/epub+zip", "firefox", "www", IconTheme.JabRefIcons.WWW),
MARKDOWN("Markdown", "md", "application/x-latex", "emacs", "emacs", IconTheme.JabRefIcons.FILE_TEXT);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://stackoverflow.com/a/25812177/3450689
The mime type needs to adjusted

private final String name;
private final String extension;
private final String mimeType;
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/org/jabref/logic/util/StandardFileType.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package org.jabref.logic.util;

import org.jabref.model.util.OptionalUtil;
import java.util.Arrays;
import java.util.List;

import org.jabref.model.util.OptionalUtil;

/**
* @implNote Enter the extensions in lowercase without a dot! The dot is added implicitly.
*/
Expand Down Expand Up @@ -45,7 +44,9 @@ public enum StandardFileType implements FileType {
CFF("CFF", "cff"),
ANY_FILE("Any", "*"),
CER("SSL Certificate", "cer"),
CITAVI("Citavi", "ctv6bak", "ctv5bak");
CITAVI("Citavi", "ctv6bak", "ctv5bak"),
MARKDOWN("Markdown", "md");
;



Expand Down
46 changes: 21 additions & 25 deletions src/main/java/org/jabref/logic/util/io/FileUtil.java
Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
package org.jabref.logic.util.io;

import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.CopyOption;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Optional;
import java.util.Stack;
import java.util.Vector;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.jabref.logic.citationkeypattern.BracketedPattern;
import org.jabref.model.database.BibDatabase;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.util.FileHelper;
import org.jabref.model.util.OptionalUtil;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.*;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
* The idea of this class is to add general functionality that could possibly even in the
Expand Down Expand Up @@ -380,15 +365,26 @@ public static boolean isBibFile(Path file) {
}

/**
* Test if the file is a bib file by simply checking the extension to be ".bib"
* Test if the file is a pdf file by simply checking the extension to be ".pdf"
*
* @param file The file to check
* @return True if file extension is ".bib", false otherwise
* @return True if file extension is ".pdf", false otherwise
*/
public static boolean isPDFFile(Path file) {
return getFileExtension(file).filter("pdf"::equals).isPresent();
}

/**
* Test if the file is a html file by simply checking the extension to be ".html"
*
* @param file The file to check
* @return True if file extension is ".html", false otherwise
*/
public static boolean isHTMLFile(Path file) {
return getFileExtension(file).filter("html"::equals).isPresent();
}


/**
* @return Path of current panel database directory or the standard working directory in case the database was not saved yet
*/
Expand Down