From d7ec7a33b451eef71e062b09b13e5318350dabad Mon Sep 17 00:00:00 2001 From: Kacper Kula Date: Tue, 4 Feb 2025 18:26:27 +0000 Subject: [PATCH] fix: no longer capitalising renderer options --- CHANGELOG.md | 3 +++ manifest.json | 2 +- package.json | 2 +- src/codeblockHandler/CodeblockProcessor.ts | 13 +++++++++---- src/grammar/parseIntermediateContent.test.ts | 17 +++++++++++++++++ src/grammar/parseIntermediateContent.ts | 9 +++++---- versions.json | 3 ++- 7 files changed, 38 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95bc8b4..1c50c06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/manifest.json b/manifest.json index cbf6808..e1f98ac 100644 --- a/manifest.json +++ b/manifest.json @@ -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", diff --git a/package.json b/package.json index 3a1ef09..f7be772 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/codeblockHandler/CodeblockProcessor.ts b/src/codeblockHandler/CodeblockProcessor.ts index c226de9..6d03ae4 100644 --- a/src/codeblockHandler/CodeblockProcessor.ts +++ b/src/codeblockHandler/CodeblockProcessor.ts @@ -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) diff --git a/src/grammar/parseIntermediateContent.test.ts b/src/grammar/parseIntermediateContent.test.ts index 0f4959c..8bce0a6 100644 --- a/src/grammar/parseIntermediateContent.test.ts +++ b/src/grammar/parseIntermediateContent.test.ts @@ -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 +}` +}) + }) }) \ No newline at end of file diff --git a/src/grammar/parseIntermediateContent.ts b/src/grammar/parseIntermediateContent.ts index 7701d61..e166662 100644 --- a/src/grammar/parseIntermediateContent.ts +++ b/src/grammar/parseIntermediateContent.ts @@ -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 { diff --git a/versions.json b/versions.json index ad476e3..04d3c52 100644 --- a/versions.json +++ b/versions.json @@ -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" } \ No newline at end of file