more work on citations

This commit is contained in:
Christopher Olah
2017-01-10 12:42:59 -08:00
parent 9c40d08edd
commit 712d859dad
4 changed files with 198 additions and 39 deletions
+68 -34
View File
@@ -15,9 +15,10 @@ export default function(dom, data) {
var cite_string = inline_cite_short(keys);
var cite_hover_str = "";
keys.map((key,n) => {
if (n>0) cite_hover_str += "<br>";
cite_hover_str += bibliography_cite(data.bibliography[key], true);
if (n>0) cite_hover_str += "<br><br>";
cite_hover_str += hover_cite(data.bibliography[key]);
});
cite_hover_str = cite_hover_str.replace(/"/g, "&#39;")
el.innerHTML = `<span id="citation-${n}" class="citation" data-hover="${cite_hover_str}">${cite_string}</span>`;
}
});
@@ -62,41 +63,52 @@ export default function(dom, data) {
return keys.map(cite_string).join(", ");
}
function author_string(ent, template, sep, finalSep){
var names = ent.author.split(" and ");
let name_strings = names.map(name => {
var last = name.split(",")[0].trim();
var firsts = name.split(",")[1];
var initials = "";
if (firsts != undefined) {
initials = firsts.trim().split(" ").map(s => s.trim()[0]);
initials = initials.join(".")+".";
}
return template.replace("F", firsts)
.replace("L", last)
.replace("I", initials);
});
if (names.length > 1) {
var str = name_strings.slice(0, names.length-1).join(sep);
str += (finalSep || sep) + name_strings[names.length-1];
return str;
} else {
return name_strings[0];
}
}
function venue_string(ent) {
var cite = (ent.journal || ent.booktitle || "")
if ("volume" in ent){
var issue = ent.issue || ent.number;
issue = (issue != undefined)? "("+issue+")" : "";
cite += ", Vol " + ent.volume + issue;
}
if ("pages" in ent){
cite += ", pp. " + ent.pages
}
cite += ". "
if ("publisher" in ent){
cite += ent.publisher + ".";
}
return cite;
}
function bibliography_cite(ent, fancy){
if (ent){
var names = ent.author.split(" and ");
var cite = "";
let name_strings = names.map(name => {
var last = name.split(",")[0].trim();
var firsts = name.split(",")[1];
if (firsts != undefined) {
var initials = firsts.trim().split(" ").map(s => s.trim()[0]);
return last + ", " + initials.join(".")+".";
}
return last;
});
if (names.length > 1) {
cite += name_strings.slice(0, names.length-1).join(", ");
cite += " and " + name_strings[names.length-1];
} else {
cite += name_strings[0]
}
var cite = author_string(ent, "L, I", ", ", " and ");
cite += ", " + ent.year + ". "
if (fancy){
cite += "<b>" + ent.title + "</b>. "
} else {
cite += ent.title + ". "
}
cite += (ent.journal || ent.booktitle || "")
if ("volume" in ent){
var issue = ent.issue || ent.number;
issue = (issue != undefined)? "("+issue+")" : "";
cite += ", Vol " + ent.volume + issue;
}
if ("pages" in ent){
cite += ", pp. " + ent.pages
}
cite += ". "
cite += ent.title + ". ";
cite += venue_string(ent);
if (fancy && ent.url && ent.url.slice(-4) == ".pdf") {
cite = `${cite} <a href="${ent.url}">[pdf]</a>`
}
@@ -106,6 +118,28 @@ export default function(dom, data) {
}
}
function hover_cite(ent){
if (ent){
var cite = "";
cite += "<b>" + ent.title + "</b>";
if (ent.url && ent.url.slice(-4) == ".pdf") {
cite = `${cite} &ensp;<a href="${ent.url}" style="text-decoration:inherit"><b>[PDF]</b></a>`
}
if (ent.url && ent.url.slice(-5) == ".html") {
cite = `${cite} &ensp;<a href="${ent.url}" style="text-decoration:inherit"><b>[HTML]</b></a>`
}
cite += "<br>"
cite += author_string(ent, "I L", ", ") + ".<br>";
cite += venue_string(ent).trim() + " " + ent.year + ". "
if ("doi" in ent) {
cite += `<br> <a href="https://doi.org/${ent.doi}" style="text-decoration:inherit; font-size: 80%;">DOI: ${ent.doi}</a>`
}
return cite
} else {
return "?";
}
}
//https://scholar.google.com/scholar?q=allintitle%3ADocument+author%3Aolah
function get_URL(ent){
+2 -2
View File
@@ -32,8 +32,8 @@ function DistillHoverBox(key, pos){
top: ${top}px;
left: ${left}px;
padding: ${padding}px;
border-radius: ${pretty? 6 : 0}px;
box-shadow: 0px 0px 18px 6px #777;" >
border-radius: ${pretty? 3 : 0}px;
box-shadow: 0px 0px 18px 3px #777;" >
${DistillHoverBox.contentMap[key]}
</div>`;
+5
View File
@@ -11,6 +11,11 @@ body {
margin: 0;
}
dt-article .citation {
color: #668;
cursor: pointer;
}
/*
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+123 -3
View File
@@ -18,16 +18,136 @@
<h2>A description of the article</h2>
<dt-byline></dt-byline>
<p>This is the first paragraph of the article.</p>
<p>We can also cite <dt-cite key="gregor2015draw"></dt-cite> external publications.</p>
<p>We can also cite <dt-cite key="gregor2015draw,mercier2011humans"></dt-cite> external publications. <dt-cite key="dong2014image,dumoulin2016guide,mordvintsev2015inceptionism"></dt-cite></p>
</dt-article>
<script type="text/bibliography">
@article{gregor2015draw,
title={DRAW: A recurrent neural network for image generation},
author={Gregor, Karol and Danihelka, Ivo and Graves, Alex and Rezende, Danilo Jimenez and Wierstra, Daan},
journal={arXivreprint arXiv:1502.04623},
year={2015}
journal={arXiv preprint arXiv:1502.04623},
year={2015},
url ={https://arxiv.org/pdf/1502.04623.pdf}
}
@article{mercier2011humans,
title={Why do humans reason? Arguments for an argumentative theory},
author={Mercier, Hugo and Sperber, Dan},
journal={Behavioral and brain sciences},
volume={34},
number={02},
pages={57--74},
year={2011},
publisher={Cambridge Univ Press},
doi={10.1017/S0140525X10000968}
}
@article{dong2014image,
title={Image super-resolution using deep convolutional networks},
author={Dong, Chao and Loy, Chen Change and He, Kaiming and Tang, Xiaoou},
journal={arXiv preprint arXiv:1501.00092},
year={2014},
url={https://arxiv.org/pdf/1501.00092.pdf}
}
@article{dumoulin2016adversarially,
title={Adversarially Learned Inference},
author={Dumoulin, Vincent and Belghazi, Ishmael and Poole, Ben and Lamb, Alex and Arjovsky, Martin and Mastropietro, Olivier and Courville, Aaron},
journal={arXiv preprint arXiv:1606.00704},
year={2016},
url={https://arxiv.org/pdf/1606.00704.pdf}
}
@article{dumoulin2016guide,
title={A guide to convolution arithmetic for deep learning},
author={Dumoulin, Vincent and Visin, Francesco},
journal={arXiv preprint arXiv:1603.07285},
year={2016},
url={https://arxiv.org/pdf/1603.07285.pdf}
}
@article{donahue2016adversarial,
title={Adversarial Feature Learning},
author={Donahue, Jeff and Kr{\"a}henb{\"u}hl, Philipp and Darrell, Trevor},
journal={arXiv preprint arXiv:1605.09782},
year={2016},
url={https://arxiv.org/pdf/1605.09782.pdf}
}
@article{gauthier2014conditional,
title={Conditional generative adversarial nets for convolutional face generation},
author={Gauthier, Jon},
journal={Class Project for Stanford CS231N: Convolutional Neural Networks for Visual Recognition, Winter semester},
volume={2014},
year={2014},
url={http://www.foldl.me/uploads/papers/tr-cgans.pdf}
}
@article{henaff2015geodesics,
title={Geodesics of learned representations},
author={H{\'e}naff, Olivier J and Simoncelli, Eero P},
journal={arXiv preprint arXiv:1511.06394},
year={2015},
url={https://arxiv.org/pdf/1511.06394.pdf}
}
@article{johnson2016perceptual,
title={Perceptual losses for real-time style transfer and super-resolution},
author={Johnson, Justin and Alahi, Alexandre and Fei-Fei, Li},
journal={arXiv preprint arXiv:1603.08155},
year={2016},
url={https://arxiv.org/pdf/1603.08155.pdf}
}
@article{mordvintsev2015inceptionism,
title={Inceptionism: Going deeper into neural networks},
author={Mordvintsev, Alexander and Olah, Christopher and Tyka, Mike},
journal={Google Research Blog},
year={2015},
url={https://research.googleblog.com/2015/06/inceptionism-going-deeper-into-neural.html}
}
@misc{mordvintsev2016deepdreaming,
title={DeepDreaming with TensorFlow},
author={Mordvintsev, Alexander},
year={2016},
url={https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/deepdream/deepdream.ipynb},
}
@article{radford2015unsupervised,
title={Unsupervised representation learning with deep convolutional generative adversarial networks},
author={Radford, Alec and Metz, Luke and Chintala, Soumith},
journal={arXiv preprint arXiv:1511.06434},
year={2015},
url={https://arxiv.org/pdf/1511.06434.pdf}
}
@inproceedings{salimans2016improved,
title={Improved techniques for training gans},
author={Salimans, Tim and Goodfellow, Ian and Zaremba, Wojciech and Cheung, Vicki and Radford, Alec and Chen, Xi},
booktitle={Advances in Neural Information Processing Systems},
pages={2226--2234},
year={2016},
url={https://arxiv.org/pdf/1606.03498.pdf}
}
@article{shi2016deconvolution,
title={Is the deconvolution layer the same as a convolutional layer?},
author={Shi, Wenzhe and Caballero, Jose and Theis, Lucas and Huszar, Ferenc and Aitken, Andrew and Ledig, Christian and Wang, Zehan},
journal={arXiv preprint arXiv:1609.07009},
year={2016},
url={https://arxiv.org/pdf/1609.07009.pdf}
}
@inproceedings{shi2016real,
title={Real-time single image and video super-resolution using an efficient sub-pixel convolutional neural network},
author={Shi, Wenzhe and Caballero, Jose and Husz{\'a}r, Ferenc and Totz, Johannes and Aitken, Andrew P and Bishop, Rob and Rueckert, Daniel and Wang, Zehan},
booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
pages={1874--1883},
year={2016},
url={https://arxiv.org/pdf/1609.05158.pdf},
doi={10.1109/cvpr.2016.207}
}
</script>
<dt-appendix>
<h3>Contributions</h3>