10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 22:03:49 +01:00

Add custom output for publication

This commit is contained in:
Mickaël Véril 2019-10-06 17:31:40 +02:00
parent e700ecc396
commit 654922aaf4
3 changed files with 107 additions and 15 deletions

View File

@ -3,6 +3,7 @@ title: "Papers"
date: 2019-09-30 11:30 date: 2019-09-30 11:30
draft: false draft: false
--- ---
<link rel="stylesheet" type="text/css" href="/css/paper.css" />
<script src="/scripts/data.js" type="text/javascript"></script> <script src="/scripts/data.js" type="text/javascript"></script>
<script src="/scripts/loadAllData.js" type="text/javascript"></script> <script src="/scripts/loadAllData.js" type="text/javascript"></script>
<script src="/scripts/getFullDataPath.js" type="text/javascript"></script> <script src="/scripts/getFullDataPath.js" type="text/javascript"></script>
@ -14,20 +15,60 @@ draft: false
<script> <script>
window.onload = async function () { window.onload = async function () {
var div=document.getElementById("papers_div") var div=document.getElementById("papers_div")
var Cite = require("citation-js") const Cite = require("citation-js")
var dois =uniq(Object.values(await loadAllData()).flat().map(d => d.DOI)) const dois =uniq(Object.values(await loadAllData()).flat().map(d => d.DOI.string))
for (doi of dois) { const publiscite = await Cite.async(dois)
var publi = await Cite.async(doi.string) const publis=publiscite.format('data', {format: 'object'})
var output = publi.format('bibliography', { for (const publi of publis){
format: 'html', const art=document.createElement("article")
template: 'apa', art.className="paper"
lang: 'en-US' const titlelink=document.createElement("a")
}) const titleh=document.createElement("h1")
lnk = document.createElement("a") titleh.innerText=publi.title
lnk.innerHTML = output titlelink.appendChild(titleh)
lnk.target = '_blank' titlelink.href=publi.URL
lnk.href = doi.url art.appendChild(titlelink)
div.appendChild(lnk) const authors=publi.author
const ulauths=document.createElement("ul")
ulauths.className="authors-list"
for(const author of authors){
const liauth=document.createElement("li")
const spanAuth=document.createElement("span")
spanAuth.innerText=String.raw`${author.given} ${author.family}`
liauth.appendChild(spanAuth)
if(author.sequence==="first"){
star=document.createElement("strong")
star.innerText="*"
liauth.appendChild(star)
}
var notifycontent=document.createElement("div")
for(const a of author.affiliation){
var div=document.createElement("div")
div.innerText=a.name
notifycontent.className="author-info"
notifycontent.appendChild(div)
}
if(author["authenticated-orcid"]){
const html=$.parseHTML(String.raw`<div class="orcid-id"><a href="https://orcid.org" target="_blank"><img alt="ORCID logo" src="https://orcid.org/sites/default/files/images/orcid_16x16.png" width="16" height="16"/></a> <a href="${author.ORCID}" target="_blank">${author.ORCID} </a></div>`)
notifycontent.appendChild(html[0])
}
tippy(spanAuth, {
content: notifycontent,
theme: 'light',
interactive: true,
});
ulauths.appendChild(liauth)
}
art.appendChild(ulauths)
const journaldiv=document.createElement("div")
journaldiv.innerText=(("container-title-short" in publi) ? publi["container-title-short"] : publi["container-title"])
journaldiv.innerText+=publi.issued["date-parts"][0][0]
journaldiv.innerHTML+=String.raw` ${publi.volume}(${publi.issue}), ${publi.page}`
art.appendChild(journaldiv)
const doilink=document.createElement("a")
doilink.href=publi.URL
doilink.innerText=String.raw`DOI: ${publi.URL}`
document.getElementById("papers_div").appendChild(art)
} }
} }
</script> </script>

View File

@ -1,3 +1,7 @@
<script src="https://unpkg.com/popper.js@1"></script>
<link rel="stylesheet" href="https://unpkg.com/tippy.js@5/dist/backdrop.css" />
<link rel="stylesheet" href="https://unpkg.com/tippy.js@5/themes/light.css" />
<script src="https://unpkg.com/tippy.js@5"></script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script> <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script type="text/javascript" id="MathJax-script" async <script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"> src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">

47
static/css/paper.css Normal file
View File

@ -0,0 +1,47 @@
.paper h1 {
font-size: 20pt
}
.paper ul.authors-list {
list-style: none;
margin: 0;
padding: 0;
border: 0
}
.paper ul.authors-list li{
display: inline
}
.paper ul.authors-list li strong.star{
font-weight: bold;
}
.paper ul.authors-list li:after
{
content: ", "
}
.paper ul.authors-list li:nth-last-child(2):after
{
content: " and "
}
.paper ul.authors-list li:last-child:after
{
content: ""
}
.orcid-id img {
vertical-align: middle;
float: left;
margin-right: 4px;
}
.orcid-id a {
vertical-align: middle;
display: inline;
}
.author-info {
font-size: 18x
}