Skip to content

Commit bc96a23

Browse files
author
Skender Gashi
committed
readded the chart plot of the publications
1 parent 91e2701 commit bc96a23

File tree

5 files changed

+102
-38
lines changed

5 files changed

+102
-38
lines changed

_includes/head.html

+1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@
2121
<script src="/assets/js/vendor/bootstrap/popover.js"></script>
2222
<script src="/assets/js/vendor/jquery.githubRepoWidget.js"></script>
2323
<script src="/assets/js/custom.js"></script>
24+
<script src="/assets/js/bib_stats.js"></script>
2425
</head>

_sass/main.scss

+11-10
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,17 @@ $fa-font-path: "../fonts/font-awesome";
7272
// }
7373
// }
7474

75-
// @media(min-width: $screen-sm-min) {
76-
// #pint-pubs-chart {
77-
// width: 100%;
78-
// }
79-
// }
80-
// @media(min-width: $screen-md-min) {
81-
// #pint-pubs-chart {
82-
// width: 700px;
83-
// }
84-
// }
75+
@media(min-width: 600px) {
76+
#pint-pubs-chart {
77+
width: 100%;
78+
}
79+
}
80+
81+
@media(min-width: 900px) {
82+
#pint-pubs-chart {
83+
width: 700px;
84+
}
85+
}
8586

8687
// .ref-label {
8788
// width: 100%;

assets/js/bib_stats.js

+56-27
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,43 @@
1-
$(document).ready(function() {
1+
var years_counts = {};
2+
3+
$(document).ready(function () {
24
//
35
// Generate Links to Years
46
//
5-
var toc_html = '';
6-
$('h2').each(function() {
7-
if ($(this).attr('id') && $(this).attr('id').match(/year/g)) {
8-
toc_html += '<li><a href="#'+$(this).attr('id')+'">'+$(this).clone().children().remove().end().text()+'</a></li>';
7+
var toc_html = "";
8+
$("h2").each(function () {
9+
if ($(this).attr("id") && $(this).attr("id").match(/year/g)) {
10+
toc_html +=
11+
'<li><a href="#' +
12+
$(this).attr("id") +
13+
'">' +
14+
$(this).clone().children().remove().end().text() +
15+
"</a></li>";
916
}
1017
});
11-
$('.dropdown-menu.years').html(toc_html);
18+
$(".dropdown-menu.years").html(toc_html);
1219

1320
//
1421
// Gather Publications-by-Year Statistics
1522
//
1623
var yc_prelim = {};
17-
var min_year = 9999, max_year = 0;
18-
$('#total-num-pubs').text("Total number of publications: " + $('li pre.abstract').length);
19-
$('#total-num-pubs').addClass('alert alert-info');
24+
var min_year = 9999,
25+
max_year = 0;
26+
$("#total-num-pubs").text(
27+
"Total number of publications: " + $("li pre.abstract").length
28+
);
29+
$("#total-num-pubs").addClass("alert alert-info");
2030

21-
$('li pre.abstract').each(function() {
31+
$("li pre.abstract").each(function () {
2232
var abstract_text = $(this).text().toString();
23-
var matched = abstract_text.match(/year = .*/g).join('');
24-
var year = parseInt(matched.match(/[0-9]+/g).join(''));
25-
if (year < min_year) { min_year = year; }
26-
if (year > max_year) { max_year = year; }
33+
var matched = abstract_text.match(/year = .*/g).join("");
34+
var year = parseInt(matched.match(/[0-9]+/g).join(""));
35+
if (year < min_year) {
36+
min_year = year;
37+
}
38+
if (year > max_year) {
39+
max_year = year;
40+
}
2741
if (year in yc_prelim) {
2842
yc_prelim[year] = yc_prelim[year] + 1;
2943
} else {
@@ -32,7 +46,6 @@ $(document).ready(function() {
3246
});
3347
var years = [];
3448
var counts = [];
35-
var years_counts = {};
3649
for (var y = min_year; y <= max_year; ++y) {
3750
years.push(y);
3851
if (y in yc_prelim) {
@@ -47,9 +60,9 @@ $(document).ready(function() {
4760
//
4861
// Gather statistics per section
4962
//
50-
$('ol').each(function() {
51-
var count = $(this).children('li').length;
52-
$(this).prev('h2').children('.count-stat').addClass('badge').text(count);
63+
$("ol").each(function () {
64+
var count = $(this).children("li").length;
65+
$(this).prev("h2").children(".count-stat").addClass("badge").text(count);
5366
});
5467

5568
//
@@ -63,9 +76,9 @@ $(document).ready(function() {
6376
datasets: [
6477
{
6578
label: "Number Publications per Year",
66-
data: counts
67-
}
68-
]
79+
data: counts,
80+
},
81+
],
6982
};
7083
var options = {
7184
//Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value
@@ -89,16 +102,32 @@ $(document).ready(function() {
89102
//Number - Spacing between data sets within X values
90103
barDatasetSpacing: 0,
91104
//String - A legend template
92-
legendTemplate : "{% raw %}<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].fillColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>{% endraw %}"
105+
legendTemplate:
106+
'{% raw %}<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].fillColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>{% endraw %}',
93107
};
94108
Chart.defaults.global.responsive = false;
95109
Chart.defaults.global.maintainAspectRatio = false;
96110
Chart.defaults.global.tooltipXOffset = 0;
97111
Chart.defaults.global.tooltipYOffset = 0;
98112
var pint_pub_chart = new Chart(ctx).Bar(data, options);
99-
$("#stats-buttons").append('<div class="btn-group btn-group-xs" role="group"><button class="btn btn-xs btn-default" data-toggle="collapse" data-target="#chart-raw-data" aria-expanded="false" aria-controls="#chart-raw-data">JSON data of plot</button></div>');
100-
$("#chart-raw-data").html('<pre>'+JSON.stringify(years_counts, null, 2)+'</pre>');
101-
$("#image-download-docu").text('To download the plot and use it in your publications, right-click it. It is licensed under a Creative Commons Attribution 3.0 license. If you use the BibTex file or figure in a publication, a reference to this website would be much appreciated.');
113+
$("#stats-buttons").append(
114+
'<div role="group"><button class="button" onclick="appendJsonToModal()" data-toggle="modal" data-target="#json-modal">JSON data of plot</button></div>'
115+
);
116+
$("#chart-raw-data").html(
117+
"<pre>" + JSON.stringify(years_counts, null, 2) + "</pre>"
118+
);
119+
$("#image-download-docu").text(
120+
"To download the plot and use it in your publications, right-click it. It is licensed under a Creative Commons Attribution 3.0 license. If you use the BibTex file or figure in a publication, a reference to this website would be much appreciated."
121+
);
122+
123+
$(".year-btn-group").removeClass("hidden");
124+
});
125+
126+
function appendJsonToModal() {
127+
console.log("IT GOT TRIGGERED BROOO");
128+
console.log(years_counts);
129+
$("#chart-raw-data").html(
130+
"<pre>" + JSON.stringify(years_counts, null, 2) + "</pre>"
131+
);
132+
}
102133

103-
$('.year-btn-group').removeClass('hidden');
104-
});

references/index.html

+14-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,20 @@ <h2>Statistics</h2>
3131
</a>
3232
</div>
3333
<p id="image-download-docu" class="hidden-xs text-muted"></p>
34-
<div id="chart-raw-data" class="collapse"></div>
34+
<div class="modal" id="json-modal">
35+
<div class="modal-background"></div>
36+
<div class="modal-card">
37+
<header class="modal-card-head">
38+
<div style="display: flex; justify-content: end; width: 100%;">
39+
<button type="button" class="delete" data-dismiss="modal" aria-label="Close"><span
40+
aria-hidden="true">&times;</span></button>
41+
</div>
42+
</header>
43+
<section class="modal-card-body">
44+
<div id="chart-raw-data"></div>
45+
</section>
46+
</div>
47+
</div>
3548
</div>
3649
</div>
3750
<div class="row">

workflows.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Workflows
2+
3+
This project uses many different workflows to make the development easier and more efficient. This document describes the workflows and how to use them.
4+
5+
## I. [publish.yml](./.github/workflows/publish.yml)
6+
7+
This Workflow publishes the page to GitHub Pages. It is triggered by a push to the `source` branch.
8+
9+
## II. [issue_to_bib.yml](./.github/workflows/issue_to_bib.yml)
10+
11+
Converts the issue to a bibtex entry and adds it to the `pint.bib` file. It is triggered by a new issue that is labeled.
12+
13+
## III. [arxiv_to_publications_correct.yml](./.github/workflows/arxiv_to_publications_correct.yml)
14+
15+
This workflow is triggered when a new issue is opened with the label "food for arxivbot". It runs the script arxiv_to_publications_correct.py, which looks for bibtex entries that now have a Digital Object Identifier (DOI). If it finds any, it creates a pull request with the updated bibtex file. It also adds a comment to the issue with the output of the script.
16+
17+
18+
## IV. [arxiv_to_publications_detect.yml](./.github/workflows/arxiv_to_publications_detect.yml)
19+
20+
This workflow is used to detect DOIs for unpublished results. It uses the title of the unpublished result and queries the Crossref API. If the similarity between the title of the unpublished result and the title of the result returned by the Crossref API is above 0.9, the result is printed to the console. The output can be used to update the bibtex file.

0 commit comments

Comments
 (0)