-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add Copy markdown to copy citation #13387
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
b9ab287
9de6531
ad09503
84a1dd1
8bed13b
fae3c18
49b035b
8654adc
d582566
9c32813
508b93d
d131b92
0553179
529c9f0
e805e7e
7b3fbf7
b3eb93c
b1811e2
34b387f
756efcf
f6b4131
85dce83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,7 @@ public ClipboardContent generate(List<BibEntry> selectedEntries, CitationStyleOu | |
return switch (outputFormat) { | ||
case HTML -> processHtml(citations); | ||
case TEXT -> processText(citations); | ||
case MARKDOWN -> processMarkdown(citations); | ||
}; | ||
} else { | ||
// if it is not a citation style take care of the preview | ||
|
@@ -120,6 +121,13 @@ static ClipboardContent processHtml(List<String> citations) { | |
return content; | ||
} | ||
|
||
static ClipboardContent processMarkdown(List<String> citations) { | ||
String result = String.join(CitationStyleOutputFormat.MARKDOWN.getLineSeparator(), citations); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is the convertion to Markdown made? I think, you need to deal with |
||
ClipboardContent content = new ClipboardContent(); | ||
content.putString(result); | ||
return content; | ||
} | ||
|
||
private List<String> generateTextBasedPreviewLayoutCitations(List<BibEntry> selectedEntries, BibDatabaseContext bibDatabaseContext) throws IOException { | ||
TextBasedPreviewLayout customPreviewLayout = previewPreferences.getCustomPreviewLayout(); | ||
Reader customLayoutReader = Reader.of(customPreviewLayout.getText().replace("__NEWLINE__", "\n")); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,8 @@ | |
public enum CitationStyleOutputFormat { | ||
|
||
HTML("html", OS.NEWLINE + "<br>" + OS.NEWLINE), | ||
TEXT("text", ""); | ||
TEXT("text", ""), | ||
MARKDOWN("markdown", OS.NEWLINE + "<br>" + OS.NEWLINE); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
private final String format; | ||
private final String lineSeparator; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method uses string concatenation for multiline HTML template instead of Java text blocks ("""). This makes the code less readable and maintainable.