mirror of
https://github.com/h-sphere/sql-seal.git
synced 2026-07-22 10:10:28 +00:00
fix: no longer capitalising renderer options
This commit is contained in:
parent
54981be715
commit
d7ec7a33b4
7 changed files with 38 additions and 11 deletions
|
|
@ -1,3 +1,6 @@
|
|||
# 0.23.2 (2025-02-04)
|
||||
- No longer captalising renderer options (it was breaking SQLSeal Charts integration)
|
||||
|
||||
# 0.23.1 (2025-02-04)
|
||||
- SQLSeal now works with multiple vaults open. It registers database with unique filename to avoid conflicts.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "sqlseal",
|
||||
"name": "SQLSeal",
|
||||
"version": "0.23.1",
|
||||
"version": "0.23.2",
|
||||
"minAppVersion": "0.15.0",
|
||||
"description": "Use SQL in your notes to query your vault files and CSV content.",
|
||||
"author": "hypersphere",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "sqlseal",
|
||||
"version": "0.23.1",
|
||||
"version": "0.23.2",
|
||||
"description": "A plugin for Obsidian that allows you to run SQL queries on your notes.",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -56,11 +56,16 @@ export class CodeblockProcessor extends MarkdownRenderChild {
|
|||
|
||||
this.flags = config.flags
|
||||
|
||||
this.extrasEl = this.el.createDiv({ cls: 'sqlseal-extras-container' })
|
||||
if (config.flags.explain) {
|
||||
this.explainEl = this.extrasEl.createEl('pre', { cls: 'sqlseal-extras-explain-container' })
|
||||
let rendererEl = this.el
|
||||
|
||||
if (this.flags.explain) {
|
||||
|
||||
this.extrasEl = this.el.createDiv({ cls: 'sqlseal-extras-container' })
|
||||
if (config.flags.explain) {
|
||||
this.explainEl = this.extrasEl.createEl('pre', { cls: 'sqlseal-extras-explain-container' })
|
||||
}
|
||||
rendererEl = this.el.createDiv({ cls: 'sqlseal-renderer-container' })
|
||||
}
|
||||
const rendererEl = this.el.createDiv({ cls: 'sqlseal-renderer-container' })
|
||||
|
||||
this.renderer = this.rendererRegistry.prepareRender(config.renderer.toLowerCase(), config.rendererArguments)(rendererEl)
|
||||
|
||||
|
|
|
|||
|
|
@ -75,4 +75,21 @@ describe('Parse Intermediate Content', () => {
|
|||
rendererArguments: ''
|
||||
})
|
||||
})
|
||||
|
||||
it('should properly parse parameter to the function', () => {
|
||||
expect(parseIntermediateContent(`
|
||||
explain
|
||||
no refresh
|
||||
grid {
|
||||
a: 5,
|
||||
b: 7
|
||||
}`, {})).toEqual({
|
||||
flags: { explain: true, refresh: false },
|
||||
renderer: 'GRID',
|
||||
rendererArguments: `{
|
||||
a: 5,
|
||||
b: 7
|
||||
}`
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { assign } from "lodash"
|
||||
import { assign, trim } from "lodash"
|
||||
|
||||
export interface IntermediateContent {
|
||||
flags: {
|
||||
|
|
@ -35,18 +35,19 @@ export const parseIntermediateContent = (content: string, initialConfig: Partial
|
|||
let processingFlags = true
|
||||
const rendererArguments = []
|
||||
for (const row of content.split('\n')) {
|
||||
const trimmedRow = row.trim().toUpperCase()
|
||||
const trimmedRow = row.trim()
|
||||
const upperRow = trimmedRow.toUpperCase()
|
||||
if (!trimmedRow) {
|
||||
continue // empty row
|
||||
}
|
||||
if (processingFlags) {
|
||||
if (!FLAGS[trimmedRow]) {
|
||||
if (!FLAGS[upperRow]) {
|
||||
processingFlags = false
|
||||
const [renderer, ...rest ] = trimmedRow.split(' ')
|
||||
config.renderer = renderer.toUpperCase()
|
||||
rendererArguments.push(rest.join(' '))
|
||||
} else {
|
||||
const fn = FLAGS[trimmedRow]
|
||||
const fn = FLAGS[upperRow]
|
||||
fn(config)
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -41,5 +41,6 @@
|
|||
"0.22.2": "0.15.0",
|
||||
"0.22.3": "0.15.0",
|
||||
"0.23.0": "0.15.0",
|
||||
"0.23.1": "0.15.0"
|
||||
"0.23.1": "0.15.0",
|
||||
"0.23.2": "0.15.0"
|
||||
}
|
||||
Loading…
Reference in a new issue