generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
388b500
commit fd1ac68
Showing
22 changed files
with
404 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"id": "solve", | ||
"name": "Solve", | ||
"version": "0.8.2", | ||
"version": "0.9.0", | ||
"minAppVersion": "0.15.0", | ||
"description": "Level Up Your Notes: Introducing Solve – Your Math Maestro! Real-time calculations without AI fuss. From date magic ('Now + 20 days') to arithmetic flair ('10 + 5'), your trusted sidekick in every note. More brilliance on the way!", | ||
"description": "Supercharge your notes in Obsdian with real-time calculations without AI fuss. From date magic ('Now + 20 days') to arithmetic flair ('10 + 5').", | ||
"author": "Liam Riddell", | ||
"authorUrl": "https://github.com/LiamRiddell", | ||
"fundingUrl": { | ||
"Buy Me a Coffee": "https://www.buymeacoffee.com/liamriddell", | ||
"GitHub Sponser": "https://github.com/sponsors/LiamRiddell" | ||
}, | ||
"isDesktopOnly": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { BasePipelineStage } from "@/pipelines/definition/stages/BasePipelineStage"; | ||
import { IResult } from "@/results/definition/IResult"; | ||
import { ResultSubstitutionFormatVisitor } from "@/visitors/format/VariableSubstitutionFormatVisitor"; | ||
|
||
// Important: Since this stage is stateful it can not be used in a shared context. | ||
export class PreviousResultSubstitutionStage extends BasePipelineStage<string> { | ||
private previousResultSubstitutionRegex = new RegExp(/\$prev/gi); | ||
private resultSubstitutionVisitor: ResultSubstitutionFormatVisitor; | ||
|
||
// TODO: We want to switch to passing around IResult as opposed a string as this is more re-usable. | ||
private previousResult: IResult<any>; | ||
private previousResultString: string; | ||
|
||
constructor() { | ||
super(); | ||
this.resultSubstitutionVisitor = new ResultSubstitutionFormatVisitor(); | ||
} | ||
|
||
protected execute(request: string): string { | ||
// Substitute previous solve into the expression | ||
// if (this.previousResult) { | ||
// console.log( | ||
// "PREVIOUS SOLVE", | ||
// this.previousResult, | ||
// "EXPRESSION", | ||
// request | ||
// ); | ||
|
||
// request = request.replace( | ||
// this.previousResultSubstitutionRegex, | ||
// this.resultSubstitutionVisitor.visit(this.previousResult) | ||
// ); | ||
// } | ||
|
||
if (this.previousResultString) { | ||
return request.replace( | ||
this.previousResultSubstitutionRegex, | ||
this.previousResultString | ||
); | ||
} | ||
|
||
return request; | ||
} | ||
|
||
public setPreviousResult(result: IResult<any>) { | ||
this.previousResult = result; | ||
} | ||
|
||
public setPreviousResultString(string: string) { | ||
this.previousResultString = string; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.