Skip to content

Commit

Permalink
Merge pull request #478 from d-i-t-a/develop
Browse files Browse the repository at this point in the history
2.3.11
  • Loading branch information
aferditamuriqi authored Aug 12, 2023
2 parents 874fa1d + bf6b8f3 commit 0ac10a0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 33 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@d-i-t-a/reader",
"version": "2.3.10",
"version": "2.3.11",
"description": "A viewer application for EPUB files.",
"repository": "https://github.com/d-i-t-a/R2D2BC",
"license": "Apache-2.0",
Expand Down
61 changes: 31 additions & 30 deletions src/modules/citation/CitationModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,24 +210,21 @@ export default class CitationModule implements ReaderModule {
let mlaString = "";
let apaString = "";
if (self.properties.publisher) {
mlaString = mlaString + self.properties.publisher + ", ";
chicagoString = chicagoString + self.properties.publisher + ", ";
mlaString = mlaString + self.properties.publisher;
chicagoString = chicagoString + self.properties.publisher;
} else if (
self.publication.Metadata.Publisher &&
self.publication.Metadata.Publisher[0].Name
) {
mlaString =
mlaString + self.publication.Metadata.Publisher[0].Name + ", ";
mlaString = mlaString + self.publication.Metadata.Publisher[0].Name;
chicagoString =
chicagoString +
self.publication.Metadata.Publisher[0].Name +
", ";
chicagoString + self.publication.Metadata.Publisher[0].Name;
}

if (self.properties.published) {
apaString = apaString + "(" + self.properties.published + ")";
mlaString = mlaString + self.properties.published;
chicagoString = chicagoString + self.properties.published;
mlaString = mlaString + ", " + self.properties.published;
chicagoString = chicagoString + ", " + self.properties.published;
} else if (self.publication.Metadata.PublicationDate) {
if (self.publication.Metadata.PublicationDate.getFullYear() > 0) {
apaString =
Expand All @@ -237,9 +234,11 @@ export default class CitationModule implements ReaderModule {
")";
mlaString =
mlaString +
", " +
self.publication.Metadata.PublicationDate.getFullYear();
chicagoString =
chicagoString +
", " +
self.publication.Metadata.PublicationDate.getFullYear();
}
}
Expand All @@ -256,15 +255,15 @@ export default class CitationModule implements ReaderModule {
let bookTitleFormatted = function () {
if (self.properties.title) {
return [
self.properties.title + ". ",
self.properties.title + ". ",
self.properties.title + ". ",
"<em>" + self.properties.title + "</em>. ",
"<em>" + self.properties.title + "</em>. ",
"<em>" + self.properties.title + "</em>. ",
];
} else if (self.publication.Metadata.Title) {
return [
self.publication.Metadata.Title + ". ",
self.publication.Metadata.Title + ". ",
self.publication.Metadata.Title + ". ",
"<em>" + self.publication.Metadata.Title + "</em>. ",
"<em>" + self.publication.Metadata.Title + "</em>. ",
"<em>" + self.publication.Metadata.Title + "</em>. ",
];
} else {
return ["", "", ""];
Expand Down Expand Up @@ -312,7 +311,7 @@ export default class CitationModule implements ReaderModule {
if (self.properties.publisher) {
mlaString = mlaString + self.properties.publisher + ", ";
chicagoString = chicagoString + self.properties.publisher + ", ";
apaString = apaString + self.properties.publisher + ", ";
apaString = apaString + self.properties.publisher;
} else if (
self.publication.Metadata.Publisher &&
self.publication.Metadata.Publisher[0].Name
Expand All @@ -323,8 +322,7 @@ export default class CitationModule implements ReaderModule {
chicagoString +
self.publication.Metadata.Publisher[0].Name +
", ";
apaString =
apaString + self.publication.Metadata.Publisher[0].Name + ", ";
apaString = apaString + self.publication.Metadata.Publisher[0].Name;
}

if (
Expand Down Expand Up @@ -438,44 +436,47 @@ export default class CitationModule implements ReaderModule {
selectedText(selection, self.properties.characters) +
"“" +
"<br><br>" +
"<em>" +
chicago +
"</em>";
chicago;

const citationApa =
"“" +
selectedText(selection, self.properties.characters) +
"“" +
"<br><br>" +
"<em>" +
apa +
"</em>";
apa;

const citationMla =
"“" +
selectedText(selection, self.properties.characters) +
"“" +
"<br><br>" +
"<em>" +
mla +
"</em>";
mla;

let citation = "";

if (
self.properties.styles?.includes(CitationStyle[CitationStyle.Chicago])
) {
citation = citation + "Chicago: <br>" + citationChicago + "<br><br>";
if (self.properties.styles.length > 1) {
citation = citation + "Chicago: <br>";
}
citation = citation + citationChicago + "<br><br>";
}
if (
self.properties.styles?.includes(CitationStyle[CitationStyle.APA])
) {
citation = citation + "APA: <br>" + citationApa + "<br><br>";
if (self.properties.styles.length > 1) {
citation = citation + "APA: <br>";
}
citation = citation + citationApa + "<br><br>";
}
if (
self.properties.styles?.includes(CitationStyle[CitationStyle.MLA])
) {
citation = citation + "MLA: <br>" + citationMla + "<br><br>";
if (self.properties.styles.length > 1) {
citation = citation + "MLA: <br>";
}
citation = citation + citationMla + "<br><br>";
}

self.copyToClipboard(citation);
Expand Down

0 comments on commit 0ac10a0

Please sign in to comment.