Skip to content

Commit

Permalink
Merge branch 'master' into gh-2522
Browse files Browse the repository at this point in the history
  • Loading branch information
retorquere committed Nov 18, 2024
2 parents 514502d + 2b5a897 commit 30392f8
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 17 deletions.
4 changes: 3 additions & 1 deletion .ncurc.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module.exports = require('zotero-plugin/.ncurc')
module.exports = {
reject: ['eslint']
}
3 changes: 2 additions & 1 deletion content/ZoteroItemPane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Elements } from './create-element'
import { busyWait } from './busy-wait'
import { icons } from './icons'
import { Events } from './events'
import { is7 } from './client'

async function title_sentenceCase(label) {
const val = this._getFieldValue(label)
Expand Down Expand Up @@ -44,7 +45,7 @@ export class ZoteroItemPane {
this.document = win.document
const elements = this.elements = new Elements(this.document)

if (!this.document.getElementById('better-bibtex-editpane-item-box')) {
if (!is7 && !this.document.getElementById('better-bibtex-editpane-item-box')) {
itemBox.parentNode.appendChild(elements.create('vbox', { flex: 1, style: 'margin: 0; padding: 0', $: [

elements.create('grid', { id: 'better-bibtex-editpane-item-box', $: [
Expand Down
2 changes: 1 addition & 1 deletion site/content/installation/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ weight: 1
Install by downloading the [latest release](https://github.com/retorquere/zotero-better-bibtex/releases/latest) -- if you use Firefox, make sure to right-click and save the XPI file, not just clicking it -- and then in Zotero:

1. In the main menu go to Tools > Add-ons
2. Select 'Extensions'
2. Select 'Plugins'
3. Click on the gear in the top-right corner and choose 'Install Add-on From File...'
4. Choose .xpi that you've just downloaded, click 'Install'
5. If you're using Zotero 6, restart Zotero. Installation in Zotero 7 requires no restart.
Expand Down
27 changes: 17 additions & 10 deletions test/features/steps/zotero.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,21 +198,22 @@ def __init__(self, path=None, body=None, client=None, ext=None):

self.base = path
self.body = body
self.client = client
self.client = client.split('-')[0]
self.beta = '-beta' in client

self.data = None
self.patch = None
self.path = None
self.exported = None

if self.base:
self.patch = self.base + '.' + self.client + '.patch'
patches = [ self.base + '.' + client + '.patch' ]
if self.beta: patches.append(self.base + '.' + self.client + '.patch')
self.patch = next((patch for patch in patches if os.path.exists(patch)), None)
self.path = self.base

if os.path.exists(self.patch):
self.path = self.base[:-len(self.ext)] + '.' + self.client + self.ext
else:
self.patch = None
if self.patch:
self.path = self.base[:-len(self.ext)] + '.' + self.patch.split('.')[-2] + self.ext

if not self.body and self.base and os.path.exists(self.base):
with open(self.base) as f:
Expand Down Expand Up @@ -475,12 +476,18 @@ def reset(self, scenario):
def reset_cache(self):
self.execute('await Zotero.BetterBibTeX.TestSupport.resetCache()')

def qualifiedclient(self):
if self.beta:
return f'{self.client}-beta'
else:
return self.client

def quick_copy(self, itemIDs, translator, expected):
found = self.execute('return await Zotero.BetterBibTeX.TestSupport.quickCopy(itemIDs, translator)',
translator=translator,
itemIDs=itemIDs
)
expected = Library(path=expected, client=self.client)
expected = Library(path=expected, client=self.qualifiedclient())
assert_equal_diff(expected.body, found.strip())

def export_library(self, translator, displayOptions = {}, collection = None, output = None, expected = None, resetCache = False):
Expand Down Expand Up @@ -511,8 +518,8 @@ def export_library(self, translator, displayOptions = {}, collection = None, out

if expected is None: return

expected = Library(path=expected, client=self.client)
found = Library(path=output, body=found, client=self.client, ext=expected)
expected = Library(path=expected, client=self.qualifiedclient())
found = Library(path=output, body=found, client=self.qualifiedclient(), ext=expected)
found.save(expected.path)

if expected.ext in ['.csl.json', '.csl.yml', '.html', '.bib', '.bibtex', '.biblatex']:
Expand All @@ -529,7 +536,7 @@ def summary(items):
def import_file(self, context, references, collection = False, items=True):
assert type(collection) in [bool, str]

input = Library(path=references, client=self.client)
input = Library(path=references, client=self.qualifiedclient())

if input.path.endswith('.json'):
# TODO: clean lib and test against schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
address = {Perth, Australia},
doi = {10.1109/INDIN51773.2022.9976107},
urldate = {2023-01-02},
isbn = {978-1-72817-568-3},
keywords = {Artificial Intelligence,Cyber-Physical Systems,Digital twin,Digital Twin,Education,Electronic learning,Java,Multi-agent Systems,Pandemics,Production facilities,Production systems}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"items": [
{
"DOI": "10.1109/INDIN51773.2022.9976107",
"ISBN": "978-1-72817-568-3",
"accessDate": "2023-01-02T15:23:50Z",
"citationKey": "radler_integration_2022",
"conferenceName": "2022 IEEE 20th International Conference on Industrial Informatics (INDIN)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
address = {Perth, Australia},
doi = {10.1109/INDIN51773.2022.9976107},
urldate = {2023-01-02},
isbn = {978-1-72817-568-3},
keywords = {Artificial Intelligence,Cyber-Physical Systems,Digital twin,Digital Twin,Education,Electronic learning,Java,Multi-agent Systems,Pandemics,Production facilities,Production systems}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
address = {Perth, Australia},
url = {https://ieeexplore.ieee.org/document/9976107/},
urldate = {2023-01-02},
- isbn = {978-1-7281-7568-3},
+ isbn = {978-1-72817-568-3},
keywords = {Artificial Intelligence,Cyber-Physical Systems,Digital twin,Digital Twin,Education,Electronic learning,Java,Multi-agent Systems,Pandemics,Production facilities,Production systems}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@@ -9,6 +9,6 @@
address = {Perth, Australia},
doi = {10.1109/INDIN51773.2022.9976107},
urldate = {2023-01-02},
- isbn = {978-1-7281-7568-3},
+ isbn = {978-1-72817-568-3},
keywords = {Artificial Intelligence,Cyber-Physical Systems,Digital twin,Digital Twin,Education,Electronic learning,Java,Multi-agent Systems,Pandemics,Production facilities,Production systems}
}

0 comments on commit 30392f8

Please sign in to comment.