Skip to content

Conversation

@kousu
Copy link

@kousu kousu commented Nov 28, 2025

The linter has not been run on this file in ages, because ./lint.sh only lints changes, and the lint rules have gotten a lot stricter in the meantime.

The linter has not been run on this file in ages, because ./lint.sh
only lints changes, and the lint rules have gotten a lot stricter in
the meantime.
@@ -48,11 +48,11 @@ function detectImport() {
var chr = "";
var charsRead = 0;

var re = /^\s*@[a-zA-Z]+[\(\{]/;
var re = /^\s*@[a-zA-Z]+[({]/;
Copy link
Author

@kousu kousu Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were a bunch of regex errors reported. I fixed them all as far as I can tell but REs are touchy. Please take a second look before committing.

};


var strings = {};
var keyRe = /[a-zA-Z0-9\-]/;
var keyRe = /[a-zA-Z0-9-]/;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Comment on lines +1254 to +1257
var newStr = str.replace(/[|<>~^\\{}]/g, function (c) {
return alwaysMap[c];
})
.replace(/([#$%&_])/g, "\\$1");
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto


var numberRe = /^[0-9]+/;
// Below is a list of words that should not appear as part of the citation key
// it includes the indefinite articles of English, German, French and Spanish, as well as a small set of English prepositions whose
// force is more grammatical than lexical, i.e. which are likely to strike many as 'insignificant'.
// The assumption is that most who want a title word in their key would prefer the first word of significance.
// Also remove markup
var citeKeyTitleBannedRe = /\b(a|an|the|some|from|on|in|to|of|do|with|der|die|das|ein|eine|einer|eines|einem|einen|un|une|la|le|l\'|les|el|las|los|al|uno|una|unos|unas|de|des|del|d\')(\s+|\b)|(<\/?(i|b|sup|sub|sc|span style=\"small-caps\"|span)>)/g;
var citeKeyTitleBannedRe = /\b(a|an|the|some|from|on|in|to|of|do|with|der|die|das|ein|eine|einer|eines|einem|einen|un|une|la|le|l'|les|el|las|los|al|uno|una|unos|unas|de|des|del|d')(\s+|\b)|(<\/?(i|b|sup|sub|sc|span style="small-caps"|span)>)/g;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@@ -1316,7 +1405,7 @@ function buildCiteKey (item, extraFields, citekeys) {

basekey = tidyAccents(basekey);
// use legacy pattern for all old items to not break existing usages
var citeKeyCleanRe = /[^a-z0-9\!\$\&\*\+\-\.\/\:\;\<\>\?\[\]\^\_\`\|]+/g;
var citeKeyCleanRe = /[^a-z0-9!$&*+\-./:;<>?[\]^_`|]+/g;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Comment on lines +1189 to +1196
characters = characters.replace(/\{\\textless}i\{\\textgreater}(.+?)\{\\textless}\/i{\\textgreater}/g, "\\textit{$1}")
.replace(/\{\\textless}b\{\\textgreater}(.+?)\{\\textless}\/b{\\textgreater}/g, "\\textbf{$1}");
//sub and superscript
characters = characters.replace(/\{\\textless\}sup\{\\textgreater\}(.+?)\{\\textless\}\/sup{\\textgreater\}/g, "\$^{\\textrm{$1}}\$")
.replace(/\{\\textless\}sub\{\\textgreater\}(.+?)\{\\textless\}\/sub\{\\textgreater\}/g, "\$_{\\textrm{$1}}\$");
characters = characters.replace(/\{\\textless}sup\{\\textgreater}(.+?)\{\\textless}\/sup{\\textgreater}/g, "$^{\\textrm{$1}}$")
.replace(/\{\\textless}sub\{\\textgreater}(.+?)\{\\textless}\/sub\{\\textgreater}/g, "$_{\\textrm{$1}}$");
//two variants of small caps
characters = characters.replace(/\{\\textless\}span\sstyle=\"small\-caps\"\{\\textgreater\}(.+?)\{\\textless\}\/span{\\textgreater\}/g, "\\textsc{$1}")
.replace(/\{\\textless\}sc\{\\textgreater\}(.+?)\{\\textless\}\/sc\{\\textgreater\}/g, "\\textsc{$1}");
characters = characters.replace(/\{\\textless}span\sstyle="small-caps"\{\\textgreater}(.+?)\{\\textless}\/span{\\textgreater}/g, "\\textsc{$1}")
.replace(/\{\\textless}sc\{\\textgreater}(.+?)\{\\textless}\/sc\{\\textgreater}/g, "\\textsc{$1}");
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

especially check this block

Comment on lines +1212 to +1218
tex = tex.replace(/\\textit\{([^}]+})/g, "<i>$1</i>").replace(/\\textbf\{([^}]+})/g, "<b>$1</b>");
//two versions of subscript the .* after $ is necessary because people m
tex = tex.replace(/\$([^\{\$]*)_\{([^\}]+)\}\$/g, sub).replace(/\$([^\{\$]*)_\{\\textrm\{([^\}\$]+)\}\}\$/g, sub);
tex = tex.replace(/\$([^{$]*)_\{([^}]+)}\$/g, sub).replace(/\$([^{$]*)_\{\\textrm\{([^}$]+)}}\$/g, sub);
//two version of superscript
tex = tex.replace(/\$([^\{\$]*)\^\{([^\}]+)\}\$/g, sup).replace(/\$([^\{\$]*)\^\{\\textrm\{([^\}]+)\}\}\$/g, sup);
tex = tex.replace(/\$([^{$]*)\^\{([^}]+)}\$/g, sup).replace(/\$([^{$]*)\^\{\\textrm\{([^}]+)}}\$/g, sup);
//small caps
tex = tex.replace(/\\textsc\{([^\}]+)/g, "<span style=\"small-caps\">$1</span>");
tex = tex.replace(/\\textsc\{([^}]+)/g, "<span style=\"small-caps\">$1</span>");
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and these

Comment on lines +932 to +937
// // XXX this code seems unmaintained? jabrefMap is not defined anywhere.
// if (parentCollection && record.intersection == '1') { // intersection with parent
// collection.children = jabrefMap(collection.children, function (n) {
// parentCollection.includes(n);
// });
// }
Copy link
Author

@kousu kousu Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jabrefMap is not defined. 58b257f mentioned this already, but I guess it wasn't a hard error then. Now it is.

I don't know what it's for so I took it out, but it should be fixed properly. Help me please ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant