-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10408 from jmchilton/author_license_2009
Microdata for tools and workflows.
- Loading branch information
Showing
43 changed files
with
7,120 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<template> | ||
<div> | ||
{{ prefix }} | ||
<span v-html="citationHtml" /> | ||
<a v-if="link" :href="link" target="_blank"> | ||
<font-awesome-icon v-b-tooltip.hover title="View Citation" icon="external-link-alt" /> | ||
</a> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; | ||
import { library } from "@fortawesome/fontawesome-svg-core"; | ||
import { faExternalLinkAlt } from "@fortawesome/free-solid-svg-icons"; | ||
library.add(faExternalLinkAlt); | ||
export default { | ||
components: { | ||
FontAwesomeIcon, | ||
}, | ||
props: { | ||
citation: { | ||
type: Object, | ||
}, | ||
outputFormat: { | ||
type: String, | ||
}, | ||
prefix: { | ||
type: String, | ||
}, | ||
}, | ||
computed: { | ||
link() { | ||
const cite = this.citation.cite; | ||
return cite.data && cite.data[0] && cite.data[0].URL; | ||
}, | ||
citationHtml() { | ||
const citation = this.citation; | ||
const cite = citation.cite; | ||
const formattedCitation = cite.format(this.outputFormat, { | ||
format: "html", | ||
template: "apa", | ||
lang: "en-US", | ||
}); | ||
return formattedCitation; | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style> | ||
.csl-bib-body { | ||
display: inline; | ||
} | ||
.csl-entry { | ||
display: inline; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import axios from "axios"; | ||
import { rethrowSimple } from "utils/simple-error"; | ||
import { getAppRoot } from "onload/loadConfig"; | ||
import Cite from "citation-js"; | ||
|
||
export async function getCitations(source, id) { | ||
try { | ||
const request = await axios.get(`${getAppRoot()}api/${source}/${id}/citations`); | ||
const rawCitations = request.data; | ||
const citations = []; | ||
for (const rawCitation of rawCitations) { | ||
try { | ||
const cite = new Cite(rawCitation.content); | ||
citations.push({ raw: rawCitation.content, cite: cite }); | ||
} catch (err) { | ||
console.warn(`Error parsing bibtex: ${err}`); | ||
} | ||
} | ||
return citations; | ||
} catch (e) { | ||
rethrowSimple(e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<template> | ||
<loading-span v-if="license == null" message="Loading license information"> </loading-span> | ||
<div class="text-muted" v-else-if="license.name"> | ||
<link itemprop="license" :href="license.licenseId" /> | ||
<span v-if="title"> | ||
{{ title }} | ||
</span> | ||
{{ license.name }} | ||
<a target="_blank" :href="license.url"> | ||
<font-awesome-icon icon="external-link-alt" /> | ||
</a> | ||
<slot name="buttons"></slot> | ||
</div> | ||
<div v-else> | ||
Unknown License (<i>{{ license.url }}</i | ||
>) | ||
<slot name="buttons"></slot> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { getAppRoot } from "onload/loadConfig"; | ||
import axios from "axios"; | ||
import LoadingSpan from "components/LoadingSpan"; | ||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; | ||
import { library } from "@fortawesome/fontawesome-svg-core"; | ||
import { faExternalLinkAlt } from "@fortawesome/free-solid-svg-icons"; | ||
library.add(faExternalLinkAlt); | ||
export default { | ||
components: { | ||
LoadingSpan, | ||
FontAwesomeIcon, | ||
}, | ||
props: { | ||
licenseId: { | ||
type: String, | ||
}, | ||
inputLicenseInfo: { | ||
type: Object, | ||
required: false, | ||
}, | ||
title: { | ||
type: String, | ||
default: null, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
license: this.inputLicenseInfo, | ||
}; | ||
}, | ||
created() { | ||
if (this.license == null) { | ||
this.fetchLicense(); | ||
} | ||
}, | ||
methods: { | ||
fetchLicense() { | ||
this.license = null; | ||
const url = `${getAppRoot()}api/licenses/${this.licenseId}`; | ||
axios | ||
.get(url) | ||
.then((response) => response.data) | ||
.then((data) => { | ||
this.license = data; | ||
}); | ||
}, | ||
}, | ||
watch: { | ||
licenseId: function (newLicense, oldLicense) { | ||
if (newLicense != oldLicense) { | ||
this.fetchLicense(); | ||
} | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style></style> |
Oops, something went wrong.