Skip to content

Commit

Permalink
fix #104
Browse files Browse the repository at this point in the history
  • Loading branch information
mProjectsCode committed Jun 26, 2023
1 parent b652e7a commit d35de94
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions exampleVault/View Fields/Other Note.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
text: test
---
6 changes: 6 additions & 0 deletions exampleVault/View Fields/View Field.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ Number one is: `VIEW[{number1}]` units
Number two is: `VIEW[{number2}]` units

Combined: `VIEW[{number1} * {number2}]` cm equals `VIEW[{number2} * {number1} cm to {unit}]`

## Other Note

`INPUT[text:Other Note#text]`

`VIEW[{Other Note#text}]`
2 changes: 2 additions & 0 deletions src/parsers/BindTargetParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { parsePath } from '@opd-libs/opd-utils-lib/lib/ObjectTraversalUtils';
import { IPlugin } from '../IPlugin';

export interface BindTargetDeclaration {
fullDeclaration: string;
filePath: string;
fileName: string;
metadataFieldName: string;
Expand All @@ -22,6 +23,7 @@ export class BindTargetParser {
}

const bindTargetDeclaration: BindTargetDeclaration = {} as BindTargetDeclaration;
bindTargetDeclaration.fullDeclaration = bindTargetString;

const bindTargetParts: string[] = bindTargetString.split('#');

Expand Down
2 changes: 1 addition & 1 deletion src/renderChildren/JsViewFieldMDRC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class JsViewFieldMDRC extends AbstractViewFieldMDRC {
}
}

parseExpression() {
parseExpression(): void {
if (!this.viewFieldDeclaration.code) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/renderChildren/ViewFieldMDRC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class ViewFieldMDRC extends AbstractViewFieldMDRC {
}
}

parseExpression() {
parseExpression(): void {
const declaration = this.viewFieldDeclaration.declaration ?? '';
let varCounter = 0;

Expand All @@ -77,7 +77,7 @@ export class ViewFieldMDRC extends AbstractViewFieldMDRC {
substring = substring.substring(1, substring.length - 1).trim();
// replace by variable name;
for (const variable of this.variables) {
if (variable.bindTargetDeclaration.metadataFieldName === substring) {
if (variable.bindTargetDeclaration.fullDeclaration === substring) {
let varName = `MB_VAR_${varCounter}`;
variable.contextName = varName;
varCounter += 1;
Expand Down

0 comments on commit d35de94

Please sign in to comment.