Skip to content

Commit

Permalink
Merge branch 'master' into gh-2927
Browse files Browse the repository at this point in the history
  • Loading branch information
retorquere committed Jan 2, 2025
2 parents 3fe98fb + a659b23 commit 14cbc35
Show file tree
Hide file tree
Showing 15 changed files with 1,397 additions and 1,734 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
curl -sL https://raw.githubusercontent.com/retorquere/zotero-deb/master/install.sh | sudo bash
sudo apt-get update
sudo apt-get install ${{ matrix.client }}
sudo apt-get install mesa-utils libegl1-mesa xvfb
sudo apt-get install mesa-utils xvfb
curl -LO https://github.com/jgm/pandoc/releases/download/3.1.11.1/pandoc-3.1.11.1-linux-amd64.tar.gz
tar xvzf pandoc-3.1.11.1-linux-amd64.tar.gz
sudo mv pandoc-3.1.11.1/bin/pandoc /usr/bin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/src/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
curl -sL https://raw.githubusercontent.com/retorquere/zotero-deb/master/install.sh | sudo bash
sudo apt-get update
sudo apt-get install ${{ matrix.client }}
sudo apt-get install mesa-utils libegl1-mesa xvfb
sudo apt-get install mesa-utils xvfb
curl -LO https://github.com/jgm/pandoc/releases/download/3.1.11.1/pandoc-3.1.11.1-linux-amd64.tar.gz
tar xvzf pandoc-3.1.11.1-linux-amd64.tar.gz
sudo mv pandoc-3.1.11.1/bin/pandoc /usr/bin
Expand Down
33 changes: 2 additions & 31 deletions content/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,6 @@ function log(msg) {
}
}

// Loads default preferences from prefs.js in Zotero 6
function setDefaultPrefs(rootURI) {
const branch = Services.prefs.getDefaultBranch('')
const obj = {
pref: (pref, value) => {
switch (typeof value) {
case 'boolean':
branch.setBoolPref(pref, value)
break
case 'string':
branch.setStringPref(pref, value)
break
case 'number':
branch.setIntPref(pref, value)
break
default:
log(`Invalid type '${ typeof (value) }' for pref '${ pref }'`)
}
},
}
Services.scriptloader.loadSubScriptWithOptions(`${ rootURI }prefs.js`, {
target: obj,
charset: 'utf-8',
// ignoreCache: true
})
}

export function install(_data: any, _reason: ReasonId) {
log('install, nothing to do')
}
Expand All @@ -82,8 +55,6 @@ export async function startup({ resourceURI, rootURI = resourceURI.spec }, reaso

if (Zotero.BetterBibTeX) throw new Error('Better BibTeX is already started')

setDefaultPrefs(rootURI)

const $window = Cc['@mozilla.org/appshell/appShellService;1'].getService(Ci.nsIAppShellService).hiddenDOMWindow
Services.scriptloader.loadSubScriptWithOptions(`${ rootURI }content/better-bibtex.js`, {
charset: 'utf=8',
Expand Down Expand Up @@ -128,8 +99,8 @@ export async function startup({ resourceURI, rootURI = resourceURI.spec }, reaso
onMainWindowLoad({ window: Zotero.getMainWindow() })
}
catch (err) {
alert({ title: 'Better BibTeX startup failed', text: `${ err }` })
log(`${ err }\n${ err.stack }`)
alert({ title: 'Better BibTeX startup failed', text: `${err}\n${err.stack}` })
log(`${ err }\n${err.stack}`)
}
}

Expand Down
4 changes: 4 additions & 0 deletions content/db/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@ export const Cache = new class $Cache {
if (worker) return true

log.info('cache: validating schema')

// #3111 -- what the *actual*?!?!
if (!this.db.objectStoreNames.length) return false

const tx = this.db.transaction(this.db.objectStoreNames, 'readonly')
const schema: Record<string, any> = {}
for (const storeName of this.db.objectStoreNames) {
Expand Down
4 changes: 2 additions & 2 deletions content/prefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ export const Preference = new class PreferenceManager extends PreferenceManagerB
break
}
}
catch {
error = `could not set default for ${ pref } to ${ typeof value } ${ JSON.stringify(value) }`
catch (err) {
error = `could not set default for ${pref} to ${typeof value} ${JSON.stringify(value)} (${err.message})`
}
if (error) {
const v = Zotero.Prefs.get(`translators.better-bibtex.${ pref }`)
Expand Down
54 changes: 54 additions & 0 deletions content/spreadsheet.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
doctype xml
office:document(
office:version="1.3"
office:mimetype="application/vnd.oasis.opendocument.spreadsheet"
xmlns:office='urn:oasis:names:tc:opendocument:xmlns:office:1.0'
xmlns:config='urn:oasis:names:tc:opendocument:xmlns:config:1.0'
xmlns:loext='urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0'
xmlns:table='urn:oasis:names:tc:opendocument:xmlns:table:1.0'
xmlns:fo='urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0'
xmlns:ooo='http://openoffice.org/2004/office'
xmlns:style='urn:oasis:names:tc:opendocument:xmlns:style:1.0'
xmlns:calcext='urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0'
xmlns:text='urn:oasis:names:tc:opendocument:xmlns:text:1.0'
)
office:settings
config:config-item-set(config:name="ooo:view-settings")
config:config-item-map-indexed(config:name="Views")
config:config-item-map-entry
config:config-item(config:name="ViewId" config:type="string") view1
config:config-item-map-named(config:name="Tables")
each rows, name in sheets
config:config-item-map-entry(config:name=name)
config:config-item(config:name="HorizontalSplitMode" config:type="short") 0
config:config-item(config:name="VerticalSplitMode" config:type="short") 2
config:config-item(config:name="HorizontalSplitPosition" config:type="int") 0
config:config-item(config:name="VerticalSplitPosition" config:type="int") 1
config:config-item(config:name="ActiveSplitRange" config:type="short") 0
config:config-item(config:name="PositionLeft" config:type="int") 0
config:config-item(config:name="PositionRight" config:type="int") 0
config:config-item(config:name="PositionTop" config:type="int") 0
config:config-item(config:name="PositionBottom" config:type="int") 1
office:styles
loext:theme(loext:name="Office")
loext:theme-colors(loext:name="LibreOffice")
office:automatic-styles
style:style(style:name="ce1" style:family="table-cell" style:parent-style-name="Default")
style:text-properties(fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold")
office:body
office:spreadsheet
each rows, name in sheets
table:table(table:name=name table:style-name="ta1")
- const columns = Object.keys(rows[0])
table:table-column(table:style-name="co1" table:number-columns-repeated="16384" table:default-cell-style-name="ce1")
table:table-row(table:style-name="ro1")
each column in columns
table:table-cell(office:value-type="string" calcext:value-type="string")
text:p= column
table:table-cell(table:number-columns-repeated="16382")
each row in rows
table:table-row(table:style-name="ro1")
each column in columns
table:table-cell(table:style-name="Default" office:value-type="string" calcext:value-type="string")
text:p= row[column]
table:table-cell(table:style-name="Default" table:number-columns-repeated="16382")
Loading

0 comments on commit 14cbc35

Please sign in to comment.