Skip to content
This repository has been archived by the owner on Mar 29, 2021. It is now read-only.

Commit

Permalink
4.4.1 (#162)
Browse files Browse the repository at this point in the history
* Fix breaking changes w react virtualized select. Closes #160

* Add stricter equality matching for citation duplicates. Closes #161

* Changes...

- Fix uncaught error in insertStaticBibliography. (Closes #164)
- Add sourcemap support in rollbar for better error reporting.

* Fix syntax error for php versions < 5.5. (Closes #163)

* Changes...

- Add microsoft-contrib-tslint rules and lint files (mostly).
- Fix html closing bracket issue in parsed URLs.
- Update tests.

* Update travis.yml

* Cache node_modules in travis

* Move lint into travis test pipeline (to trigger failures)

* Changes...

- Fix the rest of the lint errors

* Changes...

- Version bump + build output
- Add deploy script

* Changes...

- Update citeproc
- Add `Medicinskiy Akademicheskiy Zhurnal` style

* Update docker-compose.yml

* Update deps

* Changes...

- Add deploy npm script
- Update citeproc
  • Loading branch information
dsifford authored Sep 23, 2016
1 parent 9f6f0d4 commit 5b30389
Show file tree
Hide file tree
Showing 56 changed files with 545 additions and 393 deletions.
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: nodejs
node_js:
- "5"
- "6"
before_script:
- nvm install node
- node --version
Expand All @@ -9,7 +9,12 @@ before_script:
- npm install
script:
- npm test
after_script: "cat ./tmp/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
- npm run lint
after_success:
- cat ./tmp/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
branches:
only:
- master
cache:
directories:
- node_modules
2 changes: 1 addition & 1 deletion ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Please use this template for all bug reports. -->
<!-- Before submitting an issue, please try disabling all other plugins to ensure the issue is isolated within ABT -->

**ABT Version:** 4.4.0
**ABT Version:** 4.4.1

<!-- Which version of PHP are you using with your WordPress installation? -->
**PHP Version:** 5.6
Expand Down
20 changes: 11 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
version: '2'
services:
selenium:
image: selenium/hub
image: selenium/standalone-chrome-debug
ports:
- 4444:4444
chrome:
image: selenium/node-chrome
links:
- selenium
depends_on:
- selenium
environment:
- no_proxy=""
- HUB_PORT_4444_TCP_ADDR=selenium
- wordpress
# chrome:
# image: selenium/node-chrome
# links:
# - selenium
# depends_on:
# - selenium
# environment:
# - no_proxy=""
# - HUB_PORT_4444_TCP_ADDR=selenium
wordpress:
image: dsifford/wordpress
links:
Expand Down
5 changes: 4 additions & 1 deletion gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const browserSync = require('browser-sync').create();
gulp.task('reload', (done) => { browserSync.reload(); done(); });

// Delete all files in dist/lib
gulp.task('clean', () => del(['dist/**/*']));
gulp.task('clean', () => del(['dist/**/*', 'npm-debug.log']));

gulp.task('chown', (done) => {
exec("ls -l dist/ | awk '{print $3}' | tail -n -1", (err, stdout) => {
Expand Down Expand Up @@ -72,6 +72,7 @@ gulp.task('bump', () => {
gulp.task('rollbar', () =>
gulp.src('dist/lib/php/dom-injects.php', { base: './' })
.pipe(replace(/(payload: {\n.+?environment: "test"\n.+?})/, ''))
.pipe(replace(/(\s+code_version: ")[\d.]+(",)/, `$1${VERSION}$2`))
.pipe(gulp.dest('./'))
);

Expand Down Expand Up @@ -198,6 +199,7 @@ gulp.task('webpack:prod', () =>
gulp.task('js', () =>
gulp
.src('dist/**/*.js', { base: 'dist' })
.pipe(sourcemaps.init())
.pipe(uglify({
compress: {
dead_code: true,
Expand All @@ -206,6 +208,7 @@ gulp.task('js', () =>
drop_console: true,
},
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'))
);

Expand Down
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "academic-bloggers-toolkit",
"version": "4.4.0",
"version": "4.4.1",
"description": "A plugin extending the functionality of WordPress for Academic Blogging.",
"main": "index.js",
"scripts": {
"test": "jest",
"wp": "wpcmd() { docker exec $(docker ps -lq) /bin/bash -c \"sudo -u www-data wp $(echo $@)\"; };wpcmd ",
"lint": "tslint src/lib/**/*{ts,tsx}",
"lint": "./node_modules/.bin/tslint -e \"node_modules/**/*\" \"**/*.+(ts|tsx)\" -t stylish",
"start": "NODE_ENV=development node --max_old_space_size=8192 node_modules/.bin/gulp _dev",
"build": "NODE_ENV=production node_modules/.bin/gulp _build",
"deploy": "./scripts/deploy $npm_package_version",
"update-styles": "node ./scripts/updateStyles.js",
"update-vendors": "cd src/vendor && curl -o 'citeproc.js' https://raw.githubusercontent.com/Juris-M/citeproc-js/master/citeproc.js"
},
Expand Down Expand Up @@ -43,7 +44,7 @@
"enzyme": "^2.4.1",
"eslint": "^3.5.0",
"eslint-config-airbnb-base": "^7.1.0",
"eslint-plugin-import": "^1.15.0",
"eslint-plugin-import": "^1.16.0",
"gulp": "github:gulpjs/gulp#4.0",
"gulp-replace": "^0.5.4",
"gulp-sort": "^2.0.0",
Expand All @@ -61,14 +62,16 @@
"style-loader": "^0.13.1",
"ts-loader": "^0.8.2",
"tslint": "^3.15.1",
"tslint-microsoft-contrib": "^2.0.12",
"tslint-react": "^1.0.0",
"webpack": "^2.1.0-beta.21",
"webpack-stream": "^3.2.0"
},
"dependencies": {
"@types/enzyme": "^2.4.33",
"@types/jest": "^0.9.31",
"@types/react": "^0.14.35",
"@types/enzyme": "^2.4.34",
"@types/jest": "^15.1.32",
"@types/node": "^6.0.41",
"@types/react": "^0.14.37",
"@types/react-addons-css-transition-group": "^0.14.17",
"@types/react-dom": "^0.14.17",
"@types/sinon": "^1.16.30",
Expand All @@ -78,7 +81,7 @@
"react-addons-css-transition-group": "^15.3.2",
"react-addons-shallow-compare": "^15.3.2",
"react-dom": "^15.3.2",
"react-virtualized-select": "^1.4.0",
"react-virtualized-select": "^2.0.0",
"typescript": "^2.1.0-dev.20160724"
},
"babel": {
Expand Down
32 changes: 32 additions & 0 deletions scripts/deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

[ ! "$1" ] && echo 'the first argument of this script must be the version number' && exit 1
[[ ! "$1" =~ ^[0-9]{1,4}\.[0-9]{1,4}\.[0-9]{1,4}$ ]] && echo 'the first argument must be a valid semver number' && exit 1

VERSION="$1"
SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOTDIR=$(cd "$SCRIPTDIR" && cd ../ && pwd || exit)
SVNROOT=$(cd "$ROOTDIR" && cd ../SVN && pwd || exit)

# Make sure svn repo is up to date
cd "$SVNROOT" || exit
svn up

# Delete entire trunk directory
rm -rf trunk/*

# Create tag directory
mkdir -p "tags/$VERSION"

# Copy dist over to tag and trunk directory
cp -r "$ROOTDIR"/dist/* "$SVNROOT"/trunk/
cp -r "$ROOTDIR"/dist/* "$SVNROOT"/tags/"$VERSION"/

# Remove deleted files
svn stat | grep -Po '^!.+' | awk '{print $2}' | xargs svn rm

# Add new files
svn stat | grep -Po '^\?.+' | awk '{print $2}' | xargs svn add

# Commit the changes
svn ci -m "Release $VERSION"
6 changes: 3 additions & 3 deletions scripts/fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ exports.ABT_i18n = {
},
"menu": {
"tooltips": {
"import": "Import references from RIS file",
"importRIS": "Import references from RIS file",
"refresh": "Refresh reference list",
"destroy": "Delete all references",
"help": "Usage instructions",
Expand All @@ -268,7 +268,7 @@ exports.ABT_i18n = {
"filetypeError": "The file could not be processed. Are you sure it's a .RIS (Refman) file?",
"leftovers": "The following references were unable to be processed",
"upload": "Choose File",
"import": "Import"
"importBtn": "Import"
},
"pubmedWindow": {
"title": "Search PubMed for Reference",
Expand All @@ -289,7 +289,7 @@ exports.ABT_i18n = {
"given": "Given Name, M.I."
},
"manualEntryContainer": {
"type": "Citation Type"
"citationType": "Citation Type"
},
"identifierInput": {
"label": "PMID/DOI"
Expand Down
4 changes: 2 additions & 2 deletions src/academic-bloggers-toolkit.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
* Plugin Name: Academic Blogger's Toolkit
* Plugin URI: https://wordpress.org/plugins/academic-bloggers-toolkit/
* Description: A plugin extending the functionality of Wordpress for academic blogging
* Version: 4.4.0
* Version: 4.4.1
* Author: Derek P Sifford
* Author URI: https://github.com/dsifford
* License: GPL3 or later
* Text Domain: academic-bloggers-toolkit
*/

define('ABT_VERSION', '4.4.0');
define('ABT_VERSION', '4.4.1');


/**
Expand Down
8 changes: 4 additions & 4 deletions src/academic-bloggers-toolkit.pot
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Copyright (C) 2016 Academic Blogger's Toolkit 4.4.0
# This file is distributed under the same license as the Academic Blogger's Toolkit 4.4.0 package.
# Copyright (C) 2016 Academic Blogger's Toolkit 4.4.1
# This file is distributed under the same license as the Academic Blogger's Toolkit 4.4.1 package.
msgid ""
msgstr ""
"Project-Id-Version: Academic Blogger's Toolkit 4.4.0\n"
"Project-Id-Version: Academic Blogger's Toolkit 4.4.1\n"
"Report-Msgid-Bugs-To: https://github.com/dsifford/academic-bloggers-toolkit/issues\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -584,7 +584,7 @@ msgid "PHP Version"
msgstr ""

#: lib/php/views/options-page.php:23
msgid "PHP version should be > 5.4 (Recommended Version = 7.0.0)"
msgid "PHP version should be > 5.5 (Recommended Version = 7.0.0)"
msgstr ""

#: lib/php/views/options-page.php:30
Expand Down
22 changes: 11 additions & 11 deletions src/lib/js/Frontend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ class Citations {
public bibliography: HTMLDivElement;

constructor() {
this.bibliography = document.getElementById('abt-smart-bib') as HTMLDivElement;
this.bibliography = <HTMLDivElement>document.getElementById('abt-smart-bib');
const citationList = document.getElementsByClassName('abt_cite');

for (let i = 0; i < citationList.length; i++) {

const citation = citationList[i] as HTMLSpanElement;
const citation = <HTMLSpanElement>citationList[i];
const citations: string[] = JSON.parse(citation.dataset['reflist']);
const citationHTML = citations.map((id: string): string => this.bibliography.children[id].outerHTML);

Expand Down Expand Up @@ -40,7 +40,7 @@ class Citations {
heading.classList.toggle('abt-hidden');

this.bibliography.appendChild(container);
for (let el of citations) {
for (const el of citations) {
container.appendChild(el);
}

Expand All @@ -60,25 +60,25 @@ class Citations {
e.preventDefault();
clearTimeout(Citations.timer);

let preExistingTooltip: HTMLElement = document.getElementById('abt_tooltip');
const preExistingTooltip: HTMLElement = document.getElementById('abt_tooltip');
if (preExistingTooltip !== null) {
preExistingTooltip.parentElement.removeChild(preExistingTooltip);
}

let rect: ClientRect = (e.target as HTMLElement).getBoundingClientRect();
const rect: ClientRect = (<HTMLElement>e.target).getBoundingClientRect();

let tooltip: HTMLDivElement = document.createElement('div');
const tooltip: HTMLDivElement = document.createElement('div');
tooltip.className = tooltip.id = 'abt_tooltip';
tooltip.innerHTML = (e.target as HTMLElement).getAttribute('data-citations');
tooltip.innerHTML = (<HTMLElement>e.target).getAttribute('data-citations');
tooltip.style.visibility = 'hidden';

let tooltipArrow: HTMLDivElement = document.createElement('div');
const tooltipArrow: HTMLDivElement = document.createElement('div');
tooltipArrow.className = 'abt_tooltip_arrow';

if (this.isTouchDevice()) {

let closeButton: HTMLDivElement = document.createElement('div');
let touchContainer: HTMLDivElement = document.createElement('div');
const closeButton: HTMLDivElement = document.createElement('div');
const touchContainer: HTMLDivElement = document.createElement('div');

touchContainer.className = 'abt_tooltip_touch_close-container';
closeButton.className = 'abt_tooltip_touch_close';
Expand Down Expand Up @@ -128,7 +128,7 @@ class Citations {

private destroyTooltip(): void {
Citations.timer = setTimeout(() => {
let tip = document.getElementById('abt_tooltip');
const tip = document.getElementById('abt_tooltip');
tip.parentElement.removeChild(tip);
}, 200);
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/js/reference-list/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ export function getRemoteData(identifierList: string, mce: TinyMCE.WindowManager
reject(err);
});
});
};
}

export function parseManualData(payload: ABT.ReferenceWindowPayload): Promise<CSL.Data[]|Error> {
return new Promise(resolve => {
payload.people.forEach(person => {
if (typeof payload.manualData[person.type] === 'undefined') {
if (payload.manualData[person.type] === undefined) {
payload.manualData[person.type] = [{ family: person.family, given: person.given }];
return;
}
Expand Down
13 changes: 11 additions & 2 deletions src/lib/js/reference-list/Store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@ class CitationStore {
this.CSL = this.cleanCSL(CSL);
intercept(this.CSL, (change) => {
if (change.type !== 'add') return change;
if (this.lookup.titles.indexOf(change.newValue.title) > -1) return null;
const title = change.newValue.title.toLowerCase();
const matchIndex: number = this.CSL.values().findIndex(v => v.title.toLowerCase() === title);
if (matchIndex > -1) {
const match = this.CSL.get(this.CSL.keys()[matchIndex]);
const deepMatch = Object.keys(change.newValue).some(k => {
if (['title', 'type'].indexOf(k) > -1) return false;
return change.newValue[k] === match[k];
});
if (deepMatch) return null;
}
return change;
});
}
Expand Down Expand Up @@ -88,7 +97,7 @@ class CitationStore {
data.reduce((prev, curr) => {
prev[curr.id] = curr;
return prev;
}, {} as {[itemId: string]: CSL.Data})
}, <{[itemId: string]: CSL.Data}>{})
);
}

Expand Down
Loading

0 comments on commit 5b30389

Please sign in to comment.