mirror of
https://github.com/wassname/template.git
synced 2026-07-24 13:20:06 +08:00
small fixes to meta
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import fetch from "fetch";
|
||||
let fetchUrl = fetch.fetchUrl
|
||||
|
||||
export default function(dom, data) {
|
||||
|
||||
var includeTags = [].slice.apply(dom.querySelectorAll("dt-include"));
|
||||
|
||||
includeTags.forEach(el => {
|
||||
let src = el.getAttribute("src");
|
||||
fetchUrl(src, (err, meta, body) => {
|
||||
console.log(err, meta, body);
|
||||
el.innerHTML = body.toString();
|
||||
})
|
||||
});
|
||||
data.bibliography = bibliography;
|
||||
data.citations = citations;
|
||||
|
||||
}
|
||||
+10
-6
@@ -51,23 +51,27 @@ export default function(dom, data) {
|
||||
<!-- https://scholar.google.com/intl/en/scholar/inclusion.html#indexing -->
|
||||
`);
|
||||
|
||||
let journal = data.journal || {};
|
||||
let zeroPad = (n) => { return n < 10 ? "0" + n : n; };
|
||||
let publishedYear = data.published.getFullYear();
|
||||
let publishedMonthPadded = zeroPad(data.published.getMonth() + 1);
|
||||
let publishedDayPadded = zeroPad(data.published.getDate());
|
||||
meta("citation_title", data.title);
|
||||
meta("citation_publication_date", data.published? `${publishedYear}/${publishedMonthPadded}/${publishedDayPadded}` : undefined);
|
||||
meta("citation_fulltext_html_url", data.url);
|
||||
meta("citation_volume", data.volume);
|
||||
meta("citation_issue", data.issue);
|
||||
meta("citation_firstpage", data.doiSuffix? `e${data.doiSuffix}` : undefined);
|
||||
meta("citation_doi", data.doi);
|
||||
|
||||
let journal = data.journal || {};
|
||||
meta("citation_journal_title", journal.name);
|
||||
meta("citation_journal_abbrev", journal.nameAbbrev);
|
||||
meta("citation_issn", journal.issn);
|
||||
meta("citation_publisher", journal.publisher);
|
||||
|
||||
if (data.published){
|
||||
let zeroPad = (n) => { return n < 10 ? "0" + n : n; };
|
||||
let publishedYear = data.published.getFullYear();
|
||||
let publishedMonthPadded = zeroPad(data.published.getMonth() + 1);
|
||||
let publishedDayPadded = zeroPad(data.published.getDate());
|
||||
meta("citation_publication_date", `${publishedYear}/${publishedMonthPadded}/${publishedDayPadded}`);
|
||||
}
|
||||
|
||||
(data.authors || []).forEach((a) => {
|
||||
meta("citation_author", `${a.lastName}, ${a.firstName}`);
|
||||
meta("citation_author_institution", a.affiliation);
|
||||
|
||||
Reference in New Issue
Block a user