Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

papis-html: fixup and modernize code #60

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

alexfikl
Copy link

@alexfikl alexfikl commented Jul 22, 2023

This modernizes the papis-html plugin a bit to use the latest things and work with flake8.
The commits are fairly self-contained, but generally this

  • Adds and fixes all flake8 errors
  • Updates jQuery, Bootstrap, bibtex-js
  • Updates the index.html to work with Bootstrap 5 and some cleanup.

NOTE: This does not touch the Vue application in there!

return moment(x["DATE"]).format("YYYY");
}
return "";
}

Check notice

Code scanning / CodeQL

Semicolon insertion

Avoid automated semicolon insertion (95% of all statements in [the enclosing function](1) have an explicit semicolon).
// Check if authors are formatted

// Get conjunction if set in author
conjunction = format.attr('conjunction') ? format.attr('conjunction') : ', and';

Check warning

Code scanning / CodeQL

Missing variable declaration

Variable conjunction is used like a local variable, but is missing a declaration.
// Check if value is empty
if (name[index] != "") {
$(this).html($(this).html() + name[index]);
for (i = 0; i < searchLength; i++) {

Check warning

Code scanning / CodeQL

Missing variable declaration

Variable i is used like a local variable, but is missing a declaration.
var fullName = $.grep(name.slice(0, 4), Boolean).join(" ");
author.attr('class', fullName);
var textBefore = false;
for (j = 0, ele = author.find("span:not(a)"), len = ele.length; j < len; ++j) {

Check warning

Code scanning / CodeQL

Missing variable declaration

Variable j is used like a local variable, but is missing a declaration.
var fullName = $.grep(name.slice(0, 4), Boolean).join(" ");
author.attr('class', fullName);
var textBefore = false;
for (j = 0, ele = author.find("span:not(a)"), len = ele.length; j < len; ++j) {

Check warning

Code scanning / CodeQL

Missing variable declaration

Variable ele is used like a local variable, but is missing a declaration.
var fullName = $.grep(name.slice(0, 4), Boolean).join(" ");
author.attr('class', fullName);
var textBefore = false;
for (j = 0, ele = author.find("span:not(a)"), len = ele.length; j < len; ++j) {

Check warning

Code scanning / CodeQL

Missing variable declaration

Variable len is used like a local variable, but is missing a declaration.
var displayTuples = [];
if (bibtexField == "author") {
$(".bibtexentry span.author").each(function(i, obj) {
authors = $(this).children("span:not(.bibtex_js_conjunction)");

Check warning

Code scanning / CodeQL

Missing variable declaration

Variable authors is used like a local variable, but is missing a declaration.
if (bibtexField == "author") {
$(".bibtexentry span.author").each(function(i, obj) {
authors = $(this).children("span:not(.bibtex_js_conjunction)");
authorLength = authors.length;

Check warning

Code scanning / CodeQL

Missing variable declaration

Variable authorLength is used like a local variable, but is missing a declaration.
}
} else {
$(".bibtexentry span." + bibtexField).each(function(i, obj) {
arrayString = [$(this).text()];

Check warning

Code scanning / CodeQL

Missing variable declaration

Variable arrayString is used like a local variable, but is missing a declaration.
@alexfikl
Copy link
Author

This is how the generated page looks now:

Screenshot_20230722_201520

Comment on lines +36 to +37
"papis", "html", "bibtex", "javascript"
"management", "cli", "biliography"

Check warning

Code scanning / CodeQL

Implicit string concatenation in a list

Implicit string concatenation. Maybe missing a comma?
@alexfikl
Copy link
Author

@alejandrogallo What do you think about updating this? It's very very simple compared to papis serve, but it's a nice example plugin if nothing else 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant