Skip to content

Instantly share code, notes, and snippets.

@njahn82
Created November 29, 2012 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save njahn82/4167606 to your computer and use it in GitHub Desktop.
Save njahn82/4167606 to your computer and use it in GitHub Desktop.
Brew template for ORCID publication listings
<!DOCTYPE html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<!-- Set the viewport width to device width for mobile -->
<meta name="viewport" content="width=device-width" />
<title>RORCID demo</title>
<!-- Included CSS Files (Uncompressed) -->
<!--
<link rel="stylesheet" href="stylesheets/foundation.css">
-->
<!-- Included CSS Files (Compressed) -->
<link rel="stylesheet" href="stylesheets/foundation.min.css">
<link rel="stylesheet" href="stylesheets/app.css">
<script src="javascripts/modernizr.foundation.js"></script>
<!-- IE Fix for HTML5 Tags -->
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="row">
<div class="twelve columns">
<h2>Publications</h2>
<h6>Martin Fenner <a href="https://orcid.org/0000-0003-1419-2405">ORCID:0000-0003-1419-2405</a></h6>
<hr />
</div>
</div>
<div class="row">
<div class="eight columns">
<%
library(httr)
library(XML)
library(RJSONIO)
tt <- fromJSON("http://sciencecard.org/api/v3/users/0000-0003-1419-2405?info=summary")
doi <- c()
for (i in 1 : length(tt$user$articles)) {
doi.tmp <- tt$user$articles[[i]]$article$doi
date.tmp <- tt$user$articles[[i]]$article$publication_date
doi <- c(doi,doi.tmp)
}
my.cites <- data.frame()
for (i in doi) {
csl.tmp <- content(GET(paste("http://dx.doi.org/",i, sep=""), add_headers(Accept = "text/x-bibliography;style=harvard3")))
doi.xml <- GET(paste("http://dx.doi.org/",i, sep=""),
add_headers(Accept = "Accept: application/vnd.crossref.unixref+xml;q=1, application/rdf+xml;q=0.5"))
doc <- xmlTreeParse(doi.xml, useInternal = T)
year.tmp <- as.numeric(xpathSApply (doc,"//publication_date//year",xmlValue) [1])
tmp <- data.frame(csl.tmp,year.tmp,i)
my.cites <- rbind(my.cites,tmp)
}
my.cites <- my.cites[unique(my.cites$i),]
my.cites <- my.cites[rev(order(my.cites$year.tmp)),]
cites <- c()
for (i in 1:nrow(my.cites)) {
cite <- paste('<p>',as.character(my.cites$csl.tmp)[i],'</br>DOI: <a href="http://dx.doi.org/',as.character(my.cites$i)[i],'">',as.character(my.cites$i)[i],'</a></p>',sep="")
cat(cite)
}
%>
</div>
<div class="three columns">
<h6>About</h6>
<p>The aim of this webpage is to demonstrate a better showcase of publications claimed as part of ORCID profiles.</p>
<p> The underlying R code queries <a href="http://sciencecard.org/">Sciencecard</a> for a given ORCID and returns the DOI for each publication. It, then, requests the CSL representation and metadata provided by <a href="http://www.crosscite.org/cn/">CrossCite</a>.</p>
<h6>Built with</h6>
<p><a href="http://www.r-project.org/"><img src="http://www.r-project.org/Rlogo.jpg"></a></p><p> Packages used: <a href="http://cran.r-project.org/web/packages/XML/index.html">XML</a>, <a href="http://cran.r-project.org/web/packages/RJSONIO/index.html">RJSONIO</a>, <a href="http://cran.r-project.org/web/packages/httr/">httr</a> and <a href="http://cran.r-project.org/web/packages/brew/index.html">Brew</a>. Styled with <a href="http://foundation.zurb.com/">Foundation</a>.</p>
</div>
</div>
<!-- Included JS Files (Uncompressed) -->
<!--
<script src="javascripts/modernizr.foundation.js"></script>
<script src="javascripts/jquery.js"></script>
<script src="javascripts/jquery.foundation.mediaQueryToggle.js"></script>
<script src="javascripts/jquery.foundation.reveal.js"></script>
<script src="javascripts/jquery.foundation.orbit.js"></script>
<script src="javascripts/jquery.foundation.navigation.js"></script>
<script src="javascripts/jquery.foundation.buttons.js"></script>
<script src="javascripts/jquery.foundation.tabs.js"></script>
<script src="javascripts/jquery.foundation.forms.js"></script>
<script src="javascripts/jquery.foundation.tooltips.js"></script>
<script src="javascripts/jquery.foundation.accordion.js"></script>
<script src="javascripts/jquery.placeholder.js"></script>
<script src="javascripts/jquery.foundation.alerts.js"></script>
-->
<!-- Included JS Files (Compressed) -->
<script src="javascripts/foundation.min.js"></script>
<!-- Initialize JS Plugins -->
<script src="javascripts/app.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment